Re: [xml] Is a document a node? Is there a "virtual root node"?



Hi,

Von: Theodore H.Smith <delete elfdata com>
Datum: Wed, 28 Dec 2005 21:53:24 +0000


On 28 Dec 2005, at 21:18, Daniel Veillard wrote:

On Wed, Dec 28, 2005 at 12:01:53PM +0000, Theodore H.Smith wrote:
<?xml version="1.0"?>
<!-- hi -->
<root>another little bit of data</root>


Now, this leads me to wonder, whats the best way to copy these
comments. If the document is also a node, or there is some node that

  the document is a node with 2 child in that case, the comment and
the root node.

Thanks. What happens to the <?xml?> PI, though?

A PI can exist anywhere in an XML document, not just at the start,  
and a PI can contain most character sequences. So, I assume that all  
nodes must be able to contain PI nodes (just like they can contain  
normal element nodes.).

If all nodes can contain PI nodes, then why does the document node  
not contain the PI node just like normal?

A "<?xml version="1.0"?>" at the beginning of a document is not considered
to be a PI in XML; although it looks like a PI, it's an "XML declaration".

Have a look at a related thread:
http://lists.xml.org/archives/xml-dev/199911/msg00430.html

Regards,

Kasimier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]