Author: dkulp Date: Tue Sep 16 08:56:31 2008 New Revision: 695948 URL: http://svn.apache.org/viewvc?rev=695948&view=rev Log: Merged revisions 695503 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes
................ r695503 | dkulp | 2008-09-15 11:17:30 -0400 (Mon, 15 Sep 2008) | 9 lines Merged revisions 695396 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r695396 | seanoc | 2008-09-15 05:45:29 -0400 (Mon, 15 Sep 2008) | 1 line Removed further references to NodeList ........ ................ Modified: cxf/branches/2.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 16 08:56:31 2008 @@ -1,3 +1,3 @@ -/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870 -/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869 +/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503 +/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396 /incubator/cxf/trunk:434594-651668 Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java (original) +++ cxf/branches/2.0.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java Tue Sep 16 08:56:31 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); Assertion a = ab.build(elem); JaxbAssertion<FooType> jba = JaxbAssertion.cast(a, FooType.class); FooType foo = jba.getData(); 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=695948&r1=695947&r2=695948&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 Tue Sep 16 08:56:31 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/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original) +++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Tue Sep 16 08:56:31 2008 @@ -48,7 +48,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; @@ -57,6 +57,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/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java (original) +++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java Tue Sep 16 08:56:31 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; @@ -180,10 +179,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/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java (original) +++ cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java Tue Sep 16 08:56:31 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/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java (original) +++ cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java Tue Sep 16 08:56:31 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/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java (original) +++ cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java Tue Sep 16 08:56:31 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.NU_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.NU_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.WSDL11_NAMESPACE, "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.WSDL11_NAMESPACE, + "import"); + for (Element elem : elemList) { + NamedNodeMap attributes = elem.getAttributes(); String systemId; String namespace = attributes.getNamedItem("namespace").getNodeValue(); // Is this ok? Modified: cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original) +++ cxf/branches/2.0.x-fixes/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Tue Sep 16 08:56:31 2008 @@ -44,7 +44,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; @@ -70,6 +69,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; @@ -354,15 +354,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/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java?rev=695948&r1=695947&r2=695948&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java (original) +++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java Tue Sep 16 08:56:31 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",
