com.raritantechnologies.xml.sax.filter.selectors
Class DecendantElementSelector

java.lang.Object
  extended bycom.raritantechnologies.xml.sax.filter.ElementSelector
      extended bycom.raritantechnologies.xml.sax.filter.selectors.DecendantElementSelector

public class DecendantElementSelector
extends ElementSelector

This class can be used to cause the selection of an decendant tag, based on its properties AND the properties of an ancestor. Used in conjunction with the SAXDeleteFilter. It overrides the protected processChildElement( ) method to achieve its functionality. This method allows a parent element to be marked for selection by the SAXDeleteFilter. The selector can work either on the decendant tag or on its character data.
Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Nested Class Summary
 
Nested classes inherited from class com.raritantechnologies.xml.sax.filter.ElementSelector
ElementSelector.ElementData
 
Constructor Summary
DecendantElementSelector(ElementComparator ancestorComp, ElementComparator decendantComp)
          Constructor: takes a childComp that is used to match decendent Tags that should cause the selection of the decendant.
DecendantElementSelector(ElementComparator ancestorComp, ElementComparator decendantComp, CDataComparator ancestorDataComp, CDataComparator decendantDataComp)
          Overloaded version of the constructor that allows a tag to be selected if a decendant tag's character data matches the criteria specified in the CDataComparator.
 
Method Summary
 boolean couldSelectElement(java.lang.String path, int startIndex, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Signals that the element could be selected.
 void processCharacters(java.lang.String path, char[] ch, int start, int length)
          processes character data if decendant data comparator is set.
 void processChildElement(java.lang.String childPath, ElementSelector.ElementData parentElement, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
          sets the Element at path to be selected if the element comparator matches input.
 void processChildElement(java.lang.String childPath, int startedAt, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
          This method is used to determine if the presence of a certain child tag should cause the parent (or ancestor tag) to be selected too.
 
Methods inherited from class com.raritantechnologies.xml.sax.filter.ElementSelector
getEndMark, initialize, reset, selectElement, setEndMark, setSelecting, shouldSelectElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecendantElementSelector

public DecendantElementSelector(ElementComparator ancestorComp,
                                ElementComparator decendantComp)
Constructor: takes a childComp that is used to match decendent Tags that should cause the selection of the decendant.

Parameters:
ancestorComp - element comparator used to identify the tag that signals if a decendant tag can be selected.
decendantComp - element comparator used to identity decendant tag that can be selected. Selection will occur if a decendant tag matches the criteria of this element comparator.

DecendantElementSelector

public DecendantElementSelector(ElementComparator ancestorComp,
                                ElementComparator decendantComp,
                                CDataComparator ancestorDataComp,
                                CDataComparator decendantDataComp)
Overloaded version of the constructor that allows a tag to be selected if a decendant tag's character data matches the criteria specified in the CDataComparator.

Parameters:
ancestorComp - element comparator used to identify the tag that signals if a decendant tag can be selected.
decendantComp - element comparator used to identity decendant tag that can be selected. In this case, the selection is deferred to analysis of the character data section of the tag.
Method Detail

couldSelectElement

public boolean couldSelectElement(java.lang.String path,
                                  int startIndex,
                                  java.lang.String uri,
                                  java.lang.String localName,
                                  java.lang.String qName,
                                  org.xml.sax.Attributes attrs)
Signals that the element could be selected. Uses contained ElementComparator to check if the element is selectable by this ElementSelector.

Overrides:
couldSelectElement in class ElementSelector

processChildElement

public void processChildElement(java.lang.String childPath,
                                int startedAt,
                                java.lang.String uri,
                                java.lang.String localName,
                                java.lang.String qName,
                                org.xml.sax.Attributes attrs)
Description copied from class: ElementSelector
This method is used to determine if the presence of a certain child tag should cause the parent (or ancestor tag) to be selected too.

Overrides:
processChildElement in class ElementSelector

processChildElement

public void processChildElement(java.lang.String childPath,
                                ElementSelector.ElementData parentElement,
                                java.lang.String uri,
                                java.lang.String localName,
                                java.lang.String qName,
                                org.xml.sax.Attributes attrs)
sets the Element at path to be selected if the element comparator matches input.

Overrides:
processChildElement in class ElementSelector

processCharacters

public void processCharacters(java.lang.String path,
                              char[] ch,
                              int start,
                              int length)
processes character data if decendant data comparator is set.

Overrides:
processCharacters in class ElementSelector