Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLAdapter Problems
Message
From
10/10/2007 19:15:29
 
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01259571
Message ID:
01260179
Views:
18
Since there's been no reply, and for the benefit of anybody else reading this thread, I'll close this out by saying it appears the VFP XMLAdapter simply can't handle this particular schema but doesn't give any indication why not. I solved the problem by abandoning the XMLAdapter and writing code to parse the XML using the XMLDOM. While somewhat tedious and not particularly elegant, this is at least a working solution.

-Rick


>I'm trying to use XMLAdapter to load XML data from a file and then write the data to cursors using the ToCursor() method on the XMLTable objects. The problem is the cursors get created with the expected structure but do not contain any data.
>
>The XML file is not terribly complex, although it does contain nested data (OrderHeader, OrderDetail, etc.). The schema is in an external XSD file. The LoadXML() method in my code returns True, with lValidateOnParse set True.
>
>The XML file is from an external source over which I have no control, and I don't know what tool used was used to create it. Since LoadXML() is returning True, I'm not sure what else to look for. How do I go about debugging this further?
>
>Code is as follows (VFP 9.0 SP1):
>
LOCAL loAdapter AS XMLAdapter
>loAdapter = CREATEOBJECT( "XMLAdapter")
>WITH loAdapter AS XMLAdapter
>   .RespectNesting = .T.
>   .XMLSchemaLocation = "PurchaseOrder.xsd"
>   IF .LoadXML( "PurchaseOrder.xml", .T.)  && Returns .T.
>      LOCAL loTable as XMLTable
>      FOR EACH loTable IN .Tables
>         IF loTable.Fields.Count > 0
>            loTable.ToCursor()  && Cursor is created. but with no data.
>            BROWSE
>         ENDIF
>      ENDFOR
>   ENDIF
>ENDWITH
>loAdapter = NULL
>
>-Rick
Rick Borup, MCSD

recursion (rE-kur'-shun) n.
  see recursion.
Previous
Reply
Map
View

Click here to load this message in the networking platform