Top Description Fields Constructors Methods
org.dom4j.rule.pattern

public Class NodeTypePattern

extends Object
implements Pattern
Class Inheritance
All Implemented Interfaces
org.dom4j.rule.Pattern, org.dom4j.NodeFilter
Imports
org.dom4j.Node, org.dom4j.rule.Pattern

NodeTypePattern implements a Pattern which matches any node of the given node type.

Author
James Strachan
Version
$Revision: 1.7 $

Field Summary

Modifier and TypeField and Description
public static final NodeTypePattern
ANY_ATTRIBUTE

A pattern which matches any Attribute node

public static final NodeTypePattern
ANY_COMMENT

A pattern which matches any Comment node

public static final NodeTypePattern
ANY_DOCUMENT

A pattern which matches any Document node

public static final NodeTypePattern
ANY_ELEMENT

A pattern which matches any Element node

public static final NodeTypePattern
ANY_PROCESSING_INSTRUCTION

A pattern which matches any ProcessingInstruction node

public static final NodeTypePattern
ANY_TEXT

A pattern which matches any Text node

private short

Constructor Summary

AccessConstructor and Description
public
NodeTypePattern(short nodeType)

Method Summary

Modifier and TypeMethod and Description
public String
getMatchesNodeName()

Implements org.dom4j.rule.Pattern.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.
public short
public double
getPriority()

Implements org.dom4j.rule.Pattern.getPriority.

Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .
public Pattern[]
getUnionPatterns()

Implements org.dom4j.rule.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.
public boolean
matches(Node
DOCUMENT ME!
node
)

Implements org.dom4j.rule.Pattern.matches.

DOCUMENT ME!
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ANY_ATTRIBUTEback to summary
public static final NodeTypePattern ANY_ATTRIBUTE

A pattern which matches any Attribute node

ANY_COMMENTback to summary
public static final NodeTypePattern ANY_COMMENT

A pattern which matches any Comment node

ANY_DOCUMENTback to summary
public static final NodeTypePattern ANY_DOCUMENT

A pattern which matches any Document node

ANY_ELEMENTback to summary
public static final NodeTypePattern ANY_ELEMENT

A pattern which matches any Element node

ANY_PROCESSING_INSTRUCTIONback to summary
public static final NodeTypePattern ANY_PROCESSING_INSTRUCTION

A pattern which matches any ProcessingInstruction node

ANY_TEXTback to summary
public static final NodeTypePattern ANY_TEXT

A pattern which matches any Text node

nodeTypeback to summary
private short nodeType

Constructor Detail

NodeTypePatternback to summary
public NodeTypePattern(short nodeType)

Method Detail

getMatchesNodeNameback to summary
public String getMatchesNodeName()

Implements org.dom4j.rule.Pattern.getMatchesNodeName.

Doc from org.dom4j.rule.Pattern.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:String

the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.

getMatchTypeback to summary
public short getMatchType()

Implements org.dom4j.rule.Pattern.getMatchType.

Doc from org.dom4j.rule.Pattern.getMatchType.

DOCUMENT ME!

Returns:short

the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.

getPriorityback to summary
public double getPriority()

Implements org.dom4j.rule.Pattern.getPriority.

Doc from org.dom4j.rule.Pattern.getPriority.

Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .

Returns:double

DOCUMENT ME!

getUnionPatternsback to summary
public Pattern[] getUnionPatterns()

Implements org.dom4j.rule.Pattern.getUnionPatterns.

Doc from org.dom4j.rule.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:Pattern[]

an array of the patterns which make up this union pattern or null if this pattern is not a union pattern

matchesback to summary
public boolean matches(Node node)

Implements org.dom4j.rule.Pattern.matches.

Doc from org.dom4j.rule.Pattern.matches.

DOCUMENT ME!

Parameters
node:Node

DOCUMENT ME!

Returns:boolean

true if the pattern matches the given DOM4J node.