[xsd-users] Setting element text content
Matt Burnham
mwburn at mhpcc.hpc.mil
Thu Jul 13 22:21:33 EDT 2006
Boris,
If I have the following schema:
<xs:element name="stuff">
<xs:complexType>
<xs:attribute name="attr1" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
And I'm generating the cxx-tree, in memory with the following code:
stuff::attr1::type a1( "X" );
stuff my_stuff( a1 );
std::string data = "Text Goes Here";
dom::auto_ptr<DOMDocument> dom_doc( stuff_(my_stuff, nsm) );
XMLCh *xml_data = xercesc::XMLString::transcode( data.c_str() );
dom_doc->setTextContent( xml_data);
xercesc::XMLString::release( &xml_data );
// serialize DOMDodument back to xml
I get the following:
<stuff attr1="X"/>
How can I add "text content" to the element to generate the following xml:
<stuff attr1="X">Text Goes Here</stuff>
Thanks,
Matt
More information about the xsd-users
mailing list