T
tshad
I am trying to read an xml document into a dataSet and am unsure how to set
it up.
If I have a document such as:
<?xml version="1.0"?>
<address country="Italy">
<tag name="street" flag="5">One Microsoft Way</tag>
<tag name="number">1</tag>
<tag name="city">Redmond</tag>
<tag name="state" unit="25">WA</tag>
<tag name="zip">98052</tag>
</address>
I want there to be one table: Address and each record would be the "tag"
lines. The line would have a name (such as "street" or "city") a value
(such as ""One Microsoft Way") and a possible attribute or 2 (such as flag).
I would want the table to be something like:
street 5 One Microsoft Way
number 1
city Redmond
state 25 WA
zip 98052
There is more to this but this would be the first cut.
I tried:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="address" type="AddressType" />
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="tag" minOccurs="0" maxOccurs="unbounded"
type="xs:string" />
</xs:sequence>
<xs:attribute name="country" type="xs:string" />
</xs:complexType>
</xs:schema>
I didn't expect this to work and it didn't. What I got was:
Italy 0
How would I change this to make this work?
Thanks,
Tom
it up.
If I have a document such as:
<?xml version="1.0"?>
<address country="Italy">
<tag name="street" flag="5">One Microsoft Way</tag>
<tag name="number">1</tag>
<tag name="city">Redmond</tag>
<tag name="state" unit="25">WA</tag>
<tag name="zip">98052</tag>
</address>
I want there to be one table: Address and each record would be the "tag"
lines. The line would have a name (such as "street" or "city") a value
(such as ""One Microsoft Way") and a possible attribute or 2 (such as flag).
I would want the table to be something like:
street 5 One Microsoft Way
number 1
city Redmond
state 25 WA
zip 98052
There is more to this but this would be the first cut.
I tried:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="address" type="AddressType" />
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="tag" minOccurs="0" maxOccurs="unbounded"
type="xs:string" />
</xs:sequence>
<xs:attribute name="country" type="xs:string" />
</xs:complexType>
</xs:schema>
I didn't expect this to work and it didn't. What I got was:
Italy 0
How would I change this to make this work?
Thanks,
Tom