Commit 9524a6de authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

ENH/BUG: Get XdmfInformation to work with older style xdmf format where

values could be stored as content instead of just as attributes.

Modify the reader to get content in a more robust fashion. Before, if an
element had children, the routine would concanate all contents of all
children. Now we only read the appropriate content for the current node
being read.
parent 901ed4b4
......@@ -137,11 +137,16 @@ public:
}
else {
std::map<std::string, std::string> itemProperties;
if(currNode->children != NULL) {
xmlChar *content = xmlNodeGetContent(currNode);
itemProperties["Content"] = (char*)content;
xmlFree(content);
itemProperties["XMLDir"] = mXMLDir;
xmlNodePtr childNode = currNode->children;
while(childNode != NULL) {
if(childNode->type == XML_TEXT_NODE) {
xmlChar * content = childNode->content;
itemProperties["Content"] = (char*)content;
itemProperties["XMLDir"] = mXMLDir;
break;
}
childNode = childNode->next;
}
xmlAttrPtr currAttribute = currNode->properties;
while(currAttribute != NULL) {
......
......@@ -101,7 +101,13 @@ XdmfInformation::populateItem(const std::map<std::string, std::string> & itemPro
mValue = value->second;
}
else {
XdmfError::message(XdmfError::FATAL, "'Value' not found in itemProperties in XdmfInformation::populateItem");
value = itemProperties.find("Content");
if(value != itemProperties.end()) {
mValue = value->second;
}
else {
XdmfError::message(XdmfError::FATAL, "'Value' not found in itemProperties in XdmfInformation::populateItem");
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment