Evaluate XPath command

Got a problem you cannot solve? Try here.
Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Evaluate XPath command

Postby Frank » Wed Sep 16, 2015 10:24 am

I've got an XML like so (thank you W3schools :) ):

Code: Select all

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

<bookstore>

<book>
  <title lang="en">Harry Potter</title>
  <price>29.99</price>
</book>

<book>
  <title lang="en">Learning XML</title>
  <price>39.95</price>
</book>

</bookstore>


And I've got code like this:

Code: Select all

~InstallAware Clipboard Data~
~Evaluate XPath Query~
~{A280858C-6078-45D2-A0D1-348959A6AAC8}~
~"C:\hello.xml"~
~/~
~BLUT~
~0~


(which translates to)

Code: Select all

Evaluate Query / on XML "C:\hello.xml", get result into variable BLUT as type Full XML String


Running this I would expect the variable BLUT to contain the whole XML, but it returns empty.
I wanted to get a value deeper than root, but since that didn't work either (bookstore/book/price).
So I tried to get the whole thing, but even that doesn't work.

What am I doing wrong? :oops:

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Evaluate XPath command

Postby FrancescoT » Wed Sep 16, 2015 12:09 pm

Dear Frank,

you cannot use the "Evaluate XPath Query" command to get the Whole xml file content, If you need so, you may use the "Read from Text File" command instead.

For what concerns the "Evaluate XPath Query" command syntax, please have a look at the attached sample and to the following links.
http://www.installaware.com/forum/viewtopic.php?f=2&t=10051&hilit=+xml#p37774
http://www.installaware.com/forum/viewtopic.php?f=4&t=9456

Regards
Attachments
XPath.rar
(1.73 MiB) Downloaded 397 times
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Re: Evaluate XPath command

Postby Frank » Thu Sep 17, 2015 7:16 am

After some experiments I got it working.

It had to do with several (nasty :roll: ) oversights on my side.
First off I concatenated a filename to a filepath, leaving me with a folder like:
c:\program files (x86)\My Company\My Product\Configuration.xml\Configuration.xml which doesn't exist.

Next, the XPath query is case-sensitive!! That'll throw you off guard. I (now) know it's in the XPath specs, but mentioning this in the help would be appreciated!

Third, using the wrong Result Type: I needed Node Text, but requested Node Value. That'll never match ofcourse.

Anyway, it's working.
Thanks for the input (once again).

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Evaluate XPath command

Postby FrancescoT » Thu Sep 17, 2015 12:06 pm

:D
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 106 guests