Clarity

 View Only
  • 1.  Not able to traverse through XML

    Posted Jun 18, 2021 03:15 PM
    I am not able to traverse through an XML to get some value, can anyone help me understand where I might be wrong ?

    <?xml version="1.0" encoding="utf-8"?>
    <gel:script
    xmlns:core="jelly:core"
    xmlns:xog="http://www.niku.com/xog"
    xmlns:x="jelly:org.apache.commons.jelly.tags.xml.XMLTagLibrary"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:nikuq="http://www.niku.com/xog/Query"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <core:catch var="SuperException">

    <gel:parse var="runResult">

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
    <SessionID xmlns="http://www.niku.com/xog">14271238__EAF49D02-8C09-4883-8917-3E1D5619C65B</SessionID>
    <QueryResult xmlns="http://www.niku.com/xog/Query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Code>xyz_active_users</Code>
    <Records>
    <Record>
    <resource_name>Komawar, Gaurav</resource_name> </Record>
    </Records> <Slice> <Number>0</Number> <Size>1</Size> <Total>1</Total> </Slice> </QueryResult> </soapenv:Body>
    </soapenv:Envelope>

    </gel:parse>


    <gel:log>
    QUERY RESULT = <gel:expr select="$runResult"/>
    </gel:log>

    <gel:set asString="true" select="$runResult/soapenv:Envelope/soapenv:Body/QueryResult/Records/Record/resource_name[text()]" var="res_name"/>
    <gel:log> 1 ${res_name}</gel:log>


    <gel:set asString="true" select="$runResult/soapenv:Envelope/soapenv:Body/QueryResult/Records/Record/resource_name/text()" var="res_name"/>
    <gel:log> 2 ${res_name}</gel:log>


    </core:catch>
    <core:if test="${SuperException!=null}"><gel:log>Super Exception - ${SuperException}</gel:log></core:if>
    </gel:script>


  • 2.  RE: Not able to traverse through XML
    Best Answer

    Posted Jun 24, 2021 12:00 PM
    I figured out that xpath does not work for xml tags with properties so we need to remove the properties, it can be done using XSLT.


  • 3.  RE: Not able to traverse through XML

    Broadcom Employee
    Posted Jun 24, 2021 12:05 PM
    Some additional information on XPATH which we found few days back https://knowledge.broadcom.com/external/article/217490

    ------------------------------
    Thanks & Regards
    Suman Pramanik
    Sr. Principal Support Engineer | Customer Success & Support, Enterprise Software Division
    Broadcom
    ------------------------------