[Top][All Lists]

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

Re: XML strictness

From: Chris Burdess
Subject: Re: XML strictness
Date: Tue, 31 May 2005 07:22:27 +0100
User-agent: Mutt/1.3.28i

Robert Schuster wrote:
> When run as 'echo "<a/>" | jamvm -cp . xmlfilter.XMLFilter' you get the
> following exception:
> gnu.xml.dom.DomDOMException: The node doesn't belong here.
> More Information: document element already present:
> gnu.xml.dom.DomElement[a]
> Node Name: new
>    at gnu.xml.dom.DomDocument.checkNewChild (
>    at gnu.xml.dom.DomDocument.appendChild (
>    at xmlfilter.XMLFilter.main (
> You get the same message with all proprietary JDKs prior to 1.5 . The
> latest incarnation however accepts creating the <new> node and generates
> the following XML upon calling 'echo "<a/>" |
> /opt/sun-jdk-1.5.0/bin/java xmlfilter.XMLFilter':
> <?xml version="1.0" encoding="iso-8859-1"?>
> <a/>
> <new/>
> AFAIK there should/must be only one top-level node which is named <xml>.
> I am confused ...
> Is Sun breaking the rules here?

According to

  HIERARCHY_REQUEST_ERR: Raised ... if this node is of type Document and
  the DOM application attempts to append a second DocumentType or Element

If you want to add arbitrary node types, use a DocumentFragment.
Chris Burdess

reply via email to

[Prev in Thread] Current Thread [Next in Thread]