You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2008/09/15 11:45:32 UTC
svn commit: r695396 - in /cxf/trunk:
api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/
common/common/src/main/java/org/apache/cxf/helpers/
rt/core/src/main/java/org/apache/cxf/transport/http/
rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/...
Author: seanoc
Date: Mon Sep 15 02:45:29 2008
New Revision: 695396
URL: http://svn.apache.org/viewvc?rev=695396&view=rev
Log:
Removed further references to NodeList
Modified:
cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java
cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java
Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java Mon Sep 15 02:45:29 2008
@@ -66,9 +66,10 @@
JaxbAssertionBuilder<FooType> ab = new JaxbAssertionBuilder<FooType>(FooType.class, qn);
assertNotNull(ab);
InputStream is = JaxbAssertionBuilderTest.class.getResourceAsStream("foo.xml");
- Document doc = DOMUtils.readXml(is);
- Element elem = (Element)doc.getDocumentElement()
- .getElementsByTagNameNS("http://cxf.apache.org/test/assertions/foo", "foo").item(0);
+ Document doc = DOMUtils.readXml(is);
+ Element elem = DOMUtils.findAllElementsByTagNameNS((Element)doc.getDocumentElement(),
+ "http://cxf.apache.org/test/assertions/foo",
+ "foo").get(0);
PolicyAssertion a = ab.build(elem);
JaxbAssertion<FooType> jba = JaxbAssertion.cast(a, FooType.class);
FooType foo = jba.getData();
Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Mon Sep 15 02:45:29 2008
@@ -23,6 +23,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
+import java.util.LinkedList;
+import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
@@ -446,4 +448,27 @@
return null;
}
+
+ public static List<Element> findAllElementsByTagNameNS(Element elem,
+ String nameSpaceURI,
+ String localName) {
+ List<Element> ret = new LinkedList<Element>();
+ findAllElementsByTagNameNS(elem, nameSpaceURI, localName, ret);
+ return ret;
+ }
+
+ public static void findAllElementsByTagNameNS(Element el,
+ String nameSpaceURI,
+ String localName,
+ List<Element> elementList) {
+
+ if (localName.equals(el.getLocalName()) && nameSpaceURI.contains(el.getNamespaceURI())) {
+ elementList.add(el);
+ }
+ Element elem = getFirstElement(el);
+ while (elem != null) {
+ findAllElementsByTagNameNS(elem, nameSpaceURI, localName, elementList);
+ elem = getNextElement(elem);
+ }
+ }
}
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Mon Sep 15 02:45:29 2008
@@ -45,7 +45,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+//import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
@@ -54,6 +54,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.staxutils.StaxUtils;
@@ -219,32 +220,31 @@
private void updateDoc(Document doc, String base,
Map<String, Definition> mp,
- Map<String, SchemaReference> smp) {
- NodeList nl = doc.getDocumentElement()
- .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
- "import");
- for (int x = 0; x < nl.getLength(); x++) {
- Element el = (Element)nl.item(x);
+ Map<String, SchemaReference> smp) {
+ List<Element> elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ "http://www.w3.org/2001/XMLSchema",
+ "import");
+ for (Element el : elementList) {
String sl = el.getAttribute("schemaLocation");
if (smp.containsKey(sl)) {
el.setAttribute("schemaLocation", base + "?xsd=" + sl);
}
}
- nl = doc.getDocumentElement()
- .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema",
- "include");
- for (int x = 0; x < nl.getLength(); x++) {
- Element el = (Element)nl.item(x);
+
+ elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ "http://www.w3.org/2001/XMLSchema",
+ "include");
+ for (Element el : elementList) {
String sl = el.getAttribute("schemaLocation");
if (smp.containsKey(sl)) {
el.setAttribute("schemaLocation", base + "?xsd=" + sl);
}
}
- nl = doc.getDocumentElement()
- .getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/",
- "import");
- for (int x = 0; x < nl.getLength(); x++) {
- Element el = (Element)nl.item(x);
+
+ elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ "http://schemas.xmlsoap.org/wsdl/",
+ "import");
+ for (Element el : elementList) {
String sl = el.getAttribute("location");
if (mp.containsKey(sl)) {
el.setAttribute("location", base + "?wsdl=" + sl);
Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java Mon Sep 15 02:45:29 2008
@@ -52,7 +52,6 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.binding.soap.SoapMessage;
@@ -179,10 +178,11 @@
Iterator outIt = bodyElementNew
.getChildElements(new QName("http://apache.org/hello_world_rpclit/types", "out"));
Element outElement = (SOAPElement)outIt.next();
- assertNotNull(outElement);
- NodeList elem3NodeList = outElement
- .getElementsByTagNameNS("http://apache.org/hello_world_rpclit/types", "elem3");
- Node elem3Element = elem3NodeList.item(0);
+ assertNotNull(outElement);
+ Element elem3Element =
+ DOMUtils.findAllElementsByTagNameNS(outElement,
+ "http://apache.org/hello_world_rpclit/types",
+ "elem3").get(0);
assertEquals("100", elem3Element.getTextContent());
}
Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java (original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java Mon Sep 15 02:45:29 2008
@@ -42,6 +42,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.tools.common.dom.ExtendedDocumentBuilder;
@@ -92,10 +93,12 @@
if (streams == null) {
return false;
}
- NodeList nl = streams.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "instream");
-
- for (int i = 0; i < nl.getLength(); i++) {
- if (((Element)nl.item(i)).getAttribute("id").equals(id)) {
+
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams,
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "instream");
+ for (Element elem : elemList) {
+ if (elem.getAttribute("id").equals(id)) {
return true;
}
}
@@ -158,11 +161,12 @@
return handler;
}
- public Element getStreams() {
- NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "streams");
-
- if (nl.getLength() > 0) {
- return (Element)nl.item(0);
+ public Element getStreams() {
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "streams");
+ if (elemList.size() > 0) {
+ return elemList.get(0);
} else {
return null;
}
@@ -173,10 +177,11 @@
Element streams = getStreams();
if (streams != null) {
- NodeList nl = streams.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "instream");
-
- for (int i = 0; i < nl.getLength(); i++) {
- res.add(((Element)nl.item(i)).getAttribute("id"));
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams,
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "instream");
+ for (Element elem : elemList) {
+ res.add(elem.getAttribute("id"));
}
}
return Collections.unmodifiableList(res);
@@ -187,18 +192,21 @@
Element streams = getStreams();
if (streams != null) {
- NodeList nl = streams.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "outstream");
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams,
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "outstream");
- for (int i = 0; i < nl.getLength(); i++) {
- res.add(((Element)nl.item(i)).getAttribute("id"));
+ for (Element elem : elemList) {
+ res.add(elem.getAttribute("id"));
}
}
return Collections.unmodifiableList(res);
}
public Element getUsage() {
- return (Element)doc.getDocumentElement().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "usage")
- .item(0);
+ return DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "usage").get(0);
}
public void transform(InputStream stylesheet, OutputStream out) throws TransformerException {
@@ -207,10 +215,12 @@
}
public Element getPipeline() {
- NodeList nl = doc.getDocumentElement().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "pipeline");
-
- if (nl.getLength() > 0) {
- return (Element)nl.item(0);
+
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "pipeline");
+ if (elemList.size() > 0) {
+ return elemList.get(0);
} else {
return null;
}
@@ -229,18 +239,22 @@
* sort out, but that is the reason why this getter method exists.
*/
public String getStreamRefName(String streamId) {
- if (getUsage() != null) {
- NodeList nl = getUsage().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "associatedArgument");
-
- for (int i = 0; i < nl.getLength(); i++) {
- if (((Element)nl.item(i)).getAttribute("streamref").equals(streamId)) {
- return ((Element)nl.item(i).getParentNode()).getAttribute("id");
+ if (getUsage() != null) {
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(getUsage(),
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "associatedArgument");
+ for (Element elem : elemList) {
+ if (elem.getAttribute("streamref").equals(streamId)) {
+ return ((Element)elem.getParentNode()).getAttribute("id");
}
}
- nl = getUsage().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "argument");
- for (int i = 0; i < nl.getLength(); i++) {
- if (((Element)nl.item(i)).getAttribute("streamref").equals(streamId)) {
- return ((Element)nl.item(i)).getAttribute("id");
+
+ elemList = DOMUtils.findAllElementsByTagNameNS(getUsage(),
+ Tool.TOOL_SPEC_PUBLIC_ID,
+ "argument");
+ for (Element elem : elemList) {
+ if (elem.getAttribute("streamref").equals(streamId)) {
+ return elem.getAttribute("id");
}
}
}
@@ -260,13 +274,13 @@
if (el.hasAttribute("default")) {
return el.getAttribute("default");
}
- } else if ("option".equals(el.getLocalName())) {
- NodeList assArgs = el.getElementsByTagNameNS("http://cxf.apache.org/Xpipe/ToolSpecification",
- "associatedArgument");
-
- if (assArgs.getLength() > 0) {
- Element assArg = (Element)assArgs.item(0);
-
+ } else if ("option".equals(el.getLocalName())) {
+ List<Element> elemList =
+ DOMUtils.findAllElementsByTagNameNS(el,
+ "http://cxf.apache.org/Xpipe/ToolSpecification",
+ "associatedArgument");
+ if (elemList.size() > 0) {
+ Element assArg = elemList.get(0);
if (assArg.hasAttribute("default")) {
return assArg.getAttribute("default");
}
Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java (original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java Mon Sep 15 02:45:29 2008
@@ -21,18 +21,17 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.util.List;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.FileUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.tools.common.ToolConstants;
-//import org.apache.cxf.wsdl.WSDLConstants;
public final class JAXBUtils {
private JAXBUtils() {
@@ -40,27 +39,30 @@
private static Node innerJaxbBinding(Element schema) {
String schemaNamespace = schema.getNamespaceURI();
- NodeList annoList = schema.getElementsByTagNameNS(schemaNamespace, "annotation");
+ List<Element> annoList = DOMUtils.findAllElementsByTagNameNS(schema, schemaNamespace, "annotation");
Element annotation = null;
- if (annoList.getLength() > 0) {
- annotation = (Element)annoList.item(0);
+ if (annoList.size() > 0) {
+ annotation = (Element)annoList.get(0);
} else {
annotation = schema.getOwnerDocument().createElementNS(schemaNamespace, "annotation");
}
-
- NodeList appList = annotation.getElementsByTagNameNS(schemaNamespace, "appinfo");
+ List<Element> appList = DOMUtils.findAllElementsByTagNameNS(annotation,
+ schemaNamespace,
+ "appinfo");
Element appInfo = null;
- if (appList.getLength() > 0) {
- appInfo = (Element)appList.item(0);
+ if (appList.size() > 0) {
+ appInfo = (Element)appList.get(0);
} else {
appInfo = schema.getOwnerDocument().createElementNS(schemaNamespace, "appinfo");
annotation.appendChild(appInfo);
}
Element jaxbBindings = null;
- NodeList jaxbList = schema.getElementsByTagNameNS(ToolConstants.NS_JAXB_BINDINGS, "schemaBindings");
- if (jaxbList.getLength() > 0) {
- jaxbBindings = (Element)jaxbList.item(0);
+ List<Element> jaxbList = DOMUtils.findAllElementsByTagNameNS(schema,
+ ToolConstants.NS_JAXB_BINDINGS,
+ "schemaBindings");
+ if (jaxbList.size() > 0) {
+ jaxbBindings = (Element)jaxbList.get(0);
} else {
jaxbBindings = schema.getOwnerDocument().createElementNS(ToolConstants.NS_JAXB_BINDINGS,
"schemaBindings");
@@ -75,18 +77,20 @@
if (!XMLUtils.hasAttribute(schema, ToolConstants.NS_JAXB_BINDINGS)) {
Attr attr =
- schema.getOwnerDocument().createAttributeNS(ToolConstants.NS_JAXB_BINDINGS, "version");
+ schema.getOwnerDocument().createAttributeNS(ToolConstants.NS_JAXB_BINDINGS,
+ "version");
attr.setValue("2.0");
schema.setAttributeNodeNS(attr);
}
Node schemaBindings = innerJaxbBinding(schema);
- NodeList pkgList = doc.getElementsByTagNameNS(ToolConstants.NS_JAXB_BINDINGS,
- "package");
+ List<Element> pkgList = DOMUtils.findAllElementsByTagNameNS(schema,
+ ToolConstants.NS_JAXB_BINDINGS,
+ "package");
Element packagename = null;
- if (pkgList.getLength() > 0) {
- packagename = (Element)pkgList.item(0);
+ if (pkgList.size() > 0) {
+ packagename = (Element)pkgList.get(0);
} else {
packagename = doc.createElementNS(ToolConstants.NS_JAXB_BINDINGS, "package");
}
Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java (original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java Mon Sep 15 02:45:29 2008
@@ -39,7 +39,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.apache.cxf.BusFactory;
@@ -89,11 +88,11 @@
baseURI = URLEncoder.encode(baseURI, "utf-8");
SchemaCollection schemaCol = new SchemaCollection();
schemaCol.setBaseUri(baseURI);
- NodeList nodes = document.getElementsByTagNameNS(
- WSDLConstants.NS_SCHEMA_XSD, "schema");
- for (int x = 0; x < nodes.getLength(); x++) {
- Node schemaNode = nodes.item(x);
- Element schemaEl = (Element) schemaNode;
+
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(document.getDocumentElement(),
+ WSDLConstants.NS_SCHEMA_XSD,
+ "schema");
+ for (Element schemaEl : elemList) {
String tns = schemaEl.getAttribute("targetNamespace");
try {
schemaCol.read(schemaEl, tns);
@@ -152,7 +151,6 @@
throw new ToolException(e);
}
- NodeList nodes = document.getElementsByTagNameNS(WSDLConstants.NS_WSDL11, "import");
//
// Remove the scheme part of a URI - need to escape spaces in
// case we are on Windows and have spaces in directory names.
@@ -163,8 +161,12 @@
} catch (URISyntaxException e1) {
// This will be problematic...
}
- for (int x = 0; x < nodes.getLength(); x++) {
- NamedNodeMap attributes = nodes.item(x).getAttributes();
+
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(document.getDocumentElement(),
+ WSDLConstants.NS_WSDL11,
+ "import");
+ for (Element elem : elemList) {
+ NamedNodeMap attributes = elem.getAttributes();
String systemId;
String namespace = attributes.getNamedItem("namespace").getNodeValue();
// Is this ok?
Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Mon Sep 15 02:45:29 2008
@@ -45,7 +45,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -71,6 +70,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.FileUtils;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolContext;
@@ -379,15 +379,19 @@
}
private Element removeImportElement(Element element) {
- NodeList nodeList = element.getElementsByTagNameNS(ToolConstants.SCHEMA_URI, "import");
- if (nodeList.getLength() == 0) {
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(element,
+ ToolConstants.SCHEMA_URI,
+ "import");
+ if (elemList.size() == 0) {
return element;
}
element = (Element)cloneNode(element.getOwnerDocument(), element, true);
- nodeList = element.getElementsByTagNameNS(ToolConstants.SCHEMA_URI, "import");
+ elemList = DOMUtils.findAllElementsByTagNameNS(element,
+ ToolConstants.SCHEMA_URI,
+ "import");
List<Node> ns = new ArrayList<Node>();
- for (int tmp = 0; tmp < nodeList.getLength(); tmp++) {
- Node importNode = nodeList.item(tmp);
+ for (Element elem : elemList) {
+ Node importNode = elem;
ns.add(importNode);
}
for (Node item : ns) {
Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java?rev=695396&r1=695395&r2=695396&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java Mon Sep 15 02:45:29 2008
@@ -21,12 +21,13 @@
import java.io.IOException;
import java.io.Writer;
+import java.util.List;
import javax.jws.HandlerChain;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolContext;
@@ -72,9 +73,10 @@
}
Element e = this.intf.getHandlerChains();
- NodeList nl = e.getElementsByTagNameNS(ToolConstants.HANDLER_CHAINS_URI,
- ToolConstants.HANDLER_CHAIN);
- if (nl.getLength() > 0) {
+ List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(e,
+ ToolConstants.HANDLER_CHAINS_URI,
+ ToolConstants.HANDLER_CHAIN);
+ if (elemList.size() > 0) {
String fName = ProcessorUtil.getHandlerConfigFileName(this.intf.getName());
handlerChainAnnotation = new JAnnotation(HandlerChain.class);
handlerChainAnnotation.addElement(new JAnnotationElement("name",