Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question on processing XML file
Message
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00854652
Message ID:
00854672
Views:
33
This message has been marked as a message which has helped to the initial question of the thread.
Hi Dmitry,

You can do that with pure VFP code or you can use XMLTOCURSOR().
XMLTOCURSOR(lcXml, "crsXml")
* Or
lcStr = STREXTRACT(lcXml, "<service>", "</service>")
lnTotItems = OCCURS("<add", lcStr)
FOR lnItem = 1 TO lnTotItems
	lcKey = EVALUATE(ALLTRIM(STREXTRACT(lcStr, "<add key=", "value=", lnItem)))
	lcVal = EVALUATE(ALLTRIM(STREXTRACT(lcStr, "value=", "/>", lnItem)))
	? lnItem, lcKey, lcVal
ENDFOR
>How would I process the following XML file?:
>
>
><?xml version="1.0"?>
><service>
>   <add key="key1" value="value1" />
>   <add key="key2" value="value2" />
></service>
>
>
>I want to extract values corresponding to different keys in the file.
>
>TIA for any suggestions.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform