Reading an XML file using the XMLReader which should be faster compared to DOM classes
XmlReader taskDetails;
str attributeName, attributeValue;
int i, j;
;
//using the XML Reader class
taskDetails = XmlTextReader::newXml( tasks.ScriptText );
while ( taskDetails.read() )
{
switch ( taskDetails.nodeType() )
{
case XMLNodeType::Element:
while ( taskDetails.moveToNextAttribute() )
{
attributeName = taskDetails.name();
attributeValue = taskDetails.value();
info( strfmt("AttributeName =%1, AttributeValue = %2", taskDetails.name(), taskDetails.value() ) );
}
break;
default:
info( strfmt("Nodetype = %1, NodeName = %2, NodeValue = %3, InnerXML = %4, readAttributeValue = %5"
, taskDetails.nodeType()
, taskDetails.name()
, taskDetails.value()
, taskDetails.readInnerXml()
, taskDetails.readAttributeValue()
) ) ;
while ( taskDetails.moveToNextAttribute() )
{
attributeName = taskDetails.name();
attributeValue = taskDetails.value();
info( strfmt("AttributeName =%1, AttributeValue = %2", taskDetails.name(), taskDetails.value() ) );
}
break;
}
}
No comments:
Post a Comment