You will need to import the node from one document to the other.  Use
"importNode" from the document interface.

- Eric

On 9/6/05, Johannes Echterhoff <[EMAIL PROTECTED]> wrote:
> Hi.
> Cloning the node to insert did not work out. Still the same message. The
> program now looks like:
> 
> public class XMLBeansANYTest {
> 
>    public static void main(String[] args) {
> 
>        AMTargetConfigurationDocument atcd = null;
>        try {
>            atcd = AMTargetConfigurationDocument.Factory.newInstance();
>            AMTargetConfiguration atc = atcd.addNewAMTargetConfiguration();
>            Node configNode = atc.getDomNode();
> 
>            AXISConnectorConfigDocument accd =
> AXISConnectorConfigDocument.Factory.newInstance();
>            AXISConnectorConfigType acct = accd.addNewAXISConnectorConfig();
> 
>            Node clonedNode = acct.getDomNode().cloneNode(true);
> 
>            configNode.insertBefore(clonedNode,null);
> 
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        System.out.println(atcd.toString());
>    }
> }
> 
> Any other suggestions?
> 
> Regards,
>    Johannes Echterhoff
> 
> 
> Don Stewart wrote:
> 
> >Johannes,
> >
> >Not 100% sure but your adding an element from one doc to another and so
> >you (maybe) need to use clone() on the DOM node and add the cloned node
> >to your other document.
> >
> >Regards
> >
> >Don
> >
> >-----Original Message-----
> >From: Johannes Echterhoff [mailto:[EMAIL PROTECTED]
> >Sent: 06 September 2005 12:45
> >To: [email protected]
> >Subject: Child to add is from another document
> >
> >Hi.
> >I just tried to put the contents of one document into the any-element of
> >another document. I got following error:
> >
> >org.apache.xmlbeans.impl.store.DomImpl$WrongDocumentErr: Child to add is
> >from another document
> >    at
> >org.apache.xmlbeans.impl.store.DomImpl._node_insertBefore(DomImpl.java:1
> >756)
> >    at
> >org.apache.xmlbeans.impl.store.Xobj$NodeXobj.insertBefore(Xobj.java:2459
> >)
> >    at test.XMLBeansANYTest.main(XMLBeansANYTest.java:56)
> >
> >
> >The programs main-code looks like this:
> >
> >        AMTargetConfigurationDocument atcd = null;
> >        try {
> >            atcd = AMTargetConfigurationDocument.Factory.newInstance();
> >            AMTargetConfiguration atc =
> >atcd.addNewAMTargetConfiguration();
> >            Node configNode = atc.getDomNode();
> >
> >            AXISConnectorConfigDocument accd =
> >AXISConnectorConfigDocument.Factory.newInstance();
> >            AXISConnectorConfigType acct =
> >accd.addNewAXISConnectorConfig();
> >
> >            configNode.insertBefore(acct.getDomNode(),null);
> >
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >        }
> >        System.out.println(atcd.toString());
> >
> >
> >
> >The schema for AMTargetConfiguration looks like this:
> >
> ><xs:element name="AMTargetConfiguration">
> >        <xs:complexType>
> >            <xs:sequence>
> >                <xs:any processContents="skip"/>
> >            </xs:sequence>
> >        </xs:complexType>
> >    </xs:element>
> >
> >
> >I had a look at docs/guide/conHandlingAny.html but still do not get the
> >clue. Can someone please tell me what this error means and how to solve
> >it?
> >
> >Regards,
> >    Johannes Echterhoff
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >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