FileDocCategorySizeDatePackage
XPathFilterCHGPContainer.javaAPI DocJava SE 6 API9513Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.transforms.params

XPathFilterCHGPContainer

public class XPathFilterCHGPContainer extends ElementProxy implements TransformParam
Implements the parameters for a custom Transform which has a better performance thatn the xfilter2.
author
$Author: raul $

Fields Summary
private static final String
_TAG_INCLUDE_BUT_SEARCH
Field _ATT_FILTER_VALUE_INTERSECT
private static final String
_TAG_EXCLUDE_BUT_SEARCH
Field _ATT_FILTER_VALUE_SUBTRACT
private static final String
_TAG_EXCLUDE
Field _ATT_FILTER_VALUE_UNION
public static final String
_TAG_XPATHCHGP
Field _TAG_XPATHCHGP
public static final String
_ATT_INCLUDESLASH
Field _ATT_INCLUDESLASH
public static final boolean
IncludeSlash
Field IncludeSlash
public static final boolean
ExcludeSlash
Field ExcludeSlash
Constructors Summary
private XPathFilterCHGPContainer()
Constructor XPathFilterCHGPContainer


         
     

      // no instantiation
   
private XPathFilterCHGPContainer(Document doc, boolean includeSlashPolicy, String includeButSearch, String excludeButSearch, String exclude)
Constructor XPathFilterCHGPContainer

param
doc
param
includeSlashPolicy
param
includeButSearch
param
excludeButSearch
param
exclude


      super(doc);

      if (includeSlashPolicy) {
         this._constructionElement
            .setAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true");
      } else {
         this._constructionElement
            .setAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false");
      }

      if ((includeButSearch != null)
              && (includeButSearch.trim().length() > 0)) {
         Element includeButSearchElem =
            ElementProxy.createElementForFamily(doc, this.getBaseNamespace(),
                                        XPathFilterCHGPContainer
                                           ._TAG_INCLUDE_BUT_SEARCH);

         includeButSearchElem
            .appendChild(this._doc
               .createTextNode(indentXPathText(includeButSearch)));
         this._constructionElement.appendChild(doc.createTextNode("\n"));
         this._constructionElement.appendChild(includeButSearchElem);
      }

      if ((excludeButSearch != null)
              && (excludeButSearch.trim().length() > 0)) {
         Element excludeButSearchElem =
         ElementProxy.createElementForFamily(doc, this.getBaseNamespace(),
                                        XPathFilterCHGPContainer
                                           ._TAG_EXCLUDE_BUT_SEARCH);

         excludeButSearchElem
            .appendChild(this._doc
               .createTextNode(indentXPathText(excludeButSearch)));
         this._constructionElement.appendChild(doc.createTextNode("\n"));
         this._constructionElement.appendChild(excludeButSearchElem);
      }

      if ((exclude != null) && (exclude.trim().length() > 0)) {
         Element excludeElem = ElementProxy.createElementForFamily(doc,
                                  this.getBaseNamespace(),
                                  XPathFilterCHGPContainer._TAG_EXCLUDE);

         excludeElem
            .appendChild(this._doc.createTextNode(indentXPathText(exclude)));
         this._constructionElement.appendChild(doc.createTextNode("\n"));
         this._constructionElement.appendChild(excludeElem);
      }

      this._constructionElement.appendChild(doc.createTextNode("\n"));
   
private XPathFilterCHGPContainer(Element element, String BaseURI)
Constructor XPathFilterCHGPContainer

param
element
param
BaseURI
throws
XMLSecurityException

      super(element, BaseURI);
   
Methods Summary
public final java.lang.StringgetBaseLocalName()
Method getBaseLocalName

inheritDoc

      return XPathFilterCHGPContainer._TAG_XPATHCHGP;
   
public final java.lang.StringgetBaseNamespace()
Method getBaseNamespace

inheritDoc

      return Transforms.TRANSFORM_XPATHFILTERCHGP;
   
public java.lang.StringgetExclude()
Method getExclude

return
the string

      return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE);
   
public java.lang.StringgetExcludeButSearch()
Method getExcludeButSearch

return
the string

      return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
   
private org.w3c.dom.NodegetHereContextNode(java.lang.String type)
Returns the first Text node which contains information from the XPath Filter String. We must use this stupid hook to enable the here() function to work. $todo$ I dunno whether this crashes: here()/ds:Signature[1]

param
type
return
the first Text node which contains information from the XPath 2 Filter String


      if (this.length(this.getBaseNamespace(), type) != 1) {
         return null;
      }

      return XMLUtils.selectNodeText(this._constructionElement.getFirstChild(), this.getBaseNamespace(),
                         type,0);
   
public org.w3c.dom.NodegetHereContextNodeExclude()
Method getHereContextNodeExclude

return
the string

      return this.getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE);
   
public org.w3c.dom.NodegetHereContextNodeExcludeButSearch()
Method getHereContextNodeExcludeButSearch

return
the string

      return this
         .getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
   
public org.w3c.dom.NodegetHereContextNodeIncludeButSearch()
Method getHereContextNodeIncludeButSearch

return
the string

      return this
         .getHereContextNode(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
   
public java.lang.StringgetIncludeButSearch()
Method getIncludeButSearch

return
the string

      return this.getXStr(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
   
public booleangetIncludeSlashPolicy()
Method getIncludeSlashPolicy

return
the string


      return this._constructionElement
         .getAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH)
         .equals("true");
   
public static com.sun.org.apache.xml.internal.security.transforms.params.XPathFilterCHGPContainergetInstance(org.w3c.dom.Document doc, boolean includeSlashPolicy, java.lang.String includeButSearch, java.lang.String excludeButSearch, java.lang.String exclude)
Creates a new XPathFilterCHGPContainer; needed for generation.

param
doc
param
includeSlashPolicy
param
includeButSearch
param
excludeButSearch
param
exclude
return
the created object


      return new XPathFilterCHGPContainer(doc, includeSlashPolicy,
                                          includeButSearch, excludeButSearch,
                                          exclude);
   
public static com.sun.org.apache.xml.internal.security.transforms.params.XPathFilterCHGPContainergetInstance(org.w3c.dom.Element element, java.lang.String BaseURI)
Creates a XPathFilterCHGPContainer from an existing Element; needed for verification.

param
element
param
BaseURI
throws
XMLSecurityException
return
the created object.

      return new XPathFilterCHGPContainer(element, BaseURI);
   
private java.lang.StringgetXStr(java.lang.String type)
Method getXStr

param
type
return
The Xstr


      if (this.length(this.getBaseNamespace(), type) != 1) {
         return "";
      }

      Element xElem = XMLUtils.selectNode(this._constructionElement.getFirstChild(), this.getBaseNamespace(),
                         type,0);

      return XMLUtils.getFullTextChildrenFromElement(xElem);
   
static java.lang.StringindentXPathText(java.lang.String xp)
Method indentXPathText

param
xp
return
the string with enters


      if ((xp.length() > 2) && (!Character.isWhitespace(xp.charAt(0)))) {
         return "\n" + xp + "\n";
      } 
      return xp;