Java Code Examples for com.sun.tools.internal.ws.util.xml.XmlUtil#getAttributeNSOrNull()

The following examples show how to use com.sun.tools.internal.ws.util.xml.XmlUtil#getAttributeNSOrNull() . 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: MemberSubmissionAddressingExtensionHandler.java    From openjdk-8-source 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 2
Source File: MemberSubmissionAddressingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleFaultExtension(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("")) {
            errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
            return false; // keep compiler happy
        }
        ((Fault) parent).setAction(actionValue);
        return true;
    } else {
        return fail(context.getLocation(e));
    }
}
 
Example 3
Source File: W3CAddressingMetadataExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleInputExtension(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));
    }
    ((Input)parent).setAction(actionValue);
    return true;
}
 
Example 4
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 5
Source File: MemberSubmissionAddressingExtensionHandler.java    From openjdk-jdk8u-backup 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 6
Source File: W3CAddressingMetadataExtensionHandler.java    From jdk8u60 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 7
Source File: WSDLParser.java    From hottub 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 8
Source File: MemberSubmissionAddressingExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleFaultExtension(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("")) {
            errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
            return false; // keep compiler happy
        }
        ((Fault) parent).setAction(actionValue);
        return true;
    } else {
        return fail(context.getLocation(e));
    }
}
 
Example 9
Source File: WSDLParser.java    From openjdk-8-source 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 10
Source File: W3CAddressingMetadataExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleInputExtension(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));
    }
    ((Input)parent).setAction(actionValue);
    return true;
}
 
Example 11
Source File: W3CAddressingMetadataExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleInputExtension(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));
    }
    ((Input)parent).setAction(actionValue);
    return true;
}
 
Example 12
Source File: W3CAddressingMetadataExtensionHandler.java    From TencentKona-8 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 13
Source File: MemberSubmissionAddressingExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleFaultExtension(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("")) {
            errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
            return false; // keep compiler happy
        }
        ((Fault) parent).setAction(actionValue);
        return true;
    } else {
        return fail(context.getLocation(e));
    }
}
 
Example 14
Source File: W3CAddressingMetadataExtensionHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    String actionValue = XmlUtil.getAttributeNSOrNull(e, WSAM_ACTION_QNAME);
    if (actionValue == null || actionValue.equals("")) {
        errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue()));
        return false; // keep compiler happy
    }
    ((Fault)parent).setAction(actionValue);
    return true;
}
 
Example 15
Source File: WSDLParser.java    From openjdk-jdk8u-backup 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 16
Source File: W3CAddressingMetadataExtensionHandler.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) {
    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 17
Source File: W3CAddressingMetadataExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleInputExtension(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));
    }
    ((Input)parent).setAction(actionValue);
    return true;
}
 
Example 18
Source File: MIMEExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected boolean handleInputOutputExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) {
            context.push();
            context.registerNamespaces(e);

            MIMEMultipartRelated mpr = new MIMEMultipartRelated(context.getLocation(e));

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

                if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) {
                    context.push();
                    context.registerNamespaces(e2);

                    MIMEPart part = new MIMEPart(context.getLocation(e2));

                    String name =
                        XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
                    if (name != null) {
                        part.setName(name);
                    }

                    for (Iterator iter2 = XmlUtil.getAllChildren(e2);
                         iter2.hasNext();
                        ) {
                        Element e3 = Util.nextElement(iter2);
                        if (e3 == null)
                            break;

                        AbstractExtensionHandler h = getExtensionHandlers().get(e3.getNamespaceURI());
                        boolean handled = false;
                        if (h != null) {
                            handled = h.doHandleExtension(context, part, e3);
                        }

                        if (!handled) {
                            String required =
                                XmlUtil.getAttributeNSOrNull(
                                    e3,
                                    Constants.ATTR_REQUIRED,
                                    Constants.NS_WSDL);
                            if (required != null
                                && required.equals(Constants.TRUE)) {
                                Util.fail(
                                    "parsing.requiredExtensibilityElement",
                                    e3.getTagName(),
                                    e3.getNamespaceURI());
                            } else {
//                                context.fireIgnoringExtension(
//                                    new QName(
//                                        e3.getNamespaceURI(),
//                                        e3.getLocalName()),
//                                    part.getElementName());
                            }
                        }
                    }

                    mpr.add(part);
                    context.pop();
//                    context.fireDoneParsingEntity(
//                        MIMEConstants.QNAME_PART,
//                        part);
                } else {
                    Util.fail(
                        "parsing.invalidElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                }
            }

            parent.addExtension(mpr);
            context.pop();
//            context.fireDoneParsingEntity(
//                MIMEConstants.QNAME_MULTIPART_RELATED,
//                mpr);
            return true;
        } else 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 19
Source File: MIMEExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected boolean handleInputOutputExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) {
            context.push();
            context.registerNamespaces(e);

            MIMEMultipartRelated mpr = new MIMEMultipartRelated(context.getLocation(e));

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

                if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) {
                    context.push();
                    context.registerNamespaces(e2);

                    MIMEPart part = new MIMEPart(context.getLocation(e2));

                    String name =
                        XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
                    if (name != null) {
                        part.setName(name);
                    }

                    for (Iterator iter2 = XmlUtil.getAllChildren(e2);
                         iter2.hasNext();
                        ) {
                        Element e3 = Util.nextElement(iter2);
                        if (e3 == null)
                            break;

                        AbstractExtensionHandler h = getExtensionHandlers().get(e3.getNamespaceURI());
                        boolean handled = false;
                        if (h != null) {
                            handled = h.doHandleExtension(context, part, e3);
                        }

                        if (!handled) {
                            String required =
                                XmlUtil.getAttributeNSOrNull(
                                    e3,
                                    Constants.ATTR_REQUIRED,
                                    Constants.NS_WSDL);
                            if (required != null
                                && required.equals(Constants.TRUE)) {
                                Util.fail(
                                    "parsing.requiredExtensibilityElement",
                                    e3.getTagName(),
                                    e3.getNamespaceURI());
                            } else {
//                                context.fireIgnoringExtension(
//                                    new QName(
//                                        e3.getNamespaceURI(),
//                                        e3.getLocalName()),
//                                    part.getElementName());
                            }
                        }
                    }

                    mpr.add(part);
                    context.pop();
//                    context.fireDoneParsingEntity(
//                        MIMEConstants.QNAME_PART,
//                        part);
                } else {
                    Util.fail(
                        "parsing.invalidElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                }
            }

            parent.addExtension(mpr);
            context.pop();
//            context.fireDoneParsingEntity(
//                MIMEConstants.QNAME_MULTIPART_RELATED,
//                mpr);
            return true;
        } else 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 20
Source File: MIMEExtensionHandler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected boolean handleInputOutputExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) {
            context.push();
            context.registerNamespaces(e);

            MIMEMultipartRelated mpr = new MIMEMultipartRelated(context.getLocation(e));

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

                if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) {
                    context.push();
                    context.registerNamespaces(e2);

                    MIMEPart part = new MIMEPart(context.getLocation(e2));

                    String name =
                        XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
                    if (name != null) {
                        part.setName(name);
                    }

                    for (Iterator iter2 = XmlUtil.getAllChildren(e2);
                         iter2.hasNext();
                        ) {
                        Element e3 = Util.nextElement(iter2);
                        if (e3 == null)
                            break;

                        AbstractExtensionHandler h = getExtensionHandlers().get(e3.getNamespaceURI());
                        boolean handled = false;
                        if (h != null) {
                            handled = h.doHandleExtension(context, part, e3);
                        }

                        if (!handled) {
                            String required =
                                XmlUtil.getAttributeNSOrNull(
                                    e3,
                                    Constants.ATTR_REQUIRED,
                                    Constants.NS_WSDL);
                            if (required != null
                                && required.equals(Constants.TRUE)) {
                                Util.fail(
                                    "parsing.requiredExtensibilityElement",
                                    e3.getTagName(),
                                    e3.getNamespaceURI());
                            } else {
//                                context.fireIgnoringExtension(
//                                    new QName(
//                                        e3.getNamespaceURI(),
//                                        e3.getLocalName()),
//                                    part.getElementName());
                            }
                        }
                    }

                    mpr.add(part);
                    context.pop();
//                    context.fireDoneParsingEntity(
//                        MIMEConstants.QNAME_PART,
//                        part);
                } else {
                    Util.fail(
                        "parsing.invalidElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                }
            }

            parent.addExtension(mpr);
            context.pop();
//            context.fireDoneParsingEntity(
//                MIMEConstants.QNAME_MULTIPART_RELATED,
//                mpr);
            return true;
        } else 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
        }
    }