[xsd-users] Retrieving namespace map from parsed docs

Boris Kolpackov boris at codesynthesis.com
Thu Dec 2 15:04:15 EST 2010


Hi Russ,

Russ Loucks <rjl at third-monday.com> writes:

> 1st question:  Can I retrieve the namespace map from the parsed XML  
> documents?

You can, but it will require a bit of work. The namespace-prefix
(and namespace-schema) mapping is not preserved in the object
model. But it is available in the raw DOM representation. So
what you can do is break the parsing process into two stages:
XML-to-DOM and DOM-to-object model. In between the two stages
you can extract the namespace mapping attributes from the DOM 
document using the Xerces-C++ API. For code that shows how to
set up XML-to-DOM parsing, see, for instance, the 'messaging'
example.

Boris



More information about the xsd-users mailing list