I'm trying to create an XML signature mechanism. my XML can be something like below:
<Main>
<ChildType1>... </ChildType1>
<ChildType2>... </ChildType2>
</Main>
In fact it would be agnostic to the kind of data below the Main
node.
And I only want to compute the CRC of data include into Main
Node and after add a signature
attribute on the Main
.
But for now I wrote
ostringstream ss;
{
boost::archive::text_oarchive oa(ss);
ss.str("");
try
{
TiXmlBase::SetCondenseWhiteSpace(false);
tinyxml::Document doc;
doc.LoadFile(filename.c_str());
tinyxml::Element* schemes = tinyxml::findSingleElement<SchemesSignatureException>(doc, "Main");
if (schemes == 0) throw logica_error("No Main found");
tinyxml::TinyXmlFwdIterator<tinyxml::Element> child;
for (child = child.begin(schemes); child != child.end(); ++child)
{
//the question is here, how to get the XML text of each child of the Main...
}
}
catch (exception& e)
{
throw ;
}
}
string data(ss.str());
boost::crc_32_type crc;
crc.process_bytes(data.data(), data.size());
As I iterate over the child how can I get the XML text string, as for my example, first iteration will flush "... " in oa
and second iteration "... " in oa
?
I tried GetText but it always return NULL ! Have you an idea ?