cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r692501 - /cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
Date Fri, 05 Sep 2008 17:59:28 GMT
Author: dkulp
Date: Fri Sep  5 10:59:28 2008
New Revision: 692501

URL: http://svn.apache.org/viewvc?rev=692501&view=rev
Log:
Fix build failure

Modified:
    cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java

Modified: cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=692501&r1=692500&r2=692501&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
(original)
+++ cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
Fri Sep  5 10:59:28 2008
@@ -24,6 +24,7 @@
 import java.io.OutputStream;
 import java.io.StringReader;
 
+import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -145,6 +146,9 @@
         }
         return attN.getNodeValue();
     }
+    public static String getAttribute(Element element, QName attName) {
+        return element.getAttributeNS(attName.getNamespaceURI(), attName.getLocalPart());
+    }
 
     public static void setAttribute(Node node, String attName, String val) {
         NamedNodeMap attributes = node.getAttributes();
@@ -214,6 +218,10 @@
         }
         return null;
     }
+    
+    public static QName getElementQName(Element el) {
+        return new QName(el.getNamespaceURI(), el.getLocalName());
+    }
     /**
      * Get the first direct child with a given type
      */
@@ -227,7 +235,31 @@
         }
         return (Element) n;
     }
-
+    public static Element getNextElement(Element el) {
+        Node nd = el.getNextSibling();
+        while (nd != null) {
+            if (nd.getNodeType() == Node.ELEMENT_NODE) {
+                return (Element)nd;
+            }
+            nd = nd.getNextSibling();
+        }
+        return null;
+    }
+    
+    public static Element getFirstChildWithName(Element parent, QName q) { 
+        String ns = q.getNamespaceURI();
+        String lp = q.getLocalPart();
+        return getFirstChildWithName(parent, ns, lp);
+    }
+    public static Element getFirstChildWithName(Element parent, String ns, String lp) { 
+        Node n = parent.getFirstChild();
+        while (n != null 
+            && !ns.equals(n.getNamespaceURI())
+            && !lp.equals(n.getLocalName())) {
+            n = n.getNextSibling();
+        }
+        return (Element)n;
+    }
     /**
      * Get the first direct child with a given type
      */



Mime
View raw message