Package org.jaxen.pattern
Class Pattern
- java.lang.Object
-
- org.jaxen.pattern.Pattern
-
- Direct Known Subclasses:
LocationPathPattern
,NodeTest
,UnionPattern
public abstract class Pattern extends java.lang.Object
Pattern
defines the behaviour for pattern in the XSLT processing model.- Version:
- $Revision: 1134 $
- Author:
- James Strachan
-
-
Field Summary
Fields Modifier and Type Field Description static short
ANY_NODE
Matches any nodestatic short
ATTRIBUTE_NODE
Matches attribute nodesstatic short
CDATA_SECTION_NODE
Matches CDATA section nodesstatic short
COMMENT_NODE
Matches comment nodesstatic short
DOCUMENT_NODE
Matches document nodesstatic short
DOCUMENT_TYPE_NODE
Matches DocumentType nodesstatic short
ELEMENT_NODE
Matches Element nodesstatic short
ENTITY_REFERENCE_NODE
Matches entity reference nodesstatic short
MAX_NODE_TYPE
The maximum number of node types for sizing purposesstatic short
NAMESPACE_NODE
Matches a Namespace Nodestatic short
NO_NODE
Matches no nodesstatic short
PROCESSING_INSTRUCTION_NODE
Matches ProcessingInstructionstatic short
TEXT_NODE
Matches text nodesstatic short
UNKNOWN_NODE
Does not match any valid node
-
Constructor Summary
Constructors Constructor Description Pattern()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.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()
Returns the type of node the pattern matches.double
getPriority()
Returns the default resolution policy of the pattern according to the XSLT conflict resolution rules.abstract java.lang.String
getText()
Returns a textual representation of this patternPattern[]
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(java.lang.Object node, Context context)
Pattern
simplify()
-
-
-
Field Detail
-
ELEMENT_NODE
public static final short ELEMENT_NODE
Matches Element nodes- See Also:
- Constant Field Values
-
ATTRIBUTE_NODE
public static final short ATTRIBUTE_NODE
Matches attribute nodes- See Also:
- Constant Field Values
-
TEXT_NODE
public static final short TEXT_NODE
Matches text nodes- See Also:
- Constant Field Values
-
CDATA_SECTION_NODE
public static final short CDATA_SECTION_NODE
Matches CDATA section nodes- See Also:
- Constant Field Values
-
ENTITY_REFERENCE_NODE
public static final short ENTITY_REFERENCE_NODE
Matches entity reference nodes- See Also:
- Constant Field Values
-
PROCESSING_INSTRUCTION_NODE
public static final short PROCESSING_INSTRUCTION_NODE
Matches ProcessingInstruction- See Also:
- Constant Field Values
-
COMMENT_NODE
public static final short COMMENT_NODE
Matches comment nodes- See Also:
- Constant Field Values
-
DOCUMENT_NODE
public static final short DOCUMENT_NODE
Matches document nodes- See Also:
- Constant Field Values
-
DOCUMENT_TYPE_NODE
public static final short DOCUMENT_TYPE_NODE
Matches DocumentType nodes- See Also:
- Constant Field Values
-
NAMESPACE_NODE
public static final short NAMESPACE_NODE
Matches a Namespace Node- See Also:
- Constant Field Values
-
UNKNOWN_NODE
public static final short UNKNOWN_NODE
Does not match any valid node- See Also:
- Constant Field Values
-
MAX_NODE_TYPE
public static final short MAX_NODE_TYPE
The maximum number of node types for sizing purposes- See Also:
- Constant Field Values
-
ANY_NODE
public static final short ANY_NODE
Matches any node- See Also:
- Constant Field Values
-
NO_NODE
public static final short NO_NODE
Matches no nodes- See Also:
- Constant Field Values
-
-
Method Detail
-
matches
public abstract boolean matches(java.lang.Object node, Context context) throws JaxenException
- 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:
- Section 5.5 of the XSLT specification
-
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.- Returns:
ANY_NODE
unless overridden
-
getMatchesNodeName
public java.lang.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 java.lang.String getText()
Returns a textual representation of this pattern- Returns:
- the usual string form of this XSLT pattern
-
-