Hello all!
I have the following XSD (library.xsd):
And the following xml (books.xml):
And the following VFP9 code:
Now, from all that, the program reports that I have 2 tables. Table 1 is character and table 2 is book. From the browse, the character table gets propagated with data that I can see. The browse for book, table 2, shows up with the proper fields, but no data. I've also done this test on other xsd files and xml, and if I only have one table defined in the xml, the data never reaches the table.
What am I missing?
I have the following XSD (library.xsd):
Code:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema">[/URL]
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="character" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="friend-of" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="since" type="xs:date"/>
<xs:element name="qualification" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
And the following xml (books.xml):
Code:
<?xml version="1.0" encoding="utf-8" ?>
<book isbn="0836217462" xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xsi:noNamespaceSchemaLocation="library.xsd">
<title>Being a Dog Is a Full-Time Job</title>
<author>Charles M. Schulz</author>
<character>
<name>Snoopy</name>
<friend-of>Peppermint Patty</friend-of>
<since>1950-10-04</since>
<qualification>extroverted beagle</qualification>
</character>
<character>
<name>Peppermint Patty</name>
<since>1966-08-22</since>
<qualification>bold, brash and tomboyish</qualification>
</character>
</book>
And the following VFP9 code:
Code:
LOCAL loAdapter as XMLAdapter
loXMLAdapter = CREATEOBJECT("XMLAdapter")
jcFile = "BOOKS.XML"
jcXSDFile = "LIBRARY.XSD"
loXMLAdapter.XMLSchemaLocation = jcXSDFile
*loXMLAdapter.RespectNesting = .T.
IF loXMLAdapter.LoadXML(M.jcFile, .T., .T.)
? "The Number of Tables Read is " + TRANSFORM(loXMLAdapter.Tables.Count)
IF loXMLAdapter.Tables.Count > 0
FOR jnIndx = 1 TO loXMLAdapter.Tables.Count
? "Table " + LTRIM(STR(M.jnIndx)) + ": " + loXMLAdapter.Tables[M.jnIndx].Alias
loXMLAdapter.Tables.Item[M.jnIndx].ToCursor()
BROWSE
ENDFOR
ENDIF
ENDIF
loXMLAdapter = .NULL.
RETURN
Now, from all that, the program reports that I have 2 tables. Table 1 is character and table 2 is book. From the browse, the character table gets propagated with data that I can see. The browse for book, table 2, shows up with the proper fields, but no data. I've also done this test on other xsd files and xml, and if I only have one table defined in the xml, the data never reaches the table.
What am I missing?