> 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?
This is what I have done so far - which is indeed iterate through all document
element attributes, looking for a match with xmlns:
Is there a more efficient way of doing this? Am I missing something?
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);
[...]
const DOMDocument* schema_node_doc = schema_node->getOwnerDocument();
if ( schema_node_doc != NULL) {
const DOMElement* wsdl_de = schema_node_doc->getDocumentElement();
if (wsdl_de != NULL) {
const DOMNamedNodeMap* wsdl_de_attr= wsdl_de->getAttributes();
DOMElement* schema_de = schema_doc->getDocumentElement();
if (schema_de != NULL && wsdl_de_attr != NULL ) {
size_t n = wsdl_de_attr->getLength();
for(size_t i=0; i<n; i++) {
DOMAttr* ai = (DOMAttr*)(wsdl_de_attr->item(i));
const u_str ain(ai->getName()); //u_str
= std::basic_string<XMLCh>
if (ain.compare(0,6,X("xmlns:")) == 0) {
DOMAttr* iattr =
(DOMAttr*)(schema_doc->importNode(ai,true));
DOMAttr* oattr =
schema_de->setAttributeNode(iattr);
if ( oattr!= NULL ) { delete oattr; }
//This attribute was already there.
}
}
}
}
}
smime.p7s
Description: S/MIME cryptographic signature
