I am currently using XercesC to extract and recompose the grammars embedded 
within an WSDL document.

At the DocumentElement level of the WSDL document (the wsdl:definitions 
element) there are (as is normal) all the namespace declarations used for the 
document. So, for instance,

xmlns:s3="http://foobar.com/mySOAP/commons";

As you probably know, typically, a sequence of schemas are defined under the 
"wsdl:types" element.
I am extracting these, so that I can subsequently load them as grammars and 
then validate / process the instance documents that they define.

For instance:

[...]
<s:schema elementFormDefault="qualified" 
targetNamespace="http://foobar.com/mySOAP/Responder";>
      <s:import namespace="http://foobar.com/mySOAP/commons"/>
      <s:complexType abstract="true" name="Responder">
        <s:complexContent mixed="false">
          <s:extension base="s3:ErrorInfo">
            <s:sequence>
              <s:element maxOccurs="1" minOccurs="1" name="responsetime" 
type="s:double"/>
            </s:sequence>
          </s:extension>
        </s:complexContent>
      </s:complexType>
</s:schema>
[...]

So - during the process of extracting the schemas from the WSDL document, I am 
using importNode() as follows:

DOMElement* schema_node;        //points to the schema element in the WSDL  
document..
DOMDocument* schema_doc =  impl->createDocument();
DOMNode* imported_node = schema_doc->importNode(schema_node,true);
schema_doc->appendChild(imported_node);

The schema_document is then installed as a grammar using DOMLSParser* 
parser->loadGrammar().

The PROBLEM is that the "s3:ErrorInfo" value loses the scope of the namespace 
prefix found in the original WSDL document.

What is the solution to this?  Should I itererate through the full list of 
xmlns:* attributes of the WSDL and insert them into the root element of the new 
schema_doc?  Or am I missing something?


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to