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

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

public class ElementListSelector
extends ElementSelector

Subclass of ElementSelector that selects elements using a list of child ElementSelector. Can select if Any (OR) or All of its child selectors can select depending on its boolean setting. Used with the SAXDeleteFilter.


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
ElementListSelector()
           
ElementListSelector(boolean andLogic)
           
ElementListSelector(ElementSelector[] selectors, boolean andLogic)
          This contructor a set of ElementSelectors and a boolean for AND/OR
 
Method Summary
 void addSelector(ElementSelector selector)
           
 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)
          Give all child selectors a chance to look at it.
 void processCharacters(java.lang.String path, char[] ch, int start, int length)
          subclasses can override this to select based on contents of cData.
 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)
          subclasses can override this to select parent tag based on contents of child tags.
 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.
 boolean shouldSelectElement(int startIndex)
          This method is called by SAXDeleteFilter to determine if this ElementSelector has any Elements that start at the given index and that should be selected.
 
Methods inherited from class com.raritantechnologies.xml.sax.filter.ElementSelector
getEndMark, initialize, reset, selectElement, setEndMark, setSelecting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementListSelector

public ElementListSelector()

ElementListSelector

public ElementListSelector(boolean andLogic)

ElementListSelector

public ElementListSelector(ElementSelector[] selectors,
                           boolean andLogic)
This contructor a set of ElementSelectors and a boolean for AND/OR

Method Detail

addSelector

public void addSelector(ElementSelector selector)

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)
Give all child selectors a chance to look at it.

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)
Description copied from class: ElementSelector
subclasses can override this to select parent tag based on contents of child tags. using elementData.setSelecting( )

Overrides:
processChildElement in class ElementSelector

processCharacters

public void processCharacters(java.lang.String path,
                              char[] ch,
                              int start,
                              int length)
Description copied from class: ElementSelector
subclasses can override this to select based on contents of cData. using elementData.setSelecting( )

Overrides:
processCharacters in class ElementSelector

shouldSelectElement

public boolean shouldSelectElement(int startIndex)
This method is called by SAXDeleteFilter to determine if this ElementSelector has any Elements that start at the given index and that should be selected. Either: we have an element at this index that shouldn't be selected, should be selected or we don't have an element at this index.

Overrides:
shouldSelectElement in class ElementSelector