VK wrote:
Quote:
Can be multiple instances of element used as the root element?
>
That's a curly way of asking, but I did not come up with a better
sentence, sorry. What I mean is with a document like:
>
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element>Content</element>
<root><element>Content</element></root>
<element>Content</element>
</root>
Why not just run a parser on it and see?
Quote:
so <rootelements is used not only as a root element but inside the
document as well.
Yes, provided the document is well-formed this is OK, if unusual.
Quote:
Is this a valid (in the wide sense) markup?
Only if you have a Schema or DTD to provide validation criteria, eg:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ELEMENT root (element|root)+>
<!ELEMENT element (#PCDATA)>
]>
<root>
<element>Content</element>
<root><element>Content</element></root>
<element>Content</element>
</root>
However, except in specialist circumstances it's probably not good
design. Element type names are usually chosen to reflect some kind
of meaning, and it's hard to understand why you would want an
element type used both for the root element and for a descendant.
The closest analogy I can think of immediately is in the TEI, where
the second-level element <textcan be reused within a paragraph
(for example) when you are quoting an embedded document, like in a
story where someone reads or quotes a letter:
<TEI.2>
<teiHeader>
...etc...
</teiHeader>
<text>
<body>
<p>This is what he sent me:<text>
<body>
<salute>Dear Peter,</salute>
<p>...</p>
</body>
</text></p>
</body>
</text>
</tei.2>
That's not the root element, but I can't offhand think of anything
else doing this on a regular basis.
///Peter
--
XML FAQ:
http://xml.silmaril.ie