Package org.jaxen.pattern
Class Pattern
java.lang.Object
org.jaxen.pattern.Pattern
- Direct Known Subclasses:
LocationPathPattern
,NodeTest
,UnionPattern
Pattern
defines the behaviour for pattern in
the XSLT processing model.
- Version:
- $Revision$
- Author:
- James Strachan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
Matches any nodestatic final short
Matches attribute nodesstatic final short
Matches CDATA section nodesstatic final short
Matches comment nodesstatic final short
Matches document nodesstatic final short
Matches DocumentType nodesstatic final short
Matches Element nodesstatic final short
Matches entity reference nodesstatic final short
The maximum number of node types for sizing purposesstatic final short
Matches a Namespace Nodestatic final short
Matches no nodesstatic final short
Matches ProcessingInstructionstatic final short
Matches text nodesstatic final short
Does not match any valid node -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFor 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
Returns the type of node the pattern matches.double
Returns the default resolution policy of the pattern according to the XSLT conflict resolution rules.abstract String
getText()
Returns a textual representation of this patternPattern[]
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
simplify()
-
Field Details
-
ELEMENT_NODE
public static final short ELEMENT_NODEMatches Element nodes- See Also:
-
ATTRIBUTE_NODE
public static final short ATTRIBUTE_NODEMatches attribute nodes- See Also:
-
TEXT_NODE
public static final short TEXT_NODEMatches text nodes- See Also:
-
CDATA_SECTION_NODE
public static final short CDATA_SECTION_NODEMatches CDATA section nodes- See Also:
-
ENTITY_REFERENCE_NODE
public static final short ENTITY_REFERENCE_NODEMatches entity reference nodes- See Also:
-
PROCESSING_INSTRUCTION_NODE
public static final short PROCESSING_INSTRUCTION_NODEMatches ProcessingInstruction- See Also:
-
COMMENT_NODE
public static final short COMMENT_NODEMatches comment nodes- See Also:
-
DOCUMENT_NODE
public static final short DOCUMENT_NODEMatches document nodes- See Also:
-
DOCUMENT_TYPE_NODE
public static final short DOCUMENT_TYPE_NODEMatches DocumentType nodes- See Also:
-
NAMESPACE_NODE
public static final short NAMESPACE_NODEMatches a Namespace Node- See Also:
-
UNKNOWN_NODE
public static final short UNKNOWN_NODEDoes not match any valid node- See Also:
-
MAX_NODE_TYPE
public static final short MAX_NODE_TYPEThe maximum number of node types for sizing purposes- See Also:
-
ANY_NODE
public static final short ANY_NODEMatches any node- See Also:
-
NO_NODE
public static final short NO_NODEMatches no nodes- See Also:
-
-
Constructor Details
-
Pattern
public Pattern()
-
-
Method Details
-
matches
- Parameters:
node
- ????context
- ????- Returns:
- true if the pattern matches the given node
- Throws:
JaxenException
- if ????
-
getPriority
public double getPriority()Returns the default resolution policy of the pattern according to the XSLT conflict resolution rules.- Returns:
- 0.5; the default priority defined in XSLT
- See Also:
-
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.- Returns:
ANY_NODE
unless overridden
-
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
-
getText
Returns a textual representation of this pattern- Returns:
- the usual string form of this XSLT pattern
-