com.sun.tools.internal.ws.util.xml.XmlUtil Java Examples

The following examples show how to use com.sun.tools.internal.ws.util.xml.XmlUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: W3CAddressingExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (XmlUtil.matchesTagNS(e, getWSDLExtensionQName())) {
        /*
        context.push();
        context.registerNamespaces(e);

        // TODO: read UsingAddressing extensibility element and store
        // TODO: it as extension in "parent". It may be used to generate
        // TODO: @Action/@FaultAction later.

        context.pop();
        */
        return true;
    }
    return false; // keep compiler happy
}
 
Example #2
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #3
Source File: HTTPExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
            context.push();
            context.registerNamespaces(e);

            HTTPAddress address = new HTTPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #4
Source File: HTTPExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean handleBindingExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
            context.push();
            context.registerNamespaces(e);

            HTTPBinding binding = new HTTPBinding(context.getLocation(e));

            String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
            binding.setVerb(verb);

            parent.addExtension(binding);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #5
Source File: JAXWSBindingExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #6
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void validateSchemaImports(Element typesElement){
        for (Iterator iter = XmlUtil.getAllChildren(typesElement); iter.hasNext();) {
            Element e = Util.nextElement(iter);
            if (e == null) {
                break;
            }
            if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_IMPORT)) {
                errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.WARNING_WSI_R_2003());
            }else{
                checkNotWsdlElement(e);
//                if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_SCHEMA)) {
//                    forest.getInlinedSchemaElement().add(e);
//                }

            }
        }
    }
 
Example #7
Source File: HTTPExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
            context.push();
            context.registerNamespaces(e);

            HTTPAddress address = new HTTPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #8
Source File: HTTPExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean handleBindingExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
            context.push();
            context.registerNamespaces(e);

            HTTPBinding binding = new HTTPBinding(context.getLocation(e));

            String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
            binding.setVerb(verb);

            parent.addExtension(binding);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #9
Source File: MIMEExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected boolean handleMIMEPartExtension(
    TWSDLParserContext context,
    TWSDLExtensible parent,
    Element e) {
    if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
        MIMEContent content = parseMIMEContent(context, e);
        parent.addExtension(content);
        return true;
    } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
        MIMEXml mimeXml = parseMIMEXml(context, e);
        parent.addExtension(mimeXml);
        return true;
    } else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false; // keep compiler happy
    }
}
 
Example #10
Source File: HTTPExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
            context.push();
            context.registerNamespaces(e);

            HTTPAddress address = new HTTPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #11
Source File: MIMEExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) {
        context.push();
        context.registerNamespaces(e);

        MIMEContent content = new MIMEContent(context.getLocation(e));

        String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
        if (part != null) {
            content.setPart(part);
        }

        String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
        if (type != null) {
            content.setType(type);
        }

        context.pop();
//        context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
        return content;
    }
 
Example #12
Source File: MIMEExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected boolean handleMIMEPartExtension(
    TWSDLParserContext context,
    TWSDLExtensible parent,
    Element e) {
    if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
        MIMEContent content = parseMIMEContent(context, e);
        parent.addExtension(content);
        return true;
    } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
        MIMEXml mimeXml = parseMIMEXml(context, e);
        parent.addExtension(mimeXml);
        return true;
    } else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false; // keep compiler happy
    }
}
 
Example #13
Source File: MIMEExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) {
        context.push();
        context.registerNamespaces(e);

        MIMEContent content = new MIMEContent(context.getLocation(e));

        String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
        if (part != null) {
            content.setPart(part);
        }

        String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
        if (type != null) {
            content.setType(type);
        }

        context.pop();
//        context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
        return content;
    }
 
Example #14
Source File: HTTPExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
            context.push();
            context.registerNamespaces(e);

            HTTPAddress address = new HTTPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #15
Source File: DOMForest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) {
    this.options = options;
    this.entityResolver = entityResolver;
    this.errorReceiver = errReceiver;
    this.logic = logic;
    try {
        // secure xml processing can be switched off if input requires it
        boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity;
        DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(secureProcessingEnabled);
        dbf.setNamespaceAware(true);
        this.documentBuilder = dbf.newDocumentBuilder();

        this.parserFactory = XmlUtil.newSAXParserFactory(secureProcessingEnabled);
        this.parserFactory.setNamespaceAware(true);
    } catch (ParserConfigurationException e) {
        throw new AssertionError(e);
    }
}
 
Example #16
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #17
Source File: W3CAddressingExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (XmlUtil.matchesTagNS(e, getWSDLExtensionQName())) {
        /*
        context.push();
        context.registerNamespaces(e);

        // TODO: read UsingAddressing extensibility element and store
        // TODO: it as extension in "parent". It may be used to generate
        // TODO: @Action/@FaultAction later.

        context.pop();
        */
        return true;
    }
    return false; // keep compiler happy
}
 
