Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to convert this to cursors
Message
From
14/06/2018 18:11:18
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
 
To
14/06/2018 17:08:43
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01660726
Message ID:
01660738
Views:
86
Thank you,

Your's excellent too like Antonio.

>Using nfXml ( https://github.com/vfpx/nfxml ) and a little knowing of what vfp expects its easy.
>
>Update: consider that maybe you don't need to use xmltocursor at all, since nfXmlRead gives you access to
>all your object's properties; once you parse the source xml just by doing " o = nfXmlRead(m.xml) "
>
>
>
>
>xml = getxml()
>
>xmltocursor(m.xml,'products') && will give products as is
>browse
>
>*for the good part: ( attributes to cursor: )  , we need an  object that xmltocursor can use: ( an object with rows array  ):
>
>ox = createobject('empty') 
>
>addproperty(ox,'myTable',createobject('empty'))
>addproperty(ox.myTable,'tableRows(1)')
>
>* copy attributes object in rows array and create xml from our new object:
>
>oxml = nfXmlRead(m.xml) &&  parse xml to object:
>
>ox.myTable.tableRows(1) = oxml.order._attr_
>
>xml = strconv( nfXmlCreate( ox ) ,11 )
>
>
>xmltocursor(m.xml,'order')
>
>edit
>
>* show xml:
>strtofile(m.xml,'myTable.xml')
>modify file myTable.xml nowait
>
>*----------------------------
>function getxml
>*----------------------------
>text to xml noshow pretext 2+4+8
>
><order Id="458362379" 
>MessageId="1701653104" 
>RestaurantName="Serez Dondurmacisi, Kartal (Kordonboyu Mah.)" 
>RestaurantCatalog="postakip" 
>RestaurantCategory="8cb94060-7642-44e4-b18c-720a44349424" 
>CustomerName="metin emre" 
>CustomerId="5039891" 
>CustomerType="3"
>PaymentNote="Nakit (nakit ödeme) - Lütfen fis getiriniz." 
>OrderTotal="14.00" 
>CustomerPhone="3213213212" 
>CustomerPhone2="" 
>PromoCode="" 
>City="postakip" 
>Region="deneme semti" 
>Organization="" 
>Address="zcxvcxzvcxzvcxzvxc" 
>AddressDescription="fgdsgfdsgfdsg" 
>AddressId="8670d8154e1084e85a590a7e3b7bd6c0" 
>PaymentMethodId="1" 
>DeliveryTime="2018.06.14 12:55" 
>ChangeInTotal="0.00" 
>Currency="YSM" OrderNote="">
>
><product id="3a8647be80e005fad8396ecb3d91a033" 
>Name="Keçi Sütlü Maras Dondurmasi (Top)" 
>Price="6.00" 
>ListPrice="6.00" 
>Quantity="1" 
>Options="" 
>OptionIds="" 
>OrderIndex="1" 
>ParentIndex="0" 
>PromoParentIndex="0" 
>ProductOptionId="" />
>
><product id="d25c6827d792020856e60ceb6aa6e66d" 
>Name="Bodrum Mandalinali Dondurma (Top)" 
>Price="4.00" 
>ListPrice="4.00" 
>Quantity="1" 
>Options="" 
>OptionIds="" 
>OrderIndex="2" 
>ParentIndex="0" 
>PromoParentIndex="0" 
>ProductOptionId="" />
><product id="0c23a1fa5b8ee1f73a95dbdf6546e3c0" 
>Name="Karadutlu Dondurma (Top)" 
>Price="4.00" 
>ListPrice="4.00" 
>Quantity="1" 
>Options="" 
>OptionIds="" 
>OrderIndex="3" 
>ParentIndex="0" 
>PromoParentIndex="0" 
>ProductOptionId="" />
>
></order>
>
>endtext
>
>return m.xml
>
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform