Add parametrized messaging and serialization to exceptions.
[shibboleth/cpp-xmltooling.git] / xmltooling / util / XMLHelper.h
index c1ad4fe..ac6f240 100644 (file)
@@ -87,18 +87,90 @@ namespace xmltooling {
         static DOMElement* appendChildElement(DOMElement* parentElement, DOMElement* childElement);\r
         \r
         /**\r
-         * Checks the qualified name of an element.\r
+         * Checks the qualified name of a node.\r
          * \r
-         * @param e     element to check\r
+         * @param n     node to check\r
          * @param ns    namespace to compare with\r
          * @param local local name to compare with\r
-         * @return  true iff the element's qualified name matches the other parameters\r
+         * @return  true iff the node's qualified name matches the other parameters\r
          */\r
-        static bool isElementNamed(const DOMElement* e, const XMLCh* ns, const XMLCh* local) {\r
-            return (e && XMLString::equals(ns,e->getNamespaceURI()) && XMLString::equals(local,e->getLocalName()));\r
+        static bool isNodeNamed(const DOMNode* n, const XMLCh* ns, const XMLCh* local) {\r
+            return (n && XMLString::equals(local,n->getLocalName()) && XMLString::equals(ns,n->getNamespaceURI()));\r
         }\r
 \r
         /**\r
+         * Returns the first child element of the node if any.\r
+         * \r
+         * @param n     node to check\r
+         * @return  the first child node of type Element, or NULL\r
+         */\r
+        static DOMElement* getFirstChildElement(const DOMNode* n);\r
+        \r
+        /**\r
+         * Returns the last child element of the node if any.\r
+         * \r
+         * @param n     node to check\r
+         * @return  the last child node of type Element, or NULL\r
+         */\r
+        static DOMElement* getLastChildElement(const DOMNode* n);\r
+        \r
+        /**\r
+         * Returns the next sibling element of the node if any.\r
+         * \r
+         * @param n     node to check\r
+         * @return  the next sibling node of type Element, or NULL\r
+         */\r
+        static DOMElement* getNextSiblingElement(const DOMNode* n);\r
+        \r
+        /**\r
+         * Returns the previous sibling element of the node if any.\r
+         * \r
+         * @param n     node to check\r
+         * @return  the previous sibling node of type Element, or NULL\r
+         */\r
+        static DOMElement* getPreviousSiblingElement(const DOMNode* n);\r
+        \r
+        /**\r
+         * Returns the first matching child element of the node if any.\r
+         * \r
+         * @param n         node to check\r
+         * @param ns        namespace to compare with\r
+         * @param localName local name to compare with\r
+         * @return  the first matching child node of type Element, or NULL\r
+         */\r
+        static DOMElement* getFirstChildElement(const DOMNode* n, const XMLCh* ns, const XMLCh* localName);\r
+        \r
+        /**\r
+         * Returns the last matching child element of the node if any.\r
+         * \r
+         * @param n         node to check\r
+         * @param ns        namespace to compare with\r
+         * @param localName local name to compare with\r
+         * @return  the last matching child node of type Element, or NULL\r
+         */\r
+        static DOMElement* getLastChildElement(const DOMNode* n, const XMLCh* ns, const XMLCh* localName);\r
+        \r
+        /**\r
+         * Returns the next matching sibling element of the node if any.\r
+         * \r
+         * @param n         node to check\r
+         * @param ns        namespace to compare with\r
+         * @param localName local name to compare with\r
+         * @return  the next matching sibling node of type Element, or NULL\r
+         */\r
+        static DOMElement* getNextSiblingElement(const DOMNode* n, const XMLCh* ns, const XMLCh* localName);\r
+        \r
+        /**\r
+         * Returns the previous matching sibling element of the node if any.\r
+         * \r
+         * @param n         node to check\r
+         * @param ns        namespace to compare with\r
+         * @param localName local name to compare with\r
+         * @return  the previous matching sibling node of type Element, or NULL\r
+         */\r
+        static DOMElement* getPreviousSiblingElement(const DOMNode* n, const XMLCh* ns, const XMLCh* localName);\r
+\r
+        /**\r
          * Returns the content of the first Text node found in the element, if any.\r
          * This is roughly similar to the DOM getTextContent function, but only\r
          * examples the immediate children of the element.\r