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

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

public class ElementNotSelector
extends ElementSelector

Subclass of ElementSelector that inverts selection decisions.


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
ElementNotSelector(ElementSelector invertedSelector)
          Select if selector says "no", don't select if selector says "yes".
 
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.
 int getEndMark(int startIndex)
           
 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.
 void reset()
           
 void setEndMark(java.lang.String path, int endIndex)
          Called by SAXDeleteFilter to mark end of processed element.
 boolean shouldSelectElement(int startIndex)
          Negates the contained Selector's decision.
 
Methods inherited from class com.raritantechnologies.xml.sax.filter.ElementSelector
initialize, selectElement, setSelecting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementNotSelector

public ElementNotSelector(ElementSelector invertedSelector)
Select if selector says "no", don't select if selector says "yes".

Parameters:
invertedSelector - ElementSelector whose decision we are inverting.
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)
Description copied from class: ElementSelector
Signals that the element could be selected. Uses contained ElementComparator to check if the element is deletable by this ElementSelector.

Overrides:
couldSelectElement in class ElementSelector

setEndMark

public void setEndMark(java.lang.String path,
                       int endIndex)
Description copied from class: ElementSelector
Called by SAXDeleteFilter to mark end of processed element. If the element is going to be selected, we need to save it because a new sibling element could come along.

Overrides:
setEndMark 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)
Negates the contained Selector's decision.

Overrides:
shouldSelectElement in class ElementSelector

getEndMark

public int getEndMark(int startIndex)
Overrides:
getEndMark in class ElementSelector

reset

public void reset()
Overrides:
reset in class ElementSelector