Try using importNode and this should solve your problem.

Cheers,
Rahul.


> From: Menarek John-NJM010 <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: Creating a string from a portion of XML DOM tree
> Date: Wed, 12 Sep 2001 16:28:55 -0500
> 
> I think you are right but I am having problems initializing one. I have tried:
> 
> DocumentFragmentImpl test1 = new DocumentFragmentImpl(new DocumentImpl());
> Node test2 = elt.cloneNode( true ); //The part of the tree I want to make 
> into 
a string
> test1.appendChild( test2 );
> 
> and I get:
> 
> org.w3c.dom.DOMException: DOM005 Wrong document
>       at 
org.apache.xerces.dom.ParentNode.internalInsertBefore(ParentNode.java:389)
>       at org.apache.xerces.dom.ParentNode.insertBefore(ParentNode.java:321)
>       at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:216)
>       at 
com.mot.icsd.voxml.core.VoiceXMLGrammars.genSetGrammar(VoiceXMLGrammars.java:789
)
>       at 
com.mot.icsd.voxml.core.VoiceXMLGrammars.genSetGrammarsForScope(VoiceXMLGrammars
.java:377)
>       at 
com.mot.icsd.voxml.core.VoiceXMLCompiler.compile(VoiceXMLCompiler.java:167)
>       at 
com.mot.icsd.voxml.core.ExecutionContext.compileDialog(ExecutionContext.java:184
3)
>       at 
com.mot.icsd.voxml.core.ExecutionContext.compileDialogPair(ExecutionContext.java
:1619)
>       at 
com.mot.icsd.voxml.core.ExecutionContext.executeDialog(ExecutionContext.java:110
6)
>       at 
com.mot.icsd.voxml.core.ExecutionContext.run(ExecutionContext.java:453)
>       at com.mot.icsd.voxml.core.Browser.browseTo(Browser.java:91)
>       at com.mot.icsd.voxml.framework.NodeRunner.run(NodeRunner.java:122)
>       at java.lang.Thread.run(Unknown Source)
> 
> when appendChild is called
> 
> If I understand the problem correctly the DOM is acting like I am trying to 
share the nodes between
> two DOMS. I read where you should use the invoke method on a Document object 
but that doesn't have
> a toString method
> 
> Any suggestions?
> 
> 
> 
> -----Original Message-----
> From: Howard Roberts [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 12, 2001 11:24 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Creating a string from a portion of XML DOM tree
> 
> 
> I think a DocumentFragment object is what you need:
> 
> org.w3c.dom.DocumentFragment
> org.apache.xerces.dom.DocumentFragmentImpl
> 
> 
> 
> -----Original Message-----
> From: Menarek John-NJM010 [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 12, 2001 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: Creating a string from a portion of XML DOM tree
> 
> 
> Hi
> 
> I need to pass on a portion of DOM parse tree in it's original text form to
> another program
> 
> In Microsoft's extension to the DOM; IXMLDOMNode has a property called xml
> which is used to convert the current node and its subtree into an XML
> document.
> 
> So far I have not found a way to do this in Xerces
> 
> Thanks John
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to