Search in sources :

Example 1 with CTRelationshipReference

use of org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference in project poi by apache.

the class RelationshipTransformService method init.

@Override
public void init(XMLStructure parent, XMLCryptoContext context) throws InvalidAlgorithmParameterException {
    LOG.log(POILogger.DEBUG, "init(parent,context)");
    LOG.log(POILogger.DEBUG, "parent java type: " + parent.getClass().getName());
    DOMStructure domParent = (DOMStructure) parent;
    Node parentNode = domParent.getNode();
    try {
        TransformDocument transDoc = TransformDocument.Factory.parse(parentNode, DEFAULT_XML_OPTIONS);
        XmlObject[] xoList = transDoc.getTransform().selectChildren(RelationshipReferenceDocument.type.getDocumentElementName());
        if (xoList.length == 0) {
            LOG.log(POILogger.WARN, "no RelationshipReference/@SourceId parameters present");
        }
        for (XmlObject xo : xoList) {
            String sourceId = ((CTRelationshipReference) xo).getSourceId();
            LOG.log(POILogger.DEBUG, "sourceId: ", sourceId);
            this.sourceIds.add(sourceId);
        }
    } catch (XmlException e) {
        throw new InvalidAlgorithmParameterException(e);
    }
}
Also used : InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) XmlException(org.apache.xmlbeans.XmlException) Node(org.w3c.dom.Node) DOMStructure(javax.xml.crypto.dom.DOMStructure) TransformDocument(org.w3.x2000.x09.xmldsig.TransformDocument) XmlObject(org.apache.xmlbeans.XmlObject) CTRelationshipReference(org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference)

Aggregations

InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 DOMStructure (javax.xml.crypto.dom.DOMStructure)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlObject (org.apache.xmlbeans.XmlObject)1 CTRelationshipReference (org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference)1 TransformDocument (org.w3.x2000.x09.xmldsig.TransformDocument)1 Node (org.w3c.dom.Node)1