celso-- Posted March 4, 2011 Share Posted March 4, 2011 Hi there,I'm just trying to use XPath to work with an XML like the "Sample 1" below.I chose Edit Query and XPath as Query Language.I see on the right side my XML structure. I clicked the element <det> and chose "Set record node (generate XPath)". I was surprised seeing it didn't work. The output I received was "Selected nodes: 0".Then I just started playing with my XML file and I realized if I ommit the "xmlns" attribute at the "order" element it will read the 2 <det> nodes.I'm just wondering if anyone has a solution for it as the XML I will work with it won't be generated from my system. Anything I can work without having to change the XML would be a good solution for me. Thanks in advance.Code:Sample 1<?xml version="1.0" encoding="UTF-8"?><order xmlns="anything"> <det nItem="1"> <item> <code>0010</code> <desc>Desc 1</desc> </item> </det> <det nItem="2"> <item> <code>0011</code> <desc>Desc 2</desc> </item> </det></order> Link to comment Share on other sites More sharing options...
walmillard Posted March 7, 2011 Share Posted March 7, 2011 If you want to print all the <det> level data you would set your xpath to/order/det/detor ./order/det nItem is an attribute of <det>. so to inspect it you need to use @nItem eg ./oder/det[@nItem != null] luckW Post Edited by walmillard at 03/07/2011 23:02 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now