Example usage for javax.xml.crypto NodeSetData NodeSetData

List of usage examples for javax.xml.crypto NodeSetData NodeSetData

Introduction

In this page you can find the example usage for javax.xml.crypto NodeSetData NodeSetData.

Prototype

NodeSetData

Source Link

Usage

From source file:org.apache.jcp.xml.dsig.internal.dom.DOMReference.java

private static Data copyDerefData(Data dereferencedData) {
    if (dereferencedData instanceof ApacheData) {
        // need to make a copy of the Data
        ApacheData ad = (ApacheData) dereferencedData;
        XMLSignatureInput xsi = ad.getXMLSignatureInput();
        if (xsi.isNodeSet()) {
            try {
                final Set<Node> s = xsi.getNodeSet();
                return new NodeSetData() {
                    public Iterator iterator() {
                        return s.iterator();
                    }/* w  ww . j a va  2s.  c  o m*/
                };
            } catch (Exception e) {
                // log a warning
                log.warn("cannot cache dereferenced data: " + e);
                return null;
            }
        } else if (xsi.isElement()) {
            return new DOMSubTreeData(xsi.getSubNode(), xsi.isExcludeComments());
        } else if (xsi.isOctetStream() || xsi.isByteArray()) {
            try {
                return new OctetStreamData(xsi.getOctetStream(), xsi.getSourceURI(), xsi.getMIMEType());
            } catch (IOException ioe) {
                // log a warning
                log.warn("cannot cache dereferenced data: " + ioe);
                return null;
            }
        }
    }
    return dereferencedData;
}

From source file:org.jcp.xml.dsig.internal.dom.DOMReference.java

private static Data copyDerefData(Data dereferencedData) {
    if (dereferencedData instanceof ApacheData) {
        // need to make a copy of the Data
        ApacheData ad = (ApacheData) dereferencedData;
        XMLSignatureInput xsi = ad.getXMLSignatureInput();
        if (xsi.isNodeSet()) {
            try {
                final Set s = xsi.getNodeSet();
                return new NodeSetData() {
                    public Iterator iterator() {
                        return s.iterator();
                    }/*from   w  ww.ja va2s .  c  o m*/
                };
            } catch (Exception e) {
                // log a warning
                log.warn("cannot cache dereferenced data: " + e);
                return null;
            }
        } else if (xsi.isElement()) {
            return new DOMSubTreeData(xsi.getSubNode(), xsi.isExcludeComments());
        } else if (xsi.isOctetStream() || xsi.isByteArray()) {
            try {
                return new OctetStreamData(xsi.getOctetStream(), xsi.getSourceURI(), xsi.getMIMEType());
            } catch (IOException ioe) {
                // log a warning
                log.warn("cannot cache dereferenced data: " + ioe);
                return null;
            }
        }
    }
    return dereferencedData;
}