+bool hasParent(xmlNodePtr theNode)
+{
+ xmlNodePtr aNode = theNode->parent;
+ if (!aNode) {
+ return false;
+ }
+ for (; aNode; aNode = aNode->next) {
+ if (isElementNode(theNode)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool hasParent(xmlNodePtr theNode, const char* theNodeName, ...)
+{
+ if (!hasParent(theNode)) {
+ return false; // have no parents at all
+ }
+ xmlNodePtr aNode = theNode->parent;
+ const xmlChar* aName = aNode->name;
+ if (!aName || !isElementNode(aNode)) {
+ return false;
+ }
+ if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) {
+ return true;
+ }
+ va_list args; // define argument list variable
+ va_start(args, theNodeName); // init list; point to last defined argument
+ while (true) {
+ char *anArg = va_arg (args, char*); // get next argument
+ if (anArg == NULL)
+ break;
+ if (!xmlStrcmp(aName, (const xmlChar *) anArg)) {
+ va_end(args); // cleanup the system stack
+ return true;
+ }
+ }
+ va_end(args); // cleanup the system stack
+ return false;
+}
+
+xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const std::vector<const char*>& theNodeNames)
+{
+ if (!hasParent(theNode)) {
+ return 0; // have no parents at all
+ }
+ xmlNodePtr aNode = theNode->parent;
+ const xmlChar* aName = aNode->name;
+ if (!aName || !isElementNode(aNode)) {
+ return 0;
+ }
+ for (size_t anIndex = 0; anIndex < theNodeNames.size(); ++anIndex) {
+ if (!xmlStrcmp(aName, (const xmlChar *) theNodeNames[anIndex]))
+ return aNode;
+ }
+ return hasParentRecursive(aNode, theNodeNames);
+}
+
+xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const char* theNodeName, ...)
+{
+ std::vector<const char*> aNodeNames;
+ va_list args; // define argument list variable
+ va_start(args, theNodeName); // init list; point to last defined argument
+ aNodeNames.push_back(theNodeName);
+ while (true) {
+ char *anArg = va_arg (args, char*); // get next argument
+ if (anArg == NULL)
+ break;
+ aNodeNames.push_back(anArg);
+ }
+ va_end(args); // cleanup the system stack
+ return hasParentRecursive(theNode, aNodeNames);
+}
+
+bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId,