javax.xml.crypto.dsig.spec.XPathType Java Examples

The following examples show how to use javax.xml.crypto.dsig.spec.XPathType. 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: DOMXPathFilter2Transform.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #2
Source File: DOMXPathFilter2Transform.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #3
Source File: DOMXPathFilter2Transform.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #4
Source File: DOMXPathFilter2Transform.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #5
Source File: DOMXPathFilter2Transform.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #6
Source File: DOMXPathFilter2Transform.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #7
Source File: DOMXPathFilter2Transform.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #8
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #9
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #10
Source File: DOMXPathFilter2Transform.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #11
Source File: DOMXPathFilter2Transform.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #12
Source File: DOMXPathFilter2Transform.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #13
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    super.marshalParams(parent, context);
    XPathFilter2ParameterSpec xp =
        (XPathFilter2ParameterSpec)getParameterSpec();
    String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
    String qname = (prefix == null || prefix.length() == 0)
                   ? "xmlns" : "xmlns:" + prefix;
    @SuppressWarnings("unchecked")
    List<XPathType> xpathList = xp.getXPathList();
    for (XPathType xpathType : xpathList) {
        Element elem = DOMUtils.createElement(ownerDoc, "XPath",
                                              Transform.XPATH2, prefix);
        elem.appendChild
            (ownerDoc.createTextNode(xpathType.getExpression()));
        DOMUtils.setAttribute(elem, "Filter",
                              xpathType.getFilter().toString());
        elem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname,
                            Transform.XPATH2);

        // add namespace attributes, if necessary
        @SuppressWarnings("unchecked")
        Set<Map.Entry<String, String>> entries =
            xpathType.getNamespaceMap().entrySet();
        for (Map.Entry<String, String> entry : entries) {
            elem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" +
                                entry.getKey(),
                                entry.getValue());
        }

        transformElem.appendChild(elem);
    }
}
 
Example #14
Source File: DOMXPathFilter2Transform.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #15
Source File: DOMXPathFilter2Transform.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #16
Source File: DOMXPathFilter2Transform.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #17
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #18
Source File: DOMXPathFilter2Transform.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #19
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #20
Source File: DOMXPathFilter2Transform.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #21
Source File: DOMXPathFilter2Transform.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #22
Source File: DOMXPathFilter2Transform.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #23
Source File: DOMXPathFilter2Transform.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #24
Source File: DOMXPathFilter2Transform.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #25
Source File: DOMXPathFilter2Transform.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}
 
Example #26
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void unmarshalParams(Element curXPathElem) throws MarshalException
{
    List<XPathType> list = new ArrayList<XPathType>();
    while (curXPathElem != null) {
        String xPath = curXPathElem.getFirstChild().getNodeValue();
        String filterVal = DOMUtils.getAttributeValue(curXPathElem,
                                                      "Filter");
        if (filterVal == null) {
            throw new MarshalException("filter cannot be null");
        }
        XPathType.Filter filter = null;
        if (filterVal.equals("intersect")) {
            filter = XPathType.Filter.INTERSECT;
        } else if (filterVal.equals("subtract")) {
            filter = XPathType.Filter.SUBTRACT;
        } else if (filterVal.equals("union")) {
            filter = XPathType.Filter.UNION;
        } else {
            throw new MarshalException("Unknown XPathType filter type" +
                                       filterVal);
        }
        NamedNodeMap attributes = curXPathElem.getAttributes();
        if (attributes != null) {
            int length = attributes.getLength();
            Map<String, String> namespaceMap =
                new HashMap<String, String>(length);
            for (int i = 0; i < length; i++) {
                Attr attr = (Attr)attributes.item(i);
                String prefix = attr.getPrefix();
                if (prefix != null && prefix.equals("xmlns")) {
                    namespaceMap.put(attr.getLocalName(), attr.getValue());
                }
            }
            list.add(new XPathType(xPath, filter, namespaceMap));
        } else {
            list.add(new XPathType(xPath, filter));
        }

        curXPathElem = DOMUtils.getNextSiblingElement(curXPathElem);
    }
    this.params = new XPathFilter2ParameterSpec(list);
}