How to generate Master/Deltail XML from maridb Rowsets ?
How to generate Master/Deltail XML from maridb Rowsets ?
Dear Rao Sir ,
want to generate one .XML file from using Maridb Master detail rowsets , could you please share any example for the same. Thanks in advance..!
Thanks
Shridhar
want to generate one .XML file from using Maridb Master detail rowsets , could you please share any example for the same. Thanks in advance..!
Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Can you let me know how can you make xml from master-detail DBF files?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Dear Rao Sir ,
I have never tried on XML generation in Harbour , I am seeking a function that accepts rowset and generate .XML string as similar rowset:GETROWS method which returns an array.
I have checked in the sample folder I could not find the example which generate .XML. But there are example which parse/read XML file.
Thanks
Shridhar
I have never tried on XML generation in Harbour , I am seeking a function that accepts rowset and generate .XML string as similar rowset:GETROWS method which returns an array.
I have checked in the sample folder I could not find the example which generate .XML. But there are example which parse/read XML file.
Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
Re: How to generate Master/Deltail XML from maridb Rowsets ?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: How to generate Master/Deltail XML from maridb Rowsets ?
You have from 18.11 this functions in Fw
Before applying the class that I have suggested, you can previously use these functions to convert your obtained data to Hash or Json
Before applying the class that I have suggested, you can previously use these functions to convert your obtained data to Hash or Json
* New Json (and Hash) support functions:
- ArrToHash( acHeader, aData )
Returns hHash with aHeader as keys and aData as values.
If aData is multi-dimensional array returns array of hashes
If acHeader is 2 dimensional array and aData is nil, first
dimension of acHeader is considered as head and second dimension
is considered as data.
- ArrToJson( acHeader, aData )
- RsToJson( oAdoRs, [nRows], [nStart], [aFields] ) --> Json Array
- FW_RecToJson( [acFields], [acNames] ) // for dbf record
- FW_DbfToJson( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [aData] )
- FW_DbfToHash( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [aData] )
- oMariaRs:RecToJson( [aFields] )
- oMariaRs:ToJson( [anRows], [nStart], [aFields] )
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Rowset has the following methods:
Generate Hash or Json from the table and then Generate XML from Hash or Json using Mr. Cristobal's class.
Result:
But when we talk about XML, we should also be clear about the format. Do we need field attributes (like field type, width, etc) embedded in the xml file. So, it is not as straight forward
Code: Select all
METHOD ToJson( anRecs, nStaPos, aFields, lwithRowNum )
METHOD ToHash( anRecs, nStaPos, aFields, lwithRowNum )
METHOD GetRows( anRecs, nStartPos, aFields, lwithRowNum )
Code: Select all
oCn := FW_DemoDB()
cJson := oCn:States:ToJson()
oCn:Close()
Code: Select all
[{"id":2,"CODE":"MT","NAME":"montana"},{"id":4,"CODE":"ND","NAME":"North Dakota"},{"id":5,"CODE":"SD","NAME":"South Dakota"},{"id":6,"CODE":"WY","NAME":"Wyoming"},{"id":7,"CODE":"WI","NAME":"Wisconsin A"},{"id":14,"CODE":"MA","NAME":"Massachusetts"},{"id":15,"CODE":"NE","NAME":"Nebraska hola"},{"id":16,"CODE":"NY","NAME":"New York 2"},{"id":17,"CODE":"PA","NAME":"Pennsylvania"},{"id":18,"CODE":"CT","NAME":"Connecticut"},{"id":19,"CODE":"RI","NAME":"RRRRRDIsland"},{"id":20,"CODE":"NJ","NAME":"New Jersey"},{"id":21,"CODE":"IN","NAME":"Indiana"},{"id":22,"CODE":"NV","NAME":"Nevada xxx"},{"id":23,"CODE":"UT","NAME":"Utah"},{"id":24,"CODE":"CA","NAME":"California"},{"id":25,"CODE":"OH","NAME":"Ohio"},{"id":26,"CODE":"IL","NAME":"Illinois"},{"id":27,"CODE":"DC","NAME":"District of Columbia"},{"id":28,"CODE":"DE","NAME":"Delaware Kansas"},{"id":30,"CODE":"MD","NAME":"Maryland"},{"id":31,"CODE":"CO","NAME":"Colorado"},{"id":32,"CODE":"KY","NAME":"Kentucky"},{"id":33,"CODE":"KS","NAME":"Kansas"},{"id":34,"CODE":"VA","NAME":"Virginia"},{"id":35,"CODE":"MO","NAME":"Missouri"},{"id":36,"CODE":"AZ","NAME":"Arizona"},{"id":37,"CODE":"OK","NAME":"Oklahoma"},{"id":38,"CODE":"NC","NAME":"North Carolina"},{"id":39,"CODE":"TN","NAME":"Tennessee"},{"id":40,"CODE":"TX","NAME":"Texas"},{"id":42,"CODE":"AL","NAME":"Alabama"},{"id":43,"CODE":"MS","NAME":"Mississippi"},{"id":44,"CODE":"GA","NAME":"Georgia"},{"id":45,"CODE":"SC","NAME":"South Carolina"},{"id":46,"CODE":"AR","NAME":"Arkansas"},{"id":47,"CODE":"LA","NAME":"Louisiana"},{"id":48,"CODE":"FL","NAME":"Florida"},{"id":49,"CODE":"MI","NAME":"Michigan"},{"id":50,"CODE":"HI","NAME":"SDFS"},{"id":51,"CODE":"AK","NAME":"Alaska"},{"id":52,"CODE":"CY","NAME":"Cyprus"},{"id":53,"CODE":"10","NAME":"VILIAN ARRAES"}]
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Ok, with this Json of Mr Rao, please
or
But, if you use METHOD End(), please modify this method
Code: Select all
Function Main()
local cJson
local hHash
local lRepeat := .T. // you have "keys" repeated
cJson := '{"states":' + cJson + "}"
oRoot := TXmlToHash():New( , , , lRepeat )
? oRoot:JsonToXml( , cJson, "myxml0.xml" )
//oRoot:End() // Not use :End(), not neccesary
Return nil
Code: Select all
Function Main()
local cJson
local hHash
local lRepeat := .T. // you have "keys" repeated
cJson := '{"states":' + cJson + "}"
hb_JsonDecode( cJson, @hHash )
oRoot := TXmlToHash():New( , , , lRepeat )
? oRoot:HashToXml( hHash, "myxml1.xml" )
//oRoot:End() // Not use :End(), not neccesary
Return nil
Code: Select all
METHOD End() CLASS TXmlToHash
if !Empty( ::oRoot )
MxmlDelete( ::oRoot )
endif
Return nil
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Hello Navarro
I try XMLtoHash with some xml files does not work
this happens when the data is in the tag
<MealPlan MealPlanCode="MPT.3">
Regards Maurizio
I try XMLtoHash with some xml files does not work
this happens when the data is in the tag
<MealPlan MealPlanCode="MPT.3">
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<OTA_HotelRatePlanRS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opentravel.org/OTA/2003/05" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelRatePlanRS.xsd" TimeStamp="2019-09-23T15:38:16" Target="Production" Version="1.005">
<RatePlans>
<MealPlans>
<MealPlan MealPlanCode="MPT.3">
<Description>
<Text><![CDATA[Bed & Breakfast]]></Text>
</Description>
</MealPlan>
<MealPlan MealPlanCode="MPT.12">
<Description>
<Text><![CDATA[Half Board]]></Text>
</Description>
</MealPlan>
</MealPlans>
<RatePlan CurrencyCode="EUR" RatePlanCode="14500">
<Rates>
<Rate MinGuestApplicable="2" MaxGuestApplicable="2" InvTypeCode="54480" IsRoom="true" />
<Rate MinGuestApplicable="2" MaxGuestApplicable="2" InvTypeCode="54481" IsRoom="true" />
<Rate MinGuestApplicable="3" MaxGuestApplicable="3" InvTypeCode="54482" IsRoom="true" />
<Rate MinGuestApplicable="3" MaxGuestApplicable="3" InvTypeCode="54483" IsRoom="true" />
<Rate MinGuestApplicable="4" MaxGuestApplicable="4" InvTypeCode="54484" IsRoom="true" />
</Rates>
<Description>
<Text><![CDATA[Web Rate]]></Text>
</Description>
</RatePlan>
<RatePlan CurrencyCode="EUR" RatePlanCode="14501">
<Rates>
<Rate MinGuestApplicable="2" MaxGuestApplicable="2" InvTypeCode="54480" IsRoom="true" />
<Rate MinGuestApplicable="2" MaxGuestApplicable="2" InvTypeCode="54481" IsRoom="true" />
<Rate MinGuestApplicable="3" MaxGuestApplicable="3" InvTypeCode="54482" IsRoom="true" />
<Rate MinGuestApplicable="3" MaxGuestApplicable="3" InvTypeCode="54483" IsRoom="true" />
<Rate MinGuestApplicable="4" MaxGuestApplicable="4" InvTypeCode="54484" IsRoom="true" />
</Rates>
<Description>
<Text><![CDATA[Not Refundable]]></Text>
</Description>
</RatePlan>
</RatePlans>
</OTA_HotelRatePlanRS>
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Dear Maurizio, what do you want to do with this xml?
Please enter your code
Please enter your code
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Navarro ,
I have already manually encoded the XML file.
This is a test of your XMLtoHash function to see if the generated hash matches with the XML file.
In the generated HASH there are no tags like
<MealPlan MealPlanCode = "MPT.3">
Maurizio
I have already manually encoded the XML file.
This is a test of your XMLtoHash function to see if the generated hash matches with the XML file.
In the generated HASH there are no tags like
<MealPlan MealPlanCode = "MPT.3">
Maurizio
Re: How to generate Master/Deltail XML from maridb Rowsets ?
Maurizio, I found this:Maurizio wrote:Navarro ,
I have already manually encoded the XML file.
This is a test of your XMLtoHash function to see if the generated hash matches with the XML file.
In the generated HASH there are no tags like
<MealPlan MealPlanCode = "MPT.3">
Maurizio
Code: Select all
::oRoot := MxmlLoadString( NIL, cXml, @uType_Callback() )
if you delete "&" char, it run<![CDATA[Bed & Breakfast]]>
I look this, but is a problem of function of library
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.