Example usage for org.w3c.dom Node getLocalName

List of usage examples for org.w3c.dom Node getLocalName

Introduction

In this page you can find the example usage for org.w3c.dom Node getLocalName.

Prototype

public String getLocalName();

Source Link

Document

Returns the local part of the qualified name of this node.

Usage

From source file:cz.cas.lib.proarc.common.export.mets.JhoveUtility.java

public static Node getNodeRecursive(Node node, String localName) {
    if ((node.getLocalName() != null) && (node.getLocalName().startsWith(localName))) {
        return node;
    } else {/*from ww  w  .  j av a2 s .  c  o  m*/
        NodeList nl = node.getChildNodes();
        if (nl == null) {
            return null;
        }
        for (int a = 0; a < nl.getLength(); a++) {
            Node found = getNodeRecursive(nl.item(a), localName);
            if (found != null) {
                return found;
            }
        }
    }
    return null;
}

From source file:ee.ria.xroad.proxy.util.MetaserviceTestUtil.java

/** Merge xroad-specific {@link SoapHeader} to the generic {@link SOAPHeader}
 * @param header/*from   ww w.  j  av a2s.  c o  m*/
 * @param xrHeader
 * @throws JAXBException
 * @throws ParserConfigurationException
 * @throws SOAPException
 */
public static void mergeHeaders(SOAPHeader header, SoapHeader xrHeader)
        throws JAXBException, ParserConfigurationException, SOAPException {

    Document document = documentBuilderFactory.newDocumentBuilder().newDocument();
    final DocumentFragment documentFragment = document.createDocumentFragment();
    // marshalling on the header would add the xroad header as a child of the header
    // (i.e. two nested header elements)
    marshaller.marshal(xrHeader, documentFragment);

    Document headerDocument = header.getOwnerDocument();
    Node xrHeaderElement = documentFragment.getFirstChild();

    assertTrue("test setup failed: assumed had header element but did not",
            xrHeaderElement.getNodeType() == Node.ELEMENT_NODE
                    && xrHeaderElement.getLocalName().equals("Header"));

    final NamedNodeMap attributes = xrHeaderElement.getAttributes();

    if (attributes != null) {
        for (int i = 0; i < attributes.getLength(); i++) {
            final Attr attribute = (Attr) attributes.item(i);
            header.setAttributeNodeNS((Attr) headerDocument.importNode(attribute, false));
        }
    }

    final NodeList childNodes = xrHeaderElement.getChildNodes();

    if (childNodes != null) {
        for (int i = 0; i < childNodes.getLength(); i++) {
            final Node node = childNodes.item(i);
            header.appendChild(headerDocument.importNode(node, true));
        }
    }

}

From source file:org.eclipse.lyo.testsuite.oslcv2.ServiceProviderCatalogXmlTests.java

public static Collection<Object[]> getReferencedCatalogUrlsUsingXML(String base)
        throws IOException, ParserConfigurationException, SAXException, XPathException {
    staticSetup();/*w  w  w  .  j a va 2  s .c  om*/
    HttpResponse resp = OSLCUtils.getResponseFromUrl(base, base, basicCreds, OSLCConstants.CT_XML, headers);

    int statusCode = resp.getStatusLine().getStatusCode();
    if (HttpStatus.SC_OK != statusCode) {
        EntityUtils.consume(resp.getEntity());
        throw new IOException("Response code: " + statusCode + " for " + base);
    }

    String respBody = EntityUtils.toString(resp.getEntity());
    Document baseDoc = OSLCUtils.createXMLDocFromResponseBody(respBody);

    // ArrayList to contain the urls from all SPCs
    Collection<Object[]> data = new ArrayList<Object[]>();
    Node rootElement = (Node) OSLCUtils.getXPath().evaluate("/rdf:RDF/*", baseDoc, XPathConstants.NODE);
    if (rootElement.getNamespaceURI().equals(OSLCConstants.OSLC_V2)
            && rootElement.getLocalName().equals("ServiceProviderCatalog")) {
        data.add(new Object[] { base });
    }

    // Get all ServiceProviderCatalog urls from the base document in order
    // to test them as well,
    // recursively checking them for other ServiceProviderCatalogs further
    // down.
    NodeList spcs = (NodeList) OSLCUtils.getXPath().evaluate(
            "//oslc_v2:serviceProviderCatalog/oslc_v2:ServiceProviderCatalog/@rdf:about", baseDoc,
            XPathConstants.NODESET);
    for (int i = 0; i < spcs.getLength(); i++) {
        if (!spcs.item(i).getNodeValue().equals(base)) {
            Collection<Object[]> subCollection = getReferencedCatalogUrlsUsingXML(spcs.item(i).getNodeValue());
            Iterator<Object[]> iter = subCollection.iterator();
            while (iter.hasNext()) {
                data.add(iter.next());
            }
        }
    }
    return data;
}

From source file:net.bpelunit.framework.control.util.ActivityUtil.java

/**
 * Returns the XML name of an object, if it is an activity.
 *///from   ww  w  .j a  v a 2s.  c o  m
public static String getName(Object presumedActivity) {
    if (!(presumedActivity instanceof XMLActivity)) {
        return null;
    }

    XMLActivity activity = (XMLActivity) presumedActivity;
    Node node = activity.getDomNode();

    if (node == null) {
        return null;
    }

    return node.getLocalName();
}

From source file:net.bpelunit.framework.control.util.ActivityUtil.java

/**
 * Returns the activity constant for an activity, given as an object. The
 * object is tested for the correct type. If no activity was found or unkown
 * type, null is returned./*  w  w w. jav  a  2 s.c  o m*/
 * 
 * @param presumedActivity
 * @return
 */
public static ActivityConstant getActivityConstant(Object presumedActivity) {

    if (!(presumedActivity instanceof XmlObject)) {
        return null;
    }
    XmlObject activity = (XmlObject) presumedActivity;

    Node node = activity.getDomNode();

    String localName = null;
    if (node != null) {
        localName = node.getLocalName();
    } else {
        return null;
    }

    return ActivityConstant.getForXmlName(localName);
}

From source file:org.escidoc.browser.elabsmodul.service.ELabsService.java

private static InvestigationBean resolveInvestigation(final ContainerProxy containerProxy) {
    final String URI_DC = "http://purl.org/dc/elements/1.1/";
    final String URI_EL = "http://escidoc.org/ontologies/bw-elabs/re#";
    final String URI_RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

    if (containerProxy == null) {
        throw new NullPointerException("Container Proxy is null.");
    }/*from w ww  . j  a v  a 2 s .  c om*/
    final InvestigationBean investigationBean = new InvestigationBean();
    final Element e = containerProxy.getMetadataRecords().get("escidoc").getContent();
    investigationBean.setObjid(containerProxy.getId());

    if (!(("Investigation".equals(e.getLocalName()) && URI_EL.equals(e.getNamespaceURI()))
            || "el:Investigation".equals(e.getTagName()))) {
        LOG.error("Container is not an eLabs Investigation");
        return investigationBean;
    }

    final NodeList nodeList = e.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        final Node node = nodeList.item(i);
        final String nodeName = node.getLocalName();
        final String nsUri = node.getNamespaceURI();

        if (nodeName == null || nsUri == null) {
            continue;
        }

        if ("title".equals(nodeName) && URI_DC.equals(nsUri)) {
            investigationBean.setName(node.getTextContent());
        } else if ("description".equals(nodeName) && URI_DC.equals(nsUri)) {
            investigationBean.setDescription(node.getTextContent());
        } else if ("max-runtime".equals(nodeName) && URI_EL.equals(nsUri)) {
            investigationBean.setMaxRuntime("<<not used>>");
            try {
                investigationBean.setMaxRuntimeInMin(Integer.valueOf(node.getTextContent()));
            } catch (final NumberFormatException nfe) {
                LOG.error(nfe.getMessage());
                investigationBean.setMaxRuntimeInMin(0);
            }
        } else if ("deposit-endpoint".equals(nodeName) && URI_EL.equals(nsUri)) {
            investigationBean.setDepositEndpoint(node.getTextContent());
        } else if ("investigator".equals(nodeName) && URI_EL.equals(nsUri)) {
            final String investigatorId = node.getAttributes().getNamedItemNS(URI_RDF, "resource")
                    .getTextContent();
            investigationBean.setInvestigator(investigatorId);
        } else if ("rig".equals(nodeName) && URI_EL.equals(nsUri)) {
            final String rigId = node.getAttributes().getNamedItemNS(URI_RDF, "resource").getTextContent();
            if (StringUtils.notEmpty(rigId)) {
                final RigBean rigBean = new RigBean();
                rigBean.setObjectId(rigId);
                investigationBean.setRigBean(rigBean);
            }
        } else if ("instrument".equals(nodeName) && URI_EL.equals(nsUri)) {
            final String instrument = node.getAttributes().getNamedItemNS(URI_RDF, "resource").getTextContent();
            final String folder = node.getTextContent().trim();
            investigationBean.getInstrumentFolder().put(instrument, folder);
        }
    }
    return investigationBean;
}

From source file:org.escidoc.browser.elabsmodul.service.ELabsService.java

private static InstrumentBean resolveInstrument(final ResourceProxy resourceProxy)
        throws EscidocBrowserException {

    if (resourceProxy == null || !(resourceProxy instanceof ItemProxy)) {
        throw new EscidocBrowserException("NOT an ItemProxy", null);
    }/*ww w  . j a  v a2  s.c  o m*/

    final ItemProxy itemProxy = (ItemProxy) resourceProxy;
    final InstrumentBean instrumentBean = new InstrumentBean();
    instrumentBean.setObjectId(itemProxy.getId());
    final Element e = itemProxy.getMetadataRecords().get("escidoc").getContent();
    final NodeList nodeList = e.getChildNodes();
    final String URI_DC = "http://purl.org/dc/elements/1.1/";
    final String URI_EL = "http://escidoc.org/ontologies/bw-elabs/re#";
    for (int i = 0; i < nodeList.getLength(); i++) {
        final Node node = nodeList.item(i);
        final String nodeName = node.getLocalName();
        final String nsUri = node.getNamespaceURI();

        if (nodeName == null || nodeName.equals("")) {
            continue;
        } else if (nsUri == null || nsUri.equals("")) {
            continue;
        }

        if ("title".equals(nodeName) && URI_DC.equals(nsUri)) {
            instrumentBean.setName((node.getFirstChild() != null) ? node.getFirstChild().getNodeValue() : null);
        } else if ("description".equals(nodeName) && URI_DC.equals(nsUri)) {
            instrumentBean.setDescription(
                    (node.getFirstChild() != null) ? node.getFirstChild().getNodeValue() : null);
        } else if ("requires-configuration".equals(nodeName) && URI_EL.equals(nsUri)) {
            final String value = node.getFirstChild().getNodeValue();
            if (value.equals("no")) {
                instrumentBean.setConfiguration(false);
            } else if (value.equals("yes")) {
                instrumentBean.setConfiguration(true);
            }
        } else if ("requires-calibration".equals(nodeName) && URI_EL.equals(nsUri)) {
            final String value = node.getFirstChild().getNodeValue();
            if (value.equals("no")) {
                instrumentBean.setCalibration(false);
            } else if (value.equals("yes")) {
                instrumentBean.setCalibration(true);
            }
        } else if ("esync-endpoint".equals(nodeName) && URI_EL.equals(nsUri)) {
            instrumentBean.setESyncDaemon(
                    (node.getFirstChild() != null) ? node.getFirstChild().getNodeValue() : null);
        } else if ("monitored-folder".equals(nodeName) && URI_EL.equals(nsUri)) {
            instrumentBean
                    .setFolder((node.getFirstChild() != null) ? node.getFirstChild().getNodeValue() : null);
        } else if ("result-mime-type".equals(nodeName) && URI_EL.equals(nsUri)) {
            instrumentBean
                    .setFileFormat((node.getFirstChild() != null) ? node.getFirstChild().getNodeValue() : null);
        } else if ("responsible-person".equals(nodeName) && URI_EL.equals(nsUri)
                && node.getAttributes().getNamedItem("rdf:resource") != null) {
            final String supervisorId = node.getAttributes().getNamedItem("rdf:resource").getNodeValue();
            instrumentBean.setDeviceSupervisor(supervisorId);
        } else if ("institution".equals(nodeName) && URI_EL.equals(nsUri)
                && node.getAttributes().getNamedItem("rdf:resource") != null) {
            final String instituteId = node.getAttributes().getNamedItem("rdf:resource").getNodeValue();
            instrumentBean.setInstitute(instituteId);
        }
    }
    return instrumentBean;
}

From source file:Main.java

public static Map<String, String> XmlAsMap(Node node) {
    Map<String, String> map = new HashMap<String, String>();
    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node currentNode = nodeList.item(i);
        if (currentNode.hasAttributes()) {
            for (int j = 0; j < currentNode.getAttributes().getLength(); j++) {
                Node item = currentNode.getAttributes().item(i);
                if (item != null)
                    map.put(item.getNodeName(), prepare(item.getTextContent()));
            }/*from   w ww  .  ja v  a2  s.  c  o  m*/
        }
        if (currentNode.getFirstChild() != null) {
            if (currentNode.getFirstChild().getNodeType() == Node.ELEMENT_NODE) {
                map.putAll(XmlAsMap(currentNode));
            } else if (currentNode.getFirstChild().getNodeType() == Node.TEXT_NODE) {
                map.put(currentNode.getLocalName(), prepare(currentNode.getTextContent()));
            }
        }
    }
    return map;
}

From source file:com.centeractive.ws.SchemaUtils.java

/**
 * Returns a map mapping urls to corresponding XmlSchema XmlObjects for the
 * specified wsdlUrl// ww  w  .ja  v  a2 s  .c  o  m
 */
public static void getSchemas(String wsdlUrl, Map<String, XmlObject> existing, SchemaLoader loader, String tns,
        String xml) {
    if (existing.containsKey(wsdlUrl)) {
        return;
    }

    log.debug("Getting schema " + wsdlUrl);

    ArrayList<?> errorList = new ArrayList<Object>();

    Map<String, XmlObject> result = new HashMap<String, XmlObject>();

    boolean common = false;

    try {
        XmlOptions options = new XmlOptions();
        options.setCompileNoValidation();
        options.setSaveUseOpenFrag();
        options.setErrorListener(errorList);
        options.setSaveSyntheticDocumentElement(new QName(Constants.XSD_NS, "schema"));

        XmlObject xmlObject = loader.loadXmlObject(xml);
        if (xmlObject == null)
            throw new Exception("Failed to load schema from [" + wsdlUrl + "]");

        Document dom = (Document) xmlObject.getDomNode();
        Node domNode = dom.getDocumentElement();

        // is this an xml schema?
        if (domNode.getLocalName().equals("schema") && Constants.XSD_NS.equals(domNode.getNamespaceURI())) {
            // set targetNamespace (this happens if we are following an include
            // statement)
            if (tns != null) {
                Element elm = ((Element) domNode);
                if (!elm.hasAttribute("targetNamespace")) {
                    common = true;
                    elm.setAttribute("targetNamespace", tns);
                }

                // check for namespace prefix for targetNamespace
                NamedNodeMap attributes = elm.getAttributes();
                int c = 0;
                for (; c < attributes.getLength(); c++) {
                    Node item = attributes.item(c);
                    if (item.getNodeName().equals("xmlns"))
                        break;

                    if (item.getNodeValue().equals(tns) && item.getNodeName().startsWith("xmlns"))
                        break;
                }

                if (c == attributes.getLength())
                    elm.setAttribute("xmlns", tns);
            }

            if (common && !existing.containsKey(wsdlUrl + "@" + tns))
                result.put(wsdlUrl + "@" + tns, xmlObject);
            else
                result.put(wsdlUrl, xmlObject);
        } else {
            existing.put(wsdlUrl, null);

            XmlObject[] schemas = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:schema");

            for (int i = 0; i < schemas.length; i++) {
                XmlCursor xmlCursor = schemas[i].newCursor();
                String xmlText = xmlCursor.getObject().xmlText(options);
                // schemas[i] = XmlObject.Factory.parse( xmlText, options );
                schemas[i] = XmlUtils.createXmlObject(xmlText, options);
                schemas[i].documentProperties().setSourceName(wsdlUrl);

                result.put(wsdlUrl + "@" + (i + 1), schemas[i]);
            }

            XmlObject[] wsdlImports = xmlObject
                    .selectPath("declare namespace s='" + Constants.WSDL11_NS + "' .//s:import/@location");
            for (int i = 0; i < wsdlImports.length; i++) {
                String location = ((SimpleValue) wsdlImports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null, xml);
                }
            }

            XmlObject[] wadl10Imports = xmlObject.selectPath(
                    "declare namespace s='" + Constants.WADL10_NS + "' .//s:grammars/s:include/@href");
            for (int i = 0; i < wadl10Imports.length; i++) {
                String location = ((SimpleValue) wadl10Imports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null, xml);
                }
            }

            XmlObject[] wadlImports = xmlObject.selectPath(
                    "declare namespace s='" + Constants.WADL11_NS + "' .//s:grammars/s:include/@href");
            for (int i = 0; i < wadlImports.length; i++) {
                String location = ((SimpleValue) wadlImports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null, xml);
                }
            }

        }

        existing.putAll(result);

        XmlObject[] schemas = result.values().toArray(new XmlObject[result.size()]);

        for (int c = 0; c < schemas.length; c++) {
            xmlObject = schemas[c];

            XmlObject[] schemaImports = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:import/@schemaLocation");
            for (int i = 0; i < schemaImports.length; i++) {
                String location = ((SimpleValue) schemaImports[i]).getStringValue();
                Element elm = ((Attr) schemaImports[i].getDomNode()).getOwnerElement();

                if (location != null && !defaultSchemas.containsKey(elm.getAttribute("namespace"))) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null, xml);
                }
            }

            XmlObject[] schemaIncludes = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:include/@schemaLocation");
            for (int i = 0; i < schemaIncludes.length; i++) {
                String location = ((SimpleValue) schemaIncludes[i]).getStringValue();
                if (location != null) {
                    String targetNS = getTargetNamespace(xmlObject);

                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, targetNS, xml);
                }
            }
        }
    } catch (Exception e) {
        throw new SoapBuilderException(e);
    }
}

From source file:com.example.soaplegacy.SchemaUtils.java

/**
 * Returns a map mapping urls to corresponding XmlSchema XmlObjects for the
 * specified wsdlUrl/*  w w w . j av  a2s  .c  om*/
 */
public static void getSchemas(String wsdlUrl, Map<String, XmlObject> existing, SchemaLoader loader,
        String tns) {
    if (existing.containsKey(wsdlUrl)) {
        return;
    }

    log.debug("Getting schema " + wsdlUrl);

    ArrayList<?> errorList = new ArrayList<Object>();

    Map<String, XmlObject> result = new HashMap<String, XmlObject>();

    boolean common = false;

    try {
        XmlOptions options = new XmlOptions();
        options.setCompileNoValidation();
        options.setSaveUseOpenFrag();
        options.setErrorListener(errorList);
        options.setSaveSyntheticDocumentElement(new QName(Constants.XSD_NS, "schema"));

        XmlObject xmlObject = loader.loadXmlObject(wsdlUrl, options);
        if (xmlObject == null)
            throw new Exception("Failed to load schema from [" + wsdlUrl + "]");

        Document dom = (Document) xmlObject.getDomNode();
        Node domNode = dom.getDocumentElement();

        // is this an xml schema?
        if (domNode.getLocalName().equals("schema") && Constants.XSD_NS.equals(domNode.getNamespaceURI())) {
            // set targetNamespace (this happens if we are following an include
            // statement)
            if (tns != null) {
                Element elm = ((Element) domNode);
                if (!elm.hasAttribute("targetNamespace")) {
                    common = true;
                    elm.setAttribute("targetNamespace", tns);
                }

                // check for namespace prefix for targetNamespace
                NamedNodeMap attributes = elm.getAttributes();
                int c = 0;
                for (; c < attributes.getLength(); c++) {
                    Node item = attributes.item(c);
                    if (item.getNodeName().equals("xmlns"))
                        break;

                    if (item.getNodeValue().equals(tns) && item.getNodeName().startsWith("xmlns"))
                        break;
                }

                if (c == attributes.getLength())
                    elm.setAttribute("xmlns", tns);
            }

            if (common && !existing.containsKey(wsdlUrl + "@" + tns))
                result.put(wsdlUrl + "@" + tns, xmlObject);
            else
                result.put(wsdlUrl, xmlObject);
        } else {
            existing.put(wsdlUrl, null);

            XmlObject[] schemas = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:schema");

            for (int i = 0; i < schemas.length; i++) {
                XmlCursor xmlCursor = schemas[i].newCursor();
                String xmlText = xmlCursor.getObject().xmlText(options);
                // schemas[i] = XmlObject.Factory.parse( xmlText, options );
                schemas[i] = XmlUtils.createXmlObject(xmlText, options);
                schemas[i].documentProperties().setSourceName(wsdlUrl);

                result.put(wsdlUrl + "@" + (i + 1), schemas[i]);
            }

            XmlObject[] wsdlImports = xmlObject
                    .selectPath("declare namespace s='" + Constants.WSDL11_NS + "' .//s:import/@location");
            for (int i = 0; i < wsdlImports.length; i++) {
                String location = ((SimpleValue) wsdlImports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null);
                }
            }

            XmlObject[] wadl10Imports = xmlObject.selectPath(
                    "declare namespace s='" + Constants.WADL10_NS + "' .//s:grammars/s:include/@href");
            for (int i = 0; i < wadl10Imports.length; i++) {
                String location = ((SimpleValue) wadl10Imports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null);
                }
            }

            XmlObject[] wadlImports = xmlObject.selectPath(
                    "declare namespace s='" + Constants.WADL11_NS + "' .//s:grammars/s:include/@href");
            for (int i = 0; i < wadlImports.length; i++) {
                String location = ((SimpleValue) wadlImports[i]).getStringValue();
                if (location != null) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null);
                }
            }

        }

        existing.putAll(result);

        XmlObject[] schemas = result.values().toArray(new XmlObject[result.size()]);

        for (int c = 0; c < schemas.length; c++) {
            xmlObject = schemas[c];

            XmlObject[] schemaImports = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:import/@schemaLocation");
            for (int i = 0; i < schemaImports.length; i++) {
                String location = ((SimpleValue) schemaImports[i]).getStringValue();
                Element elm = ((Attr) schemaImports[i].getDomNode()).getOwnerElement();

                if (location != null && !defaultSchemas.containsKey(elm.getAttribute("namespace"))) {
                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, null);
                }
            }

            XmlObject[] schemaIncludes = xmlObject
                    .selectPath("declare namespace s='" + Constants.XSD_NS + "' .//s:include/@schemaLocation");
            for (int i = 0; i < schemaIncludes.length; i++) {
                String location = ((SimpleValue) schemaIncludes[i]).getStringValue();
                if (location != null) {
                    String targetNS = getTargetNamespace(xmlObject);

                    if (!location.startsWith("file:") && location.indexOf("://") == -1)
                        location = joinRelativeUrl(wsdlUrl, location);

                    getSchemas(location, existing, loader, targetNS);
                }
            }
        }
    } catch (Exception e) {
        throw new SoapBuilderException(e);
    }
}