Jan Lobau
Jan Lobau

Reputation: 221

Umbraco: how can i get a node by property value with uQuery?

Maybe someone can help, is it a way to combine an xPath expression to query node by it's property value?

I have a node with custom property "ItemId". I need something like this:

uQuery.GetNodesByXPath("//* [@itemId = '<someId>']")

Thanx in advance!

Upvotes: 0

Views: 2465

Answers (1)

JWiley
JWiley

Reputation: 3219

"//*" Will give you all nodes, so "//*[@itemId = '<someId>']" is asking to give you all nodes with an attribute equal to exactly "<someId>", which you can't have as a valid attribute.

So, if you have <myNode someId='my Id value'></myNode> , then try //*[@itemId='someId'] But remember, this will give you ANY node with that particular attribute ID.

I'm not sure if this is what you're looking for, but please post your XML or a snippet of what you're grabbing, as that will clear up any grey areas.

Upvotes: 1

Related Questions