You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Eric SCHAEFFER <es...@posterconseil.com> on 2000/03/10 13:59:56 UTC
importing a org.w3c.dom.Document in another one
Hi,
I parse a file to create a DOM represention of its data (I don't use Xerces
because it's not an XML file).
But if I create a Document instance, I can't insert it in another Document
(I've got a wrong document error when I try to call the appendChild method).
How can I do this ?
Thank's
Eric.
_______________________________________
Eric SCHAEFFER
eschaeffer@posterconseil.com
POSTER CONSEIL
118 rue de Tocqueville
75017 PARIS
FRANCE
Tel. : 33-140541058
Fax : 33-140541059
_______________________________________
----------------------------------------------------------------------------
-----------------------------
Come to the first official Apache Software Foundation Conference!
-----------------------------------
http://ApacheCon.Com ------------------------------------
Re: importing a org.w3c.dom.Document in another one
Posted by Eric SCHAEFFER <es...@posterconseil.com>.
Thank's, works great !
PS:
You meant
myElement.appendChild(
org.apache.cocoon.processor.xsp.XSPUtil.cloneNode(
otherDocument.getDocumentElement(),
myElement.getOwnerDocument()
)
);
_______________________________________
Eric SCHAEFFER
eschaeffer@posterconseil.com
POSTER CONSEIL
118 rue de Tocqueville
75017 PARIS
FRANCE
Tel. : 33-140541058
Fax : 33-140541059
_______________________________________
----------------------------------------------------------------------------
-----------------------------
Come to the first official Apache Software Foundation Conference!
-----------------------------------
http://ApacheCon.Com ------------------------------------
----- Original Message -----
From: Ricardo Rocha <ri...@apache.org>
To: <co...@xml.apache.org>
Sent: Friday, March 10, 2000 9:46 PM
Subject: Re: importing a org.w3c.dom.Document in another one
> On Fri, 10 Mar 2000, Eric wrote:
> > I parse a file to create a DOM represention of its data (I don't use
Xerces
> > because it's not an XML file).
> > But if I create a Document instance, I can't insert it in another
Document
> > (I've got a wrong document error when I try to call the appendChild
method).
> > How can I do this ?
>
> Use
> org.apache.cocoon.processor.xsp.XSPUtil.cloneNode(
> Node node,
> Document Factory
> )
>
> This is a parser-independent utility that copies a node using
> a given document as "factory". Example:
>
> myElement.appendChild(
> otherDocument.getDocumentElement(),
> myElement.getOwnerDocument()
> );
>
Re: importing a org.w3c.dom.Document in another one
Posted by Ricardo Rocha <ri...@apache.org>.
On Fri, 10 Mar 2000, Eric wrote:
> I parse a file to create a DOM represention of its data (I don't use Xerces
> because it's not an XML file).
> But if I create a Document instance, I can't insert it in another Document
> (I've got a wrong document error when I try to call the appendChild method).
> How can I do this ?
Use
org.apache.cocoon.processor.xsp.XSPUtil.cloneNode(
Node node,
Document Factory
)
This is a parser-independent utility that copies a node using
a given document as "factory". Example:
myElement.appendChild(
otherDocument.getDocumentElement(),
myElement.getOwnerDocument()
);