Storing multiple XPath attributes in a list, using XPathMultiQuery

Last post 09-10-2018, 9:22 AM by cwsunderland. 1 replies.
Sort Posts: Previous Next
  • Storing multiple XPath attributes in a list, using XPathMultiQuery
    Posted: 09-05-2018, 10:00 AM

    Hi,

     

    I'm trying to store multiple values from a xpath query in a list.

     

    The initial request is the REST API call GET SUBCLIENT.

    http://documentation.commvault.com/commvault/v11/article?p=49144.htm

    The response from this query is (according to the API):

    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <App_GetSubClientPropertiesResponse>
      <subClientProperties>
        <subClientEntity _type_="SUBCLIENT_ENTITY" appName="File System" applicationId="33" backupsetId="3" backupsetName="defaultBackupSet" clientId="2" clientName="client001" instanceId="1" instanceName="DefaultInstanceName" subclientId="2" subclientName="default"/>
      </subClientProperties>
      <subClientProperties>
        <subClientEntity _type_="SUBCLIENT_ENTITY" appName="File System" applicationId="33" backupsetId="3" backupsetName="defaultBackupSet" clientId="2" clientName="client001" instanceId="1" instanceName="DefaultInstanceName" subclientId="2" subclientName="testsubclient"/>
      </subClientProperties>
    </App_GetSubClientPropertiesResponse>

    I'm trying to retrieve the subclientName attribute from all subClientEntity elements as a list.
    (So: "default","testsubclient")

    If I send this to a XPathQuery, using XPath:

    /App_GetSubClientPropertiesResponse/subClientProperties/subClientEntity/@subClientName

    , I get the right answer, but obviously only the first one. If I use XPathMultiPathQuery, I get an error "did not find any results for xpath query". But it is the exact same input, off course.

    How do I set up XPathMultiPathQuery? I've defined the following:

    Working XPathQuery:

    xml  xpath:{workflow/getSubclientProperties/output} String
    outputType String SimpleType
    outputAsList false boolean
    xpath  /App_GetSubClientPropertiesResponse/subClientProperties/subClientEntity/@subClientName String

    Failing XPathMultiQuery:

    xml xpath:{workflow/getSubclientProperties/output} String
    xpaths.outputName result String
    xpaths.xpath /App_GetSubClientPropertiesResponse/subClientProperties/subClientEntity/@subClientName String
    xpaths.outputType String SimpleType
    xpaths.outputAsList true Boolean

  • Re: Storing multiple XPath attributes in a list, using XPathMultiQuery
    Posted: 09-10-2018, 9:22 AM

    In your xpath statement here

    /App_GetSubClientPropertiesResponse/subClientProperties/subClientEntity/@subClientName

    Change the @subClientName to @subclientName

    XPath statements are case sensitivie and the xml response contains a lower case c here

    <subClientEntity _type_="SUBCLIENT_ENTITY" appName="File System" applicationId="33" backupsetId="3" backupsetName="defaultBackupSet" clientId="2" clientName="client001" instanceId="1" instanceName="DefaultInstanceName" subclientId="2" subclientName="default"/>

    Regards

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2019 Commvault | All Rights Reserved. | Legal | Privacy Policy