[EMAIL PROTECTED] writes:
I forgot, the line the exception is on is:

doc.appendChild( frag ); // add the fragment to my existing Document

Thanks,
Jeff

> I have an existing document to which I am trying to add a
> DocumentFragment to.  It's failing with the following:
>
> ,----
> | org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to 
> insert a
> |  node where it is not permitted.
> |         at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown 
> Source)
> |         at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown 
> Source)
> | 
> |         at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
> |         at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown 
> Source)
> |         at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
> `----
>
> Here's the snippet:
>
> ,----
> | public void actionPerformed( ActionEvent e )
> | {
> |     DocumentFragment frag = new DocumentFragmentImpl((CoreDocumentImpl)doc 
> );
> |     //create fragment based on existing Document
> | 
> |     Element element = doc.createElement( "element" );       // create a new 
> Element
> |     item = doc.createElement( "component" );               // create another
> |     item.appendChild( doc.createTextNode( "NUM_SHORT" ));  // give it a 
> TextNode
> |     element.appendChild( item );                           // add item to 
> element
> | 
> |     frag.appendChild( element );  // add element to our fragment
> |     doc.appendChild( frag );      // add the fragment to my existing 
> Document
> | }
> `----
>
> Can anyone see where I'm going wrong?
> -- 
> Thanks,
> Jeff
> ,----
> | Jeffery B. Rancier
> | 
> | Softechnics
> | a METTLER TOLEDO company
> `----
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Thanks,
Jeff
,----
| Jeffery B. Rancier
| 
| Softechnics
| a METTLER TOLEDO company
`----


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to