[xsd-users] How to clone/copy an XML message and add it to a another message using anyType

Boris Kolpackov boris at codesynthesis.com
Fri Mar 6 13:20:01 EST 2009


Hi Laura,

Laura E Fowler <Laura_E_Fowler at raytheon.com> writes:

> I'm getting closer, but when I execute following line:
> 
> *e << *lchc;
> 
> I receive the following exception:
> terminate called after throwing an instance of 
> 'xsd::cxx::xml::dom::no_prefix'

This means that there are elements/attributes in lchc with a 
namespace for which there is no prefix established in e. You
can establish a namespace-prefix mapping like so:

e->setAttributeNS (
  xml::string ("http://www.w3.org/2000/xmlns/").c_str (),
  xml::string ("xmlns:foo").c_str (),
  xml::string ("http://www.example.com/foo").c_str ());

Alternatively, you can upgrade to 3.2.0. In this version, if there
is no prefix found for an element or attribute during serialization,
a generic one (e.g., p1, p2) is automatically added.

Boris




More information about the xsd-users mailing list