Nested Data XML design

Posted by esryl on Stack Overflow See other posts from Stack Overflow or by esryl
Published on 2010-04-12T15:57:36Z Indexed on 2010/04/12 16:22 UTC
Read the original article Hit count: 234

Filed under:
|
|

Looking to nest (to unlimited levels) elements in XML. Like so:

<items>
    <item>
        <name>Item One</name>
        <item>
            <name>Item Two</name>
        </item>
        <item>
            <name>Item Three</name>
            <item>
                <name>Item Four</name>
            </item> <!-- etc... -->
        </item>
    </item>
</items>

However. While browsing for a solution I noticed in the comments of: http://stackoverflow.com/questions/988139/weird-nesting-in-xml while the above is well formed it would not validate against any sinsible DTD.

Two things, what is a better way of nesting similar elements, and secondly what would be the design of the DTD.

UPDATE: Would prefer to validate against an XML Schema rather than DTD.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about schema