Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to query xml document with parameters like

parent element name - like search

attribute values - like search (attribute count around 4)

I have a xpath string for combination of attributes alone

here it is :

SQL
doc.SelectNodes("//*[contains(@jcr:mimeType,'tiff') and contains(@jcr:uuid ,'2e82b0df559f') and contains(@jcr:lastModified ,'2011-12-20T15:57:21.905-08:00')]", ns)


it outputs desired results.

But I am unable to get results for

Both element name with attributes

that is :

SQL
doc.SelectNodes("//*[contains(local-name(), 'hardwarestore_423x63') and contains(@jcr:mimeType,'tiff') and contains(@jcr:uuid ,'2e82b0df559f') and contains(@jcr:lastModified ,'2011-12-20T15:57:21.905-08:00')]", ns)


How to make a like search for combination of both element name and its child node attributes?
Each Parent element has nested child nodes.

Output should be a child under the nested childs of specified parent element.
any suggestion is greatly appreciated.

Thank you

Shabarinadh.vempati
Posted
Updated 18-Dec-13 23:52pm
v2
Comments
woopsydoozy 19-Dec-13 10:15am    
What you've got works fine for me--are you sure you're not missing a namespace on the parent element or something? Maybe provide a sample XML. I would recommend getting rid of the "contains" unless it's really necessary: //hardwarestore_423x63[@jcr:mimeType='tiff' and @jcr:uuid='2e82b0df559f' and @jcr:lastModified='2011-12-20T15:57:21.905-08:00']

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900