Hi:

I have a sample WSDL document. This document has the schema embedded within
it (in node types). I need to create a Document whose contents are the
schema.
I try to use xpath expression to extract the node and then create an empty
document object. To the empty document object I add the node that I found
via xpath. On this method call, I get an error saying....

org.w3c.dom.DOMException: DOM005 Wrong document
        at
org.apache.xerces.dom.ParentNode.internalInsertBefore(ParentNode.java
:394)
        at
org.apache.xerces.dom.ParentNode.insertBefore(ParentNode.java:326)
        at
org.apache.xerces.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.
java:386)
        at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:224)



This is my sample document....

  <?xml version="1.0" encoding="utf-8" ?> 
 <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:s="http://www.w3.org/2001/XMLSchema";
xmlns:s0="http://sjmillerconsultants.com/webservices";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/";
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
targetNamespace="http://sjmillerconsultants.com/webservices";
xmlns="http://schemas.xmlsoap.org/wsdl/";>
 <types>
  <s:schema elementFormDefault="qualified"
targetNamespace="http://yyy.com/webservices";>
  <s:element name="Send">
  <s:complexType>
  <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="sXML" type="s:string" /> 
  </s:sequence>
  </s:complexType>
  </s:element>
 </types>
</definitions>

This is my sample program.

            Document document1 = parser.parse(uri);
            NodeList nl = XPathAPI.selectNodeList(document1,
"/definitions/types", document1);
            Node selNode = nl.item(0);

            DocumentBuilderFactory tmpFactory = null;
            DocumentBuilder tmpBuilder = null;
            tmpFactory = DocumentBuilderFactory.newInstance();
            tmpBuilder = tmpFactory.newDocumentBuilder();

            Document tmpinstanceDoc = tmpBuilder.newDocument(); // create a
new instance
 
            tmpinstanceDoc.appendChild(selNode); //============>>>>> Error
occurs on this one....



Any help will be appreciated.
Thanks.

Vikas

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

Reply via email to