Example #18
Source File: JAXWSBindingExtensionHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #19
Source File: MIMEExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) {
        context.push();
        context.registerNamespaces(e);

        MIMEContent content = new MIMEContent(context.getLocation(e));

        String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
        if (part != null) {
            content.setPart(part);
        }

        String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
        if (type != null) {
            content.setType(type);
        }

        context.pop();
//        context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
        return content;
    }
 
Example #20
Source File: HTTPExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean handleBindingExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
            context.push();
            context.registerNamespaces(e);

            HTTPBinding binding = new HTTPBinding(context.getLocation(e));

            String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
            binding.setVerb(verb);

            parent.addExtension(binding);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #21
Source File: MIMEExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected MIMEContent parseMIMEContent(TWSDLParserContext context, Element e) {
        context.push();
        context.registerNamespaces(e);

        MIMEContent content = new MIMEContent(context.getLocation(e));

        String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
        if (part != null) {
            content.setPart(part);
        }

        String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
        if (type != null) {
            content.setType(type);
        }

        context.pop();
//        context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
        return content;
    }
 
Example #22
Source File: JAXWSBindingExtensionHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param context
 * @param parent
 * @param e
 */
private void parsePackage(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
    //System.out.println("In handlePackageExtension: " + e.getNodeName());
    String packageName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
    JAXWSBinding binding = (JAXWSBinding)parent;
    binding.setJaxwsPackage(new CustomName(packageName, getJavaDoc(e)));
}
 
Example #23
Source File: MemberSubmissionAddressingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (extensionModeOn) {
        warn(context.getLocation(e));
        String actionValue = XmlUtil.getAttributeNSOrNull(e, WSA_ACTION_QNAME);
        if (actionValue == null || actionValue.equals("")) {
            return warnEmptyAction(parent, context.getLocation(e));
        }
        ((Output) parent).setAction(actionValue);
        return true;
    } else {
        return fail(context.getLocation(e));
    }
}
 
Example #24
Source File: W3CAddressingMetadataExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    String actionValue = XmlUtil.getAttributeNSOrNull(e, WSAM_ACTION_QNAME);
    if (actionValue == null || actionValue.equals("")) {
        return warnEmptyAction(parent,context.getLocation(e));
    }
    ((Output)parent).setAction(actionValue);
    return true;
}
 
Example #25
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean handlePortTypeOperation(TWSDLParserContext context, Operation parent, Element e) {
        context.push();
        context.registerNamespaces(e);
        JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

        for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
            Element e2 = Util.nextElement(iter);
            if (e2 == null) {
                break;
            }

            if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
                parseWrapperStyle(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
                parseAsynMapping(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
                parseMethod(context, jaxwsBinding, e2);
                if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
                    parent.setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
                }
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
                parseParameter(context, jaxwsBinding, e2);
            }else{
                Util.fail(
                    "parsing.invalidExtensionElement",
                    e2.getTagName(),
                    e2.getNamespaceURI());
                return false;
            }
        }
        parent.addExtension(jaxwsBinding);
        context.pop();
//        context.fireDoneParsingEntity(
//                JAXWSBindingsConstants.JAXWS_BINDINGS,
//                jaxwsBinding);
        return true;
    }
 
Example #26
Source File: MemberSubmissionAddressingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (extensionModeOn) {
        warn(context.getLocation(e));
        String actionValue = XmlUtil.getAttributeNSOrNull(e, WSA_ACTION_QNAME);
        if (actionValue == null || actionValue.equals("")) {
            return warnEmptyAction(parent, context.getLocation(e));
        }
        ((Input) parent).setAction(actionValue);
        return true;
    } else {
        return fail(context.getLocation(e));
    }
}
 
Example #27
Source File: SOAPExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, getAddressQName())) {
            context.push();
            context.registerNamespaces(e);

            SOAPAddress address = new SOAPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(getAddressQName(), address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false; // keep compiler happy
        }
    }
 
Example #28
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkNotWsdlRequired(Element e) {
    // check the wsdl:required attribute, fail if set to "true"
    String required =
        XmlUtil.getAttributeNSOrNull(
            e,
            Constants.ATTR_REQUIRED,
            Constants.NS_WSDL);
    if (required != null && required.equals(Constants.TRUE) && !options.isExtensionMode()) {
        errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_REQUIRED_EXTENSIBILITY_ELEMENT(e.getTagName(),
            e.getNamespaceURI()));
    }
}
 
Example #29
Source File: JAXWSBindingExtensionHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

            for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
                Element e2 = Util.nextElement(iter);
                if (e2 == null) {
                    break;
                }

//                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
//                    parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
//                }else
                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
                    parseMimeContent(context, jaxwsBinding, e2);
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #30
Source File: SOAPExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, getAddressQName())) {
            context.push();
            context.registerNamespaces(e);

            SOAPAddress address = new SOAPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(getAddressQName(), address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false; // keep compiler happy
        }
    }