com.raritech.xml.sax.filter
Interface ElementComparator

All Known Subinterfaces:
ElementReplacer
All Known Implementing Classes:
AnyElementComparator, ElementAndComparator, ElementModifier, ElementListComparator, ElementOrComparator, PathComparator, TagAttributeComparator, TagAttributesComparator, TagComparator, TagListComparator, XPathComparator

public interface ElementComparator

Base interface for element comparators: objects that can recognize an XML element based on its path name and/or by the attributes or data that it contains. Used by ProgrammableSAXFilter.


Method Summary
 boolean matchesData(char[] data, int start, int length)
          Checks if the character data matches the criteria of this comparator.
 boolean matchesPath(java.lang.String path)
          Checks if the XML tag at the specified path matches the criteria of this comparator.
 boolean matchesTag(java.lang.String path, org.xml.sax.Attributes atts)
          Checks if the XML tag at the specified path with given attribute list matches the criteria of this comparator.
 boolean needsData()
          Checks if this comparator needs to see the data section to make a decision.
 

Method Detail

matchesTag

public boolean matchesTag(java.lang.String path,
                          org.xml.sax.Attributes atts)
Checks if the XML tag at the specified path with given attribute list matches the criteria of this comparator.
Parameters:
path - XML path to the element.
atts - Attribute list of the element.
Returns:
true if parameters match criteria of this comparator, false otherwise.

matchesPath

public boolean matchesPath(java.lang.String path)
Checks if the XML tag at the specified path matches the criteria of this comparator.
Parameters:
path - XML path to the element.
Returns:
true if path matches criteria of this comparator, false otherwise.

needsData

public boolean needsData()
Checks if this comparator needs to see the data section to make a decision.
Returns:
true if this comparator requires character data to match, false otherwise.

matchesData

public boolean matchesData(char[] data,
                           int start,
                           int length)
Checks if the character data matches the criteria of this comparator.
Parameters:
data - source character array.
start - start position of source characters.
length - number of source characters.
Returns:
true if data matches criteria of this comparator, false otherwise.