Package org.dom4j.rule.pattern
Class NodeTypePattern
- java.lang.Object
-
- org.dom4j.rule.pattern.NodeTypePattern
-
- All Implemented Interfaces:
NodeFilter,Pattern
public class NodeTypePattern extends java.lang.Object implements Pattern
NodeTypePatternimplements a Pattern which matches any node of the given node type.
-
-
Field Summary
Fields Modifier and Type Field Description static NodeTypePatternANY_ATTRIBUTEA pattern which matches any Attribute nodestatic NodeTypePatternANY_COMMENTA pattern which matches any Comment nodestatic NodeTypePatternANY_DOCUMENTA pattern which matches any Document nodestatic NodeTypePatternANY_ELEMENTA pattern which matches any Element nodestatic NodeTypePatternANY_PROCESSING_INSTRUCTIONA pattern which matches any ProcessingInstruction nodestatic NodeTypePatternANY_TEXTA pattern which matches any Text node-
Fields inherited from interface org.dom4j.rule.Pattern
ANY_NODE, DEFAULT_PRIORITY, NONE, NUMBER_OF_TYPES
-
-
Constructor Summary
Constructors Constructor Description NodeTypePattern(short nodeType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetMatchesNodeName()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.shortgetMatchType()DOCUMENT ME!doublegetPriority()Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .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.booleanmatches(Node node)DOCUMENT ME!
-
-
-
Field Detail
-
ANY_ATTRIBUTE
public static final NodeTypePattern ANY_ATTRIBUTE
A pattern which matches any Attribute node
-
ANY_COMMENT
public static final NodeTypePattern ANY_COMMENT
A pattern which matches any Comment node
-
ANY_DOCUMENT
public static final NodeTypePattern ANY_DOCUMENT
A pattern which matches any Document node
-
ANY_ELEMENT
public static final NodeTypePattern ANY_ELEMENT
A pattern which matches any Element node
-
ANY_PROCESSING_INSTRUCTION
public static final NodeTypePattern ANY_PROCESSING_INSTRUCTION
A pattern which matches any ProcessingInstruction node
-
ANY_TEXT
public static final NodeTypePattern ANY_TEXT
A pattern which matches any Text node
-
-
Method Detail
-
matches
public boolean matches(Node node)
Description copied from interface:PatternDOCUMENT ME!- Specified by:
matchesin interfaceNodeFilter- Specified by:
matchesin interfacePattern- Parameters:
node- DOCUMENT ME!- Returns:
- true if the pattern matches the given DOM4J node.
-
getPriority
public double getPriority()
Description copied from interface:PatternReturns the default resolution policy of the pattern according to the XSLT conflict resolution spec .- Specified by:
getPriorityin interfacePattern- Returns:
- DOCUMENT ME!
-
getUnionPatterns
public Pattern[] getUnionPatterns()
Description copied from interface:PatternIf 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.- Specified by:
getUnionPatternsin interfacePattern- 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()
Description copied from interface:PatternDOCUMENT ME!- Specified by:
getMatchTypein interfacePattern- 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 java.lang.String getMatchesNodeName()
Description copied from interface:PatternFor 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.- Specified by:
getMatchesNodeNamein interfacePattern- Returns:
- the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.
-
-