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.)
LOCAL loTable as XMLTable
FOR EACH loTable IN .Tables
IF loTable.Fields.Count > 0
loTable.ToCursor()
BROWSE
ENDIF
ENDFOR
ENDIF
ENDWITH
loAdapter = NULL
-Rick
Rick Borup, MCSD
recursion (rE-kur'-shun) n.
see recursion.