You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "David M. Hirst" <dh...@ccs.neu.edu> on 2002/04/14 06:24:26 UTC

Please Help

Hi There,
	I've been working with the latest Xerces parser to create HTML and
XML documents. I'm running into some problem using it for HTML. Say for
example I would like to create a <title> element I'm getting the following
error
Exception in thread "main" org.w3c.dom.DOMException: DOM006 Hierarchy
request error at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.
java:382) at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:230)

This happens when I try using the HTMLDocumentImpl.setTitle method, or if
I create a HTMLHeadElementImpl and then append that to the document. Has
anyone run into this problem? Have any suggestions. I am really running
into a dead end here and would appreciate any pointers.

Thanks a million
Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Please Help

Posted by Henry Roeland <he...@hccnet.nl>.
David,

When you are appending or inserting something to a document that is not
created on that document it self (by createElement or createTextNode) you
have to use 'importNode' tot import the new element to your document. The
imported node that this method returns should be appended to the document.

You can get the document of each node by using the <node>.getOwnerDocument()
method.

suc6,

Henry
----- Original Message -----
From: "David M. Hirst" <dh...@ccs.neu.edu>
To: <xe...@xml.apache.org>
Sent: Sunday, April 14, 2002 6:24 AM
Subject: Please Help


> Hi There,
> I've been working with the latest Xerces parser to create HTML and
> XML documents. I'm running into some problem using it for HTML. Say for
> example I would like to create a <title> element I'm getting the following
> error
> Exception in thread "main" org.w3c.dom.DOMException: DOM006 Hierarchy
> request error at
org.apache.xerces.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.
> java:382) at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:230)
>
> This happens when I try using the HTMLDocumentImpl.setTitle method, or if
> I create a HTMLHeadElementImpl and then append that to the document. Has
> anyone run into this problem? Have any suggestions. I am really running
> into a dead end here and would appreciate any pointers.
>
> Thanks a million
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org