Page 1 of 1

XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 2:20 pm
by NEOSA
Hi All,

I'm trying to find the right XPath value of a XML file (aatched to this topic). XML is from Quite Impose Plus.

I need to retrieve a couple of values, and at lesat "Height " "Width"

The following Xpath :

Code: Select all

//@N
give me the full list of items available, but I dind't find the right XPath to get the value of "Width"

I would prefer using the good XPath expression, instead of this (for the "Width" case) :

Code: Select all

/ns1:QUITEXML[1]/ns1:ITEMS[1]/ns1:DICT[1]/ns1:ITEMS[1]/ns1:DICT[2]/ns1:ITEMS[1]/ns1:DICT[1]/ns1:ITEMS[1]/ns1:F[2]
May some of you could help ?

Thanks a lot for all.

Quite XML file : https://my.pcloud.com/publink/show?code ... lUMJO539pk

Re: XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 2:46 pm
by Padawan
Is this the information you are trying to retrieve?
Image

It seems a bit odd since it is not a number, but "myWIDTH" which you get.

This is the Switch variable:
[Metadata.Text:Path="/dn:QUITEXML/dn:ITEMS/dn:DICT/dn:ITEMS/dn:DICT/dn:ITEMS/dn:DICT/dn:ITEMS/dn:F[@N='Width']",Dataset="Xml",Model="XML"]

Re: XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 2:53 pm
by mkayyyy
To get the Width attribute this XPath expression would work:

Code: Select all

//*[@N = 'Width']

Re: XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 3:01 pm
by NEOSA
Hi Padawan,

Thanks for your reply :-)

"myWIDTH" was just an example ;-) Real values are number (in pts);

By checking your expression, I found it can be replaced by a shorter version :

Code: Select all

//dn:F[@N='Width']
Thanks for helping !

Re: XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 3:13 pm
by NEOSA
mkayyyy wrote: Wed Jun 26, 2019 2:53 pm To get the Width attribute this XPath expression would work:

Code: Select all

//*[@N = 'Width']
You rock, you replied while I was writing my reply ;-)

Thanks a lot for help.

Re: XPath in XML with NameSpace

Posted: Wed Jun 26, 2019 3:57 pm
by mkayyyy
NEOSA wrote: Wed Jun 26, 2019 3:13 pm
mkayyyy wrote: Wed Jun 26, 2019 2:53 pm To get the Width attribute this XPath expression would work:

Code: Select all

//*[@N = 'Width']
You rock, you replied while I was writing my reply ;-)

Thanks a lot for help.
Haha :lol: no problem!