You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/09/05 19:59:28 UTC
svn commit: r692501 -
/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
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
*/