Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
londonstan
Starting Member
2 Posts |
Posted - 2009-11-18 : 16:48:16
|
If i have some xml in the form<root><a>hello</a><b> <bi>hiya</bi> <bii>hey</bii></b><c/><d>hello again</d></root>how can I a) count the nodes? i.e. a, b, bi, bii, c, d so 6b) count the nodes that are non empty a, bi, bii, d so 4?i have tried xmldata.query('count(/root/*)') ))but that only counts the top level nodes and I have no idea where to start with the non empty nodesany help will be very much appreciated |
|
londonstan
Starting Member
2 Posts |
Posted - 2009-12-06 : 05:46:04
|
even an idea on where to start would be great |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2009-12-07 : 05:09:33
|
a) count all the "<" & ">"...divide by 2 and discount the header/trailer pairing?b) count all the "><" sets ie empty nodessubtract b from a?? |
|
|
|
|
|