Revision 8e8882847d428a8f6e4080507e95b42acc6674ad authored by Rene Brun on 26 September 2006, 13:44:50 UTC, committed by Rene Brun on 26 September 2006, 13:44:50 UTC
When loading the geometry from a file, the element table is recreated (never streamed) so the attribute flags (defined/used) of elements are lost. The patch loops over all defined materials/mixtures in this case and restores the flags. Affected: TFluka when geometry was loaded from the file. git-svn-id: http://root.cern.ch/svn/root/trunk@16348 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 0900218
DOMRecursive.C
////////////////////////////////////////////////////////////////////////////////
// //
// ROOT implementation of a XML DOM Parser //
// //
// This is an example of how Dom Parser walks the DOM tree recursively. //
// This example will parse any xml file. //
// //
// To run this program //
// .x domrecursive.C //
// //
// Requires: person.xml //
// //
////////////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
#include <TDOMParser.h>
#include <TXMLNode.h>
#include <TXMLAttr.h>
void ParseContext(TXMLNode *node)
{
for ( ; node; node = node->GetNextNode()) {
if (node->GetNodeType() == TXMLNode::kXMLElementNode) { // Element Node
cout << node->GetNodeName() << ": ";
if (node->HasAttributes()) {
TList* attrList = node->GetAttributes();
TIter next(attrList);
TXMLAttr *attr;
while ((attr =(TXMLAttr*)next())) {
cout << attr->GetName() << ":" << attr->GetValue();
}
}
}
if (node->GetNodeType() == TXMLNode::kXMLTextNode) { // Text node
cout << node->GetContent();
}
if (node->GetNodeType() == TXMLNode::kXMLCommentNode) { //Comment node
cout << "Comment: " << node->GetContent();
}
ParseContext(node->GetChildren());
}
}
void DOMRecursive()
{
TDOMParser *domParser = new TDOMParser();
domParser->SetValidate(false); // do not validate with DTD
domParser->ParseFile("person.xml");
TXMLNode *node = domParser->GetXMLDocument()->GetRootNode();
ParseContext(node);
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...