Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Method to Process XML
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01136959
Message ID:
01136971
Views:
13
If you're using the DOM, then Intellisense is your friend. I had to process an XML file this way, and used mainly two functions: SelectSingleNode and SelectNodes.
Here are some lines that will give you an idea...
loXml = CreateObject("Microsoft.XMLDOM")
loXml.Load ( YourXMLString )
loRoot = loXML.documentElement
IF ISNULL( loRoot )
   RETURN 'Invalid XML'
ENDIF
loElement = loRoot.selectSingleNode( "CustomerName" )
lCustomerName = iif(!ISNULL(loElement),allt(loElement.Text),"" )

lOrderNumbers = loRoot.selectNodes ("Orders/OrderNumber")
for each loElement in lOrderNumbers
   ? loElement.Text
endfor

** you can also try loRoot.selectNodes ( "Orders/Blabla/Blablabla" )
I hope you get the drill :-)
Jaime

>I've been beating my head looking for the best way to process XML files in VFP 9.0.
>
>XMLADAPTER does not work because it uses MSXML 4.0. The XML files I am getting only work with MSXML 6.0.
>
>So I was looking at using XPath to navigate through the XML. But now I'm looking at just using the DOM to do so.
>
>I am new to doing this so any help on the best direction to take and learning resources to use would be well appreciated.
>
>The XML files that will be processed are fairly complex and have many nodes. They represent purchase orders and sales orders.
>
>Thanks!
Why do programs stop working correctly as soon as you leave the Fox?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform