XMLTextReader - Find Max Depth
-
XMLTextReader has a depth property that returns the depth of the current node. Anyone know a way to determine the maximum depth? I guess I could read through the file first, but that doesn't seem very efficient.
Everything makes sense in someone's mind
-
XMLTextReader has a depth property that returns the depth of the current node. Anyone know a way to determine the maximum depth? I guess I could read through the file first, but that doesn't seem very efficient.
Everything makes sense in someone's mind
Until you read through the file, the XML reader wouldn't know anyway (even if, as another example, you used an
XPathNavigator
to search only leaf nodes). But a better question is why you need to find depth? Because to do so may be considered inefficient, maybe first you should determine if you really need to.This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog] [Follow on Twitter]
-
XMLTextReader has a depth property that returns the depth of the current node. Anyone know a way to determine the maximum depth? I guess I could read through the file first, but that doesn't seem very efficient.
Everything makes sense in someone's mind