Skip to Content

XPATH Expression in General Splitter

Hi Experts,

I have the following XML

<root>
	<element>
		<url>https://www.google.com</url>
		<status>NOTOK</status>
	</element>
		<element>
		<url>https://www.facebook.com</url>
		<status>OK</status>
	</element>	
</root>

And I would like to use the following XPath Expression (/root/element[status/text() = 'OK']/url) in the General Splitter

However, I'm getting an error about the limitation of the XPath Expression.

I also tried using Header and Property from Content Modifier but I'm still getting the same problem.

Is there any workaround for this aside from the split in Message Mapping?

Thanks!

xpath.png (15.0 kB)
error.png (4.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 25, 2017 at 08:58 AM

    Hello Mark.

    You can leverage Content Filter in this case.

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25, 2017 at 12:32 PM

    Hello Mark,

    Rebuilding is very simple after Filter add Content Modifier something like below in Body since Filter removes only <root> element.

    <root>
    ${in.body}
    </root>

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 26, 2017 at 07:28 AM

    Hello Mark,

    I have also tried it its not removing element below are the details ( Could you please check your filter condition )

    Input XML:

    <root>
        <element>
            <url>https://test.com</url>
            <status>OK</status>
        </element>
        <element>
            <url>https://mail.test.com</url>
            <status>NOTOK</status>
        </element>
        <element>
            <url>https://tester.com</url>
            <status>OK</status>
        </element>
        <element>
            <url>https://eree.tr.com</url>
            <status>NOTOK</status>
        </element>
    </root>

    Filter Condition:

     /root/element[status/text()='OK']

    Content Modifier:

    <root>
    ${in.body}
    </root>

    Output:

    <root>
        <element>
            <url>https://test.com</url>
            <status>OK</status>
        </element>
        <element>
            <url>https://tester.com</url>
            <status>OK</status>
        </element>
    </root>

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded