srikanthmm Posted April 3, 2007 Share Posted April 3, 2007 Hello, I have the following xml <XMLDataPersistence> <Duration>30</Duration> <HistoryFields> <Id> <Mandatory>True</Mandatory> <Modifiable>True</Modifiable> <Type>Text</Type> </Id> </HistoryFields></XMLDataPersistence> I am able to query upon duration as selectNodes("//XMLDataPersistence[Duration=30]") which gives coresponding XMLDataPersistence node. But similarly if I try to query selectNodes("//XMLDataPersistence/HistoryFields/Id[Mandatory=True]") does not return anything. But selectNodes("//XMLDataPersistence/HistoryFields/Id") or selectNodes("//XMLDataPersistence/HistoryFields/Id/Mandatory") returns respective nodes. I can then compare each mandatory node's text but ideally I would like the search do it for me.I even tried to get the HistoryFields nodes and do selectNodes("//Id[Mandatory=True]"); - no luck - returns nothing.Any help will be much appreciated. Link to comment Share on other sites More sharing options...
aalbetski Posted April 4, 2007 Share Posted April 4, 2007 I added single quotes around true, seems to work <html><xml id="Activities"> <XMLDataPersistence> <Duration>30</Duration> <HistoryFields> <Id> <Mandatory>True</Mandatory> <Modifiable>True</Modifiable> <Type>Text</Type> </Id> </HistoryFields> </XMLDataPersistence></xml><script> var oNode = Activities.selectSingleNode("//XMLDataPersistence[Duration=30]") document.write(oNode.xml) document.write("<br>") oNode = Activities.selectSingleNode("//XMLDataPersistence/HistoryFields/Id[Mandatory='True']") document.write(oNode.xml)</script></html> Link to comment Share on other sites More sharing options...
srikanthmm Posted April 5, 2007 Author Share Posted April 5, 2007 Indeed!!!! Thanks a lot for your help. 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