[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l..., Jack Sparrow <virtualspy3@g...>
  • Subject: RE: recursive nesting
  • From: Jack Lindsey <Jack@L...>
  • Date: Tue, 06 Dec 2005 23:41:12 -0500
  • User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Aye, tis valid, Cap'n.
But since you say "recursive", I presume there is only one kind of 
<item>, no matter how deeply nested they are.  If that is correct, then 
your <item> element can have "mixed content", i.e. it can have its own 
content, e.g. How are you, and it can have subelements, i.e. more 
instances of <item>.  Therefore if you validate your xml against a W3C 
XML Schema, it would be equally valid to say:

<item>How are you
          <item>I am fine
                    <item>what is
                              <item>what is your profession?</item>
                              your name?
                    </item>
          </item>
          What the?
</item>
This might be OK in document-oriented XML, if your items were 
subparagraphs or bullet items, etc.  But in data-oriented XML, like a 
form or database record update, some shops strictly forbid this because 
it is oviously not going to be valid for field-by-field structured data. 

But others think of it as more of a guideline ;-)

Cheers
            Jack Lindsey

Jack Sparrow wrote:
 
Hi all,

I would like to know if its valid to do recursive nesting( like the 
pattern shown below) in XML.


<item>
   <item>How are you</item
   <item>I am fine</item>
<item>
<item>
    <item>
         <item>what is your name?</item>
         <item>what is your profession?</item>
    </item>
</item>

Please let me know.

Thanks,
Jack


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member