org.jcp.xml.dsig.internal.dom.DOMXSLTTransform Maven / Gradle / Ivy
The newest version!
/* */ package org.jcp.xml.dsig.internal.dom;
/* */
/* */ import java.security.InvalidAlgorithmParameterException;
/* */ import javax.xml.crypto.MarshalException;
/* */ import javax.xml.crypto.XMLCryptoContext;
/* */ import javax.xml.crypto.XMLStructure;
/* */ import javax.xml.crypto.dom.DOMStructure;
/* */ import javax.xml.crypto.dsig.spec.TransformParameterSpec;
/* */ import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;
/* */ import org.w3c.dom.Element;
/* */ import org.w3c.dom.Node;
/* */
/* */ public final class DOMXSLTTransform extends ApacheTransform
/* */ {
/* */ public void init(TransformParameterSpec params)
/* */ throws InvalidAlgorithmParameterException
/* */ {
/* 28 */ if (params == null) {
/* 29 */ throw new InvalidAlgorithmParameterException("params are required");
/* */ }
/* 31 */ if (!(params instanceof XSLTTransformParameterSpec)) {
/* 32 */ throw new InvalidAlgorithmParameterException("unrecognized params");
/* */ }
/* 34 */ this.params = params;
/* */ }
/* */
/* */ public void init(XMLStructure parent, XMLCryptoContext context)
/* */ throws InvalidAlgorithmParameterException
/* */ {
/* 40 */ super.init(parent, context);
/* 41 */ unmarshalParams(DOMUtils.getFirstChildElement(this.transformElem));
/* */ }
/* */
/* */ private void unmarshalParams(Element sheet) {
/* 45 */ this.params = new XSLTTransformParameterSpec(new DOMStructure(sheet));
/* */ }
/* */
/* */ public void marshalParams(XMLStructure parent, XMLCryptoContext context)
/* */ throws MarshalException
/* */ {
/* 51 */ super.marshalParams(parent, context);
/* 52 */ XSLTTransformParameterSpec xp = (XSLTTransformParameterSpec)getParameterSpec();
/* */
/* 54 */ Node xsltElem = ((DOMStructure)xp.getStylesheet()).getNode();
/* */
/* 56 */ DOMUtils.appendChild(this.transformElem, xsltElem);
/* */ }
/* */ }
/* Location: E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
* Qualified Name: org.jcp.xml.dsig.internal.dom.DOMXSLTTransform
* JD-Core Version: 0.6.2
*/