diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-04-12 07:19:13 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-04-12 07:19:13 (GMT) |
commit | 321faf9461274eb6758dbec5e070b4e4600d10b6 (patch) | |
tree | d911cbce893898e442fb8715199f84fc9b2c7f5b /src/uscxml/util/DOM.cpp | |
parent | e0d37b8181e12030cc71d538ca08a80a924d5d4a (diff) | |
download | uscxml-321faf9461274eb6758dbec5e070b4e4600d10b6.zip uscxml-321faf9461274eb6758dbec5e070b4e4600d10b6.tar.gz uscxml-321faf9461274eb6758dbec5e070b4e4600d10b6.tar.bz2 |
Reduced dependencies on XercesC
Diffstat (limited to 'src/uscxml/util/DOM.cpp')
-rw-r--r-- | src/uscxml/util/DOM.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/uscxml/util/DOM.cpp b/src/uscxml/util/DOM.cpp index d089807..a2d0252 100644 --- a/src/uscxml/util/DOM.cpp +++ b/src/uscxml/util/DOM.cpp @@ -289,6 +289,7 @@ void DOMUtils::filterTypeGeneric(const std::set<DOMNode::NodeType>& types, const bool includeEmbeddedDoc, const bool includeRoot) { +#if 0 if (!root) return; @@ -322,6 +323,42 @@ void DOMUtils::filterTypeGeneric(const std::set<DOMNode::NodeType>& types, types.find(root->getNodeType()) != types.end()) { result.push_back((DOMNode*)root); } +#else + if (!root) + return; + + if ((order == NO_RECURSE || order == DOCUMENT) && + includeRoot && + types.find(root->getNodeType()) != types.end()) { + + result.push_back((DOMNode*)root); + } + + if (root->getNodeType() == DOMNode::ELEMENT_NODE && root->hasChildNodes()) { + DOMNode* currNode = root->getFirstChild(); + while (currNode) { + if (order == NO_RECURSE) { + if (types.find(currNode->getNodeType()) != types.end()) { + result.push_back(currNode); + } + } else { + if (includeEmbeddedDoc || + (currNode->getNodeType() == DOMNode::ELEMENT_NODE && + TAGNAME_CAST(currNode) != XML_PREFIX(root).str() + "scxml")) { + filterTypeGeneric(types, result, currNode, order, includeEmbeddedDoc, true); + } + } + currNode = currNode->getNextSibling(); + } + } + + if (order == POSTFIX && + includeRoot && + types.find(root->getNodeType()) != types.end()) { + result.push_back((DOMNode*)root); + } + +#endif } |