org.jaxen.pattern
Class Pattern

java.lang.Object
  |
  +--org.jaxen.pattern.Pattern
Direct Known Subclasses:
LocationPathPattern, NodeTest, UnionPattern

public abstract class Pattern
extends Object

Pattern defines the behaviour for pattern in the XSLT processing model.

Version:
$Revision: 1.4 $
Author:
James Strachan

Field Summary
static short ANY_NODE
          Matches any node
static short ATTRIBUTE_NODE
          Matches elements nodes
static short CDATA_SECTION_NODE
          Matches elements nodes
static short COMMENT_NODE
          Matches Comments nodes
static short DOCUMENT_NODE
          Matches Document nodes
static short DOCUMENT_TYPE_NODE
          Matches DocumentType nodes
static short ELEMENT_NODE
          Matches Element nodes
static short ENTITY_REFERENCE_NODE
          Matches elements nodes
static short MAX_NODE_TYPE
          The maximum number of node types for sizing purposes
static short NAMESPACE_NODE
          Matchs a Namespace Node - NOTE this differs from DOM
static short NO_NODE
          Matches no nodes
static short PROCESSING_INSTRUCTION_NODE
          Matches ProcessingInstruction
static short TEXT_NODE
          Matches elements nodes
static short UNKNOWN_NODE
          Does not match any valid node
 
Constructor Summary
Pattern()
           
 
Method Summary
 String getMatchesNodeName()
          For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches.
 short getMatchType()
           
 double getPriority()
          Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec.
abstract  String getText()
          Returns a textual representation of this pattern
 Pattern[] getUnionPatterns()
          If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern.
abstract  boolean matches(Object node, Context context)
           
 Pattern simplify()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_NODE

public static final short ELEMENT_NODE
Matches Element nodes

ATTRIBUTE_NODE

public static final short ATTRIBUTE_NODE
Matches elements nodes

TEXT_NODE

public static final short TEXT_NODE
Matches elements nodes

CDATA_SECTION_NODE

public static final short CDATA_SECTION_NODE
Matches elements nodes

ENTITY_REFERENCE_NODE

public static final short ENTITY_REFERENCE_NODE
Matches elements nodes

PROCESSING_INSTRUCTION_NODE

public static final short PROCESSING_INSTRUCTION_NODE
Matches ProcessingInstruction

COMMENT_NODE

public static final short COMMENT_NODE
Matches Comments nodes

DOCUMENT_NODE

public static final short DOCUMENT_NODE
Matches Document nodes

DOCUMENT_TYPE_NODE

public static final short DOCUMENT_TYPE_NODE
Matches DocumentType nodes

NAMESPACE_NODE

public static final short NAMESPACE_NODE
Matchs a Namespace Node - NOTE this differs from DOM

UNKNOWN_NODE

public static final short UNKNOWN_NODE
Does not match any valid node

MAX_NODE_TYPE

public static final short MAX_NODE_TYPE
The maximum number of node types for sizing purposes

ANY_NODE

public static final short ANY_NODE
Matches any node

NO_NODE

public static final short NO_NODE
Matches no nodes
Constructor Detail

Pattern

public Pattern()
Method Detail

matches

public abstract boolean matches(Object node,
                                Context context)
                         throws JaxenException
Returns:
true if the pattern matches the given node

getPriority

public double getPriority()
Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec.

getUnionPatterns

public Pattern[] getUnionPatterns()
If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern. Otherwise this method should return null.
Returns:
an array of the patterns which make up this union pattern or null if this pattern is not a union pattern

getMatchType

public short getMatchType()
Returns:
the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.

getMatchesNodeName

public String getMatchesNodeName()
For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches. This allows a more efficient rule matching algorithm to be performed, rather than a brute force approach of evaluating every pattern for a given Node.
Returns:
the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.

simplify

public Pattern simplify()

getText

public abstract String getText()
Returns a textual representation of this pattern


Copyright © 2002 bob mcwhirter & James Strachan. All Rights Reserved. Hosted by

SourceForge Logo