Handling namespaces in queryDocument service

My understanding of the w3c namespace specifications is that a child XML element inherits its namespace from its parent, unless the child’s namespace is explicitely overridden. As such
-ford:car xmlns:myns=http://www.ford.com
–ford:engine

is equivalent to
-ford:car xmlns:myns=http://www.ford.com
–engine
(just an example)

I need to design queryDocument XQL queries that would extract the engine element, regardless of whether or not it was namespace-prefixed. I’ve tried several combinations of ‘nsDecls’ and XQL queries, but to no avail. Anybody have any insights?

Hi All,

I am having a problem related to namespace. What I do not understand is that

<soap-env:envelope>

<soap-env:envelope>

should be treated in the same way as

<envelope>

<envelope>

by the pub.schema:validate function, or for that matter any function.

It does not seem to be the case. Any help on usage of the namespace within webMethods would be most valuable.

-Rajesh Rao

Assuming the namespace of the soap-env prefix in
<soap-env:envelope>

</soap-env:envelope>

is the same as the default prefix in

<envelope>

</envelope>

They are logically the same as XML. If sending a node object to pub.schema:validate, both of these documents should pass validation.

If you are sending the node object to xmlNodeToDocument and sending the Document (ie. the IData instance) to pub.schema:validate, if you don’t set the parameter that defines specific namespace->prefix mapping, then the created Document will have different field names for the two XML documents - this would cause a failure of pub.schema:validate. Having field names change for different documents would also cause Flow Maps to fail.

See the nsDecls parameter of xmlNodeToDocument to define the prefix that should be created for each expected namespace, so the generated Document will have consistent names, independent of the incoming XML file.

HTH,
Fred