Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all
In C# I want to do this:Find out if a node with "thisname" excists in doc1.Children or doc2.Children.
Is there a better, and more resource-friendly way of doing this, than just two foreach loops?
Thanks,Mathias
If the nodes are published, you could use umbraco.library.GetXmlNodeById or umbraco.library.GetAll and just run an XPath statement?
Matt
Or umbraco.library.GetXmlByXPath
Or that =)
You could try Hendy's Umbraco Helper class?
http://blog.hendyracher.co.uk/umbraco-helper-class/
There is a method for "GetChildNodeByName" ... or you can use XPath with one of the other methods? like "GetNodesFromXpath".
Cheers, Lee.
Sweet. I really need to start following Hendys blog.
Thanks all!
I now use GetXmlByXPath to serach for the node excistence:
XPathNodeIterator n = umbraco.library.GetXmlNodeByXPath("/root/node [@nodeName = 'Runway Homepage']/node [@nodeName = 'TheNode']");
Now, what is the best way to see if the node excists or not, fx. a trye/false output?
Thanks again,Mathias
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Search in Children
Hi all
In C# I want to do this:
Find out if a node with "thisname" excists in doc1.Children or doc2.Children.
Is there a better, and more resource-friendly way of doing this, than just two foreach loops?
Thanks,
Mathias
If the nodes are published, you could use umbraco.library.GetXmlNodeById or umbraco.library.GetAll and just run an XPath statement?
Matt
Or umbraco.library.GetXmlByXPath
Or that =)
You could try Hendy's Umbraco Helper class?
http://blog.hendyracher.co.uk/umbraco-helper-class/
There is a method for "GetChildNodeByName" ... or you can use XPath with one of the other methods? like "GetNodesFromXpath".
Cheers, Lee.
Sweet. I really need to start following Hendys blog.
Matt
Thanks all!
I now use GetXmlByXPath to serach for the node excistence:
Now, what is the best way to see if the node excists or not, fx. a trye/false output?
Thanks again,
Mathias
is working on a reply...