Skip to main content
Cadet | Tier 2
April 13, 2022
Question

Relative XML Path

  • April 13, 2022
  • 1 reply
  • 108 views

In the XML example below, what is the XML path in AA to get to a value like the price of the book 'Everyday Italian' without looping through the nodes.

 

I think in VBA something like this works:

//book[title/text()='Everyday Italian']/price

 

but that gives me an error in AA

 

'//DefaultNSPrefix:book[title/DefaultNSPrefix:text()='Everyday Italian']/DefaultNSPrefix:price' has an invalid token.

 

Example XML:

 

<?xml version="1.0" encoding="UTF-8"?>

 

<bookstore>

 

<book category="cooking">

  <title lang="en">Everyday Italian</title>

  <author>Giada De Laurentiis</author>

  <year>2005</year>

  <price>30.00</price>

</book>

 

<book category="children">

  <title lang="en">Harry Potter</title>

  <author>J K. Rowling</author>

  <year>2005</year>

  <price>29.99</price>

</book>

 

<book category="web">

  <title lang="en">XQuery Kick Start</title>

  <author>James McGovern</author>

  <author>Per Bothner</author>

  <author>Kurt Cagle</author>

  <author>James Linn</author>

  <author>Vaidyanathan Nagarajan</author>

  <year>2003</year>

  <price>49.99</price>

</book>

 

<book category="web">

  <title lang="en">Learning XML</title>

  <author>Erik T. Ray</author>

  <year>2003</year>

  <price>39.95</price>

</book>

 

</bookstore>

    1 reply

    Automation Anywhere Team
    June 11, 2022

    Hello @Marco DeConto​ 

     

    Thanks for writing us at the AA forum.

     

    You can leverage the below bot form BotStore for the use case mentioned

     

    https://botstore.automationanywhere.com/bot/extract-xpath-xml//p>

     

    For assistance through our Support Engineers, please reach us via Support case

     

    https://apeople.automationanywhere.com/s/article/How-to-create-a-support-case-in-service-cloud/p>

     

    You can also check our Live Chat support option, for quick assistance from our engineers

     

    https://apeople.automationanywhere.com/s/article/Live-Chat-Support-FAQs/p>

     

    You can also search for available documentation in

     

    https://docs.automationanywhere.com//p>

     

    For more details, you are welcome to leverage our open source portal where multiple use case is available

     

    https://botstore.automationanywhere.com//p>