Class TokenXMLExpressionIterator

  • All Implemented Interfaces:
    org.apache.camel.Expression, org.apache.camel.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 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​(org.apache.camel.Exchange exchange,
                                             InputStream in,
                                             String charset)
      • matches

        public boolean matches​(org.apache.camel.Exchange exchange)
        Specified by:
        matches in interface org.apache.camel.Predicate
        Overrides:
        matches in class ExpressionSupport
      • doEvaluate

        protected Object doEvaluate​(org.apache.camel.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