Springboard Pillow
Paddling in the murky bits of the byte stream
Friday, June 18, 2010
Calculate XML Element Depth
In XPath (from the excellent D.Pawson site):
select="count(ancestor::*)"
http://www.dpawson.co.uk/xsl/sect2/N2193.html
In LINQ:
int depth = element.Ancestors().Count();
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment