[xsd-users] Extracting data between xml tags
Prakash, Arul
Arul.Prakash2 at rsa.com
Fri Jan 25 04:10:08 EST 2013
Hi,
I have this part of the schema
<xs:element name="Sample" type="ns:ContextType" />
<xs:complexType name="ContextType" mixed="true">
<xs:attribute name="ID" type="xs:ID" use="optional"/>
</xs:complexType>
The corresponding c++ code generated is
class ContextType: public ::xml_schema::type
{
public:
// ID
//
typedef ::xml_schema::string ID_type;
typedef ::xsd::cxx::tree::optional< ID_type > ID_optional;
typedef ::xsd::cxx::tree::traits< ID_type, char > ID_traits;
const ID_optional&
ID () const;
ID_optional&
ID ();
void
ID (const ID_type& x);
void
ID (const ID_optional& x);
void
ID (::std::auto_ptr< ID_type > p);
// Constructors.
//
ContextType ();
ContextType (const ::xercesc::DOMElement& e,
::xml_schema::flags f = 0,
::xml_schema::container* c = 0);
ContextType (const ContextType& x,
::xml_schema::flags f = 0,
::xml_schema::container* c = 0);
virtual ContextType*
_clone (::xml_schema::flags f = 0,
::xml_schema::container* c = 0) const;
virtual
~ContextType ();
// Implementation.
//
protected:
void
parse (::xsd::cxx::xml::dom::parser< char >&,
::xml_schema::flags);
protected:
ID_optional ID_;
};
My question is how can I construct a xml fragment like this < Sample ID="97612934">this is a string</ Sample >
My current code looks like this
CommonAPI::authentication::ContextType::ID_type sample_ID_type("97612934");
CommonAPI::authentication::ContextType sample_type;
sample _type.ID(sample_ID_type);
But I don't know how to set the value "this is a string" between the tags.
Any pointers would be helpful.
Thanks
Arul
More information about the xsd-users
mailing list