[xsd-users] Elements with CDATA content
James & Veri Martin
verimart at hotmail.com
Wed Mar 7 19:22:52 EST 2012
Answer to my question:
>
So how do I add the cdata section as a child of the element represented by CustomType instance x?
...simpler than I was thinking:
#include <xercesc/dom/DOMCDATASection.hpp>
operator<< (xercesc::DOMElement& e, const CustomType& x)
{
if ( x.hasCdata() )
{
const CustomType_base &b(x);
e << b;
}
else
{
// cdata text
xercesc::DOMDocument &doc( *e.getOwnerDocument () );
xercesc::DOMCDATASection *cdat( doc.createCDATASection(x.data()) );
e.appendChild(cdat);
// ...plus similar code for attributes defined for this node
}
}
More information about the xsd-users
mailing list