org.apache.camel.support
Class TokenXMLExpressionIterator

java.lang.Object
  extended by org.apache.camel.support.ExpressionSupport
      extended by org.apache.camel.support.ExpressionAdapter
          extended by org.apache.camel.support.TokenXMLExpressionIterator
All Implemented Interfaces:
Expression, Predicate

public class TokenXMLExpressionIterator
extends ExpressionAdapter

Expression to walk a Message XML body using an Iterator, which grabs the content between a XML start and end token, where the end token corresponds implicitly to either the end tag or the self-closing start tag.

The message body must be able to convert to InputStream type which is used as stream to access the message body.

Can be used to split big XML files.

This implementation supports inheriting namespaces from a parent/root tag.


Field Summary
protected  String inheritNamespaceToken
           
protected  String tagToken
           
 
Constructor Summary
TokenXMLExpressionIterator(String tagToken, String inheritNamespaceToken)
           
 
Method Summary
protected  Iterator<?> createIterator(InputStream in, String charset)
           
protected  Object doEvaluate(Exchange exchange, boolean closeStream)
          Strategy to evaluate the exchange
 Object evaluate(Exchange exchange)
           
 boolean matches(Exchange exchange)
          Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate
 
Methods inherited from class org.apache.camel.support.ExpressionAdapter
assertionFailureMessage, evaluate
 
Methods inherited from class org.apache.camel.support.ExpressionSupport
assertMatches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagToken

protected final String tagToken

inheritNamespaceToken

protected final String inheritNamespaceToken
Constructor Detail

TokenXMLExpressionIterator

public TokenXMLExpressionIterator(String tagToken,
                                  String inheritNamespaceToken)
Method Detail

createIterator

protected Iterator<?> createIterator(InputStream in,
                                     String charset)

matches

public boolean matches(Exchange exchange)
Description copied from interface: Predicate
Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate

Specified by:
matches in interface Predicate
Overrides:
matches in class ExpressionSupport
Parameters:
exchange - the message exchange
Returns:
true if the predicate matches

evaluate

public Object evaluate(Exchange exchange)
Overrides:
evaluate in class ExpressionSupport

doEvaluate

protected Object doEvaluate(Exchange exchange,
                            boolean closeStream)
Strategy to evaluate the exchange

Parameters:
exchange - the exchange
closeStream - whether to close the stream before returning from this method.
Returns:
the evaluated value


Apache Camel