org.apache.cocoon.stax.navigation
Class InSubtreeNavigator

java.lang.Object
  extended by org.apache.cocoon.stax.navigation.InSubtreeNavigator
All Implemented Interfaces:
Navigator

public final class InSubtreeNavigator
extends Object
implements Navigator

This Navigator implementation returns as long true as long it is in an opened clause. The navigator starts the moment an XMLEvent is a StartElement and matches all Attributes and the name the Navigator is initialized with. The moment the corresponding EndElement is inserted the Navigator returns false. If the same element is contained nested more often the Navigator starts returning true the first element is inserted to the Navigator.fulfillsCriteria(XMLEvent) method till exactly this node is closed again with an EndElement.

  <anyElement> -> false
      <searchedElement> -> true
          <searchedElement> -> true
          <anyElement/> -> true
          </searchedElement> -> true
      </searchedElement> -> true
  </anyElement> -> false
 


Constructor Summary
InSubtreeNavigator(String name)
           
InSubtreeNavigator(String name, Attribute... attributes)
           
InSubtreeNavigator(String name, List<Attribute> attributes)
           
InSubtreeNavigator(String name, MatchingType matchingType, Attribute... attributes)
           
InSubtreeNavigator(String name, MatchingType matchingType, List<Attribute> attributes)
           
 
Method Summary
 boolean fulfillsCriteria(XMLEvent event)
          Depending on the XMLEvent it is returned if the navigator fulfills the criteria the Navigator is build for.
 MatchingType getMatchingType()
           
 boolean isActive()
          Every time the Navigator.fulfillsCriteria(XMLEvent) the value returned by this method is stored internally in the Navigator.
 void setMatchingType(MatchingType matchingType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InSubtreeNavigator

public InSubtreeNavigator(String name)

InSubtreeNavigator

public InSubtreeNavigator(String name,
                          List<Attribute> attributes)

InSubtreeNavigator

public InSubtreeNavigator(String name,
                          Attribute... attributes)

InSubtreeNavigator

public InSubtreeNavigator(String name,
                          MatchingType matchingType,
                          List<Attribute> attributes)

InSubtreeNavigator

public InSubtreeNavigator(String name,
                          MatchingType matchingType,
                          Attribute... attributes)
Method Detail

fulfillsCriteria

public boolean fulfillsCriteria(XMLEvent event)
Depending on the XMLEvent it is returned if the navigator fulfills the criteria the Navigator is build for.

Specified by:
fulfillsCriteria in interface Navigator
Parameters:
event - of the XML analyzed at the moment.
Returns:
if the XMLEvent full fills all criteria of the Navigator.
See Also:
Navigator.fulfillsCriteria(javax.xml.stream.events.XMLEvent)

isActive

public boolean isActive()
Every time the Navigator.fulfillsCriteria(XMLEvent) the value returned by this method is stored internally in the Navigator. As long as the Navigator.fulfillsCriteria(XMLEvent) method is not called again this method returns the last returned value of the Navigator.fulfillsCriteria(XMLEvent) method. As long the Navigator.fulfillsCriteria(XMLEvent) is not called false should be returned.

Specified by:
isActive in interface Navigator
Returns:
the actual value returned by the Navigator.fulfillsCriteria(XMLEvent) method.
See Also:
Navigator.isActive()

getMatchingType

public MatchingType getMatchingType()

setMatchingType

public void setMatchingType(MatchingType matchingType)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.