com.raritech.xml.sax.filter
Class TagAttributesComparator

java.lang.Object
  |
  +--com.raritech.xml.sax.filter.TagAttributesComparator
All Implemented Interfaces:
ElementComparator

public class TagAttributesComparator
extends java.lang.Object
implements ElementComparator

Implementation of ElementComparator that matches on the tag Name and and a set of Attribute/Value pairs. "Remembers" the path at match time so that the ProgrammableSAXFilter can match start and end events.


Constructor Summary
TagAttributesComparator(java.lang.String tagName, java.lang.String qName, java.lang.String value)
          Convenience constructors...
TagAttributesComparator(java.lang.String tagName, java.lang.String qName1, java.lang.String value1, java.lang.String qName2, java.lang.String value2)
           
TagAttributesComparator(java.lang.String tagName, java.lang.String qName1, java.lang.String value1, java.lang.String qName2, java.lang.String value2, java.lang.String qName3, java.lang.String value3)
           
TagAttributesComparator(java.lang.String tagName, java.lang.String qName1, java.lang.String value1, java.lang.String qName2, java.lang.String value2, java.lang.String qName3, java.lang.String value3, java.lang.String qName4, java.lang.String value4)
           
 
Method Summary
 void addRequiredAttribute(java.lang.String qName, java.lang.String value)
           
 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)
          return false if tag name is incorrect, attribute is not present or if its value does not match.
 boolean needsData()
          Checks if this comparator needs to see the data section to make a decision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagAttributesComparator

public TagAttributesComparator(java.lang.String tagName,
                               java.lang.String qName,
                               java.lang.String value)
Convenience constructors...

TagAttributesComparator

public TagAttributesComparator(java.lang.String tagName,
                               java.lang.String qName1,
                               java.lang.String value1,
                               java.lang.String qName2,
                               java.lang.String value2)

TagAttributesComparator

public TagAttributesComparator(java.lang.String tagName,
                               java.lang.String qName1,
                               java.lang.String value1,
                               java.lang.String qName2,
                               java.lang.String value2,
                               java.lang.String qName3,
                               java.lang.String value3)

TagAttributesComparator

public TagAttributesComparator(java.lang.String tagName,
                               java.lang.String qName1,
                               java.lang.String value1,
                               java.lang.String qName2,
                               java.lang.String value2,
                               java.lang.String qName3,
                               java.lang.String value3,
                               java.lang.String qName4,
                               java.lang.String value4)
Method Detail

addRequiredAttribute

public void addRequiredAttribute(java.lang.String qName,
                                 java.lang.String value)

matchesTag

public boolean matchesTag(java.lang.String path,
                          org.xml.sax.Attributes atts)
return false if tag name is incorrect, attribute is not present or if its value does not match.
Specified by:
matchesTag in interface ElementComparator
Following copied from interface: com.raritech.xml.sax.filter.ElementComparator
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)
Description copied from interface: ElementComparator
Checks if the XML tag at the specified path matches the criteria of this comparator.
Specified by:
matchesPath in interface ElementComparator
Following copied from interface: com.raritech.xml.sax.filter.ElementComparator
Parameters:
path - XML path to the element.
Returns:
true if path matches criteria of this comparator, false otherwise.

needsData

public boolean needsData()
Description copied from interface: ElementComparator
Checks if this comparator needs to see the data section to make a decision.
Specified by:
needsData in interface ElementComparator
Following copied from interface: com.raritech.xml.sax.filter.ElementComparator
Returns:
true if this comparator requires character data to match, false otherwise.

matchesData

public boolean matchesData(char[] data,
                           int start,
                           int length)
Description copied from interface: ElementComparator
Checks if the character data matches the criteria of this comparator.
Specified by:
matchesData in interface ElementComparator
Following copied from interface: com.raritech.xml.sax.filter.ElementComparator
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.