My plan was to get the string of childelements, verify the MD5 of that
string, and then wrap them in a tag and do another domxml_open_mem on
that to parse, but I haven't gotten that far.
The get_content on the message element gives the child element values,
but not their tags(I did a view source to verify that the tags weren't
being hidden by the browser):
'(Client's)
FL075642
AdvData.mdb
StampHere'
I'm using PHP 4. Any suggestions?
<?php
$xmlMem= "<Payload>
<ProtocolVersion>
1.1
</ProtocolVersion>
<Message id=\"1\">
'<DHParam>(Client's)</DHParam>
<IdNumber>FL075642</IdNumber>
<Filename>Data.txt</Filename>
<TimeStamp>StampHere</TimeStamp>'
</Message>
<HMac id=\"1\">
ActualHMacHere
</HMac >
<HMacMessageAssociation>
<MessageReference ref=\"1\"/>
<HMacReference ref=\"1\"/>
</HMacMessageAssociation>
</Payload>";
$xmldoc = @domxml_open_mem($xmlMem,DOMXML_LOAD_PARSING,$error);
//print errors
echo "<pre>"; # Just for nice layout
foreach ($error as $errorline) { # Loop through all errors
echo $errorline['errormessage'];
echo " Node : " . $errorline['nodename'] . "\n";
echo " Line : " . $errorline['line'] . "\n";
echo " Column : " . $errorline['col'] . "\n\n";
}
$root = $xmldoc->document_element();
echo 'root->name = "'.$root->name."\"\n";
function parse_node($node,$callDepth)
{
$callDepthLoc = $callDepth +1;
if($callDepth > 5)
{
return;
}
if ($node->has_child_nodes())
{
foreach($node->child_nodes() as $n)
{
echo 'node_name = "'.$n->node_name()."\"\n";
echo 'node_value = "'.$n->node_value()."\"\n";
echo 'get_content = "'.$n->get_content()."\"\n";
// echo ' = '.$n->();
if($n->has_attributes())
{
foreach($n->attributes() as $a)
{
echo ' attribute name = "'.$a->name()."\"\n";
echo ' attribute value = "'.$a->value()."\"\n";
}
}
if ($n->node_type() == XML_ELEMENT_NODE)
{
parse_node($n,$callDepthLoc);
}
echo '</blockquote>';
}
}
}
parse_node($root,0);
echo "</pre>";
?>