XPath in XML with NameSpace

Post Reply
NEOSA
Member
Posts: 39
Joined: Thu Mar 10, 2016 6:31 pm

XPath in XML with NameSpace

Post 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
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: XPath in XML with NameSpace

Post 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"]
Attachments
Screen Shot 2019-06-26 at 14.42.55.png
Screen Shot 2019-06-26 at 14.42.55.png (254.2 KiB) Viewed 7583 times
mkayyyy
Member
Posts: 75
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: XPath in XML with NameSpace

Post by mkayyyy »

To get the Width attribute this XPath expression would work:

Code: Select all

//*[@N = 'Width']
NEOSA
Member
Posts: 39
Joined: Thu Mar 10, 2016 6:31 pm

Re: XPath in XML with NameSpace

Post 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 !
NEOSA
Member
Posts: 39
Joined: Thu Mar 10, 2016 6:31 pm

Re: XPath in XML with NameSpace

Post 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.
mkayyyy
Member
Posts: 75
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: XPath in XML with NameSpace

Post 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!
Post Reply