Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using namespace in XPath query in ASP.net 2

Status
Not open for further replies.

bananasbananas

IS-IT--Management
Apr 26, 2006
19
GB
I'm trying to use the following query :

//esd:ControlledList/esd:Item[@Id='1']

but it doesn't work.

I'm a noob in XML so it might be my query is wrong.

I've read I can use something like this:

//[local-name()='ControlledList' and namespace-uri=']/[local-name()='Item' and namespace-uri=' and @Id='1']

but it doesnt work.

What am i doing wrong?

My XML tree is as such:

<ControlledList>
<Item>
<Name>
</Item>
</ControlledList>
 
The first one formally is a valid xpath. The second is not (something is missing there). It depends where and how you defined the namespace. Maybe you should therefore ask instead in the .net forum so that you feel less reluctant in posting more specific setup.
We are not here to pass a test to in order to qualify in answering your questions. Besides, asp.net is asp.net and there is nothing more appropriate to ask there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top