new to xml schemas

Discussion in 'ASP .Net' started by tshad, Dec 31, 2007.

  1. tshad

    tshad Guest

    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
    tshad, Dec 31, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Soeren
    Replies:
    2
    Views:
    347
    Waxolunist
    Sep 22, 2004
  2. Replies:
    3
    Views:
    782
  3. Replies:
    1
    Views:
    573
    Roedy Green
    Aug 30, 2005
  4. Tony Prichard
    Replies:
    0
    Views:
    718
    Tony Prichard
    Dec 12, 2003
  5. Andy B
    Replies:
    0
    Views:
    370
    Andy B
    Aug 7, 2008
Loading...

Share This Page