Service Virtualization

  • 1.  How to use XML XPath Filter / Assertion, when XML is having few text above and below.

    Posted May 09, 2017 10:24 PM

    I want to create a xml xPath filter for the below : XML Structure is getting displayed along with the filename. Is there any option available.

     

    Filename.log.gz:<Message Attribute1="Value1" Attribute2="Value2">
    <Message1 Attribute3="Value3" Attribute4="Value4" Attribute5="" Attribute6="Value6" Attribute7="Value7" Attribute8="Value8" Attribute9="Value9" Attribute10="Value10"/>
    </Message>



  • 2.  Re: How to use XML XPath Filter / Assertion, when XML is having few text above and below.

    Posted May 10, 2017 02:34 AM

    I think this is not Well form XML . To use xpath in filter to reach exact element/attribute values you can make text as root element like below. However not sure if that is something you can do..

    <Filename.log.gz:>

    <Message Attribute1="Value1" Attribute2="Value2">
    <Message1 Attribute3="Value3" Attribute4="Value4" Attribute5="" Attribute6="Value6" Attribute7="Value7" Attribute8="Value8" Attribute9="Value9" Attribute10="Value10"/>
    </Message>

    </Filename.log.gz:>

     

    Note: with below xpath any text in root will work fine. 

    For example xpath : //Message/Message1/@Attribute6  will return Attribute6="Value6"

     

    Let us know if this work for you!

     

    Thanks, 

    Rajesh k  Singh



  • 3.  Re: How to use XML XPath Filter / Assertion, when XML is having few text above and below.

    Posted May 10, 2017 05:48 AM

    Thanks Rajesh.

     

    I do agree its not well-formed xml. But i can't change the xml as you said above. Its output from one of my application.