FileDocCategorySizeDatePackage
TransformXPath.javaAPI DocJava SE 6 API5762Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.transforms.implementations

TransformXPath

public class TransformXPath extends TransformSpi
Class TransformXPath Implements the http://www.w3.org/TR/1999/REC-xpath-19991116 transform.
author
Christian Geuer-Pollmann
see
XPath

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
public static final String
implementedTransformURI
Field implementedTransformURI
Constructors Summary
Methods Summary
protected java.lang.StringengineGetURI()
Method engineGetURI

inheritDoc



          
      
      return implementedTransformURI;
   
protected com.sun.org.apache.xml.internal.security.signature.XMLSignatureInputenginePerformTransform(com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput input)
Method enginePerformTransform

inheritDoc
param
input
throws
TransformationException


      try {

         /**
          * If the actual input is an octet stream, then the application MUST
          * convert the octet stream to an XPath node-set suitable for use by
          * Canonical XML with Comments. (A subsequent application of the
          * REQUIRED Canonical XML algorithm would strip away these comments.)
          *
          * ...
          *
          * The evaluation of this expression includes all of the document's nodes
          * (including comments) in the node-set representing the octet stream.
          */
		  CachedXPathAPIHolder.setDoc(this._transformObject.getElement().getOwnerDocument());
         
         

         Element xpathElement =XMLUtils.selectDsNode(
            this._transformObject.getElement().getFirstChild(),
               Constants._TAG_XPATH,0);

         if (xpathElement == null) {
            Object exArgs[] = { "ds:XPath", "Transform" };

            throw new TransformationException("xml.WrongContent", exArgs);
         }
         Node xpathnode = xpathElement.getChildNodes().item(0);
         String str=CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
         input.setNeedsToBeExpanded(needsCircunvent(str));
         if (xpathnode == null) {
     	    throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
     	                           "Text must be in ds:Xpath");
     	 }


         input.addNodeFilter(new XPathNodeFilter( xpathElement, xpathnode, str));
         input.setNodeSet(true);
         return input;
      } catch (DOMException ex) {
         throw new TransformationException("empty", ex);
      } 
   
private booleanneedsCircunvent(java.lang.String str)

param
str
return
true if needs to be circunvent for bug.

    	return true;
    	//return str.contains("namespace");