[xsd-users] serialization of any elements and namespaces

Gross, Jeffrey jgross03 at harris.com
Tue Apr 4 15:36:59 EDT 2017


Hello,

I'm trying to add an element to the "any sequence" of another element and I see namespaces appear in the serialized code where I don't want/need them. For example my code snippet:

    groupType groupElement;
    groupElement.name("group1");

    statusType statusElement;
    xercesc::DOMElement* e = statusElement.dom_document().createElement(xsd::cxx::xml::string("ns2:group"));

    *e << groupElement;
    statusElement.any().push_back(e);

eventually generates an XML snippet that looks like:

    <status>
      <ns2:group xmlns="" name="group1"/>
    </status>

I would like to get rid of that xmlns="" bit. I found a previous post that seemed to indicate this would be fixed:

>From http://codesynthesis.com/pipermail/xsd-users/2012-March/003558.html:

> This is a Xerces-C++ limitation that we are planning to fix for the next
> release (i.e., allow serialization of an XML fragment as if it was in
> a context of some outer element). For now, depending on how your schema,
> uses XML namespaces, you may have to live with some extra namespace 
> information

Am I doing something wrong? Is this fixed now? If not, will it be?

Thanks,
Jeff




More information about the xsd-users mailing list