CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: XML Schema

  1. #1
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    173

    XML Schema

    I have an xml file that I want to do a one-many type relationship in. Is this possible using schemas? I have a simplified version of the problem below. An animal has either 0 or 4 legs. If it has four legs then it will have a <LegMap> that always has the same four leg elements. I tried playing around with <xsd:all> but wasn't quite able to get it to work. Is what I want to do possible?


    <Animal>Horse
    <LegMap>
    <Leg>Front Left</Leg>
    <Leg>Front Right</Leg>
    <Leg>Rear Left</Leg>
    <Leg>Rear Right</Leg>
    </LegMap>
    </Animal>
    <Animal>Cow
    <LegMap>
    <Leg>Front Left</Leg>
    <Leg>Front Right</Leg>
    <Leg>Rear Left</Leg>
    <Leg>Rear Right</Leg>
    </LegMap>
    </Animal>
    <Animal>Snail
    </Animal>


    Preston Park
    CTT+, MCT, MCSD
    http://www.prestonpark.com/

  2. #2
    Join Date
    Apr 1999
    Posts
    38

    Re: XML Schema

    Hi,

    try using th following in the schema for the leg

    element name="leg" minOccurs=0 maxOccurs="unbounded"

    I have eleminated the angular brackets.

    make sure this element comes under element legMap

    -Chidu




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured