I just had another lenghty discussion with another developer trying to convey the
benefits of XPathNavigator usage.
It seems to me, that Infoset-based access to SQL Server data can only be done
using this:
-
Get DataSet
-
DataSet -> XmlDataDocument (constructor, which
takes DataSet, public
XmlDataDocument(DataSet))
-
XmlDataDocument -> XPathNavigator (XmlDataDocument.CreateNavigator)
One can also create an XmlNode instead of XPathNavigator,
but I prefer the XPath data model.
This seems a much more scalable solution than using "FOR
XML RAW/AUTO/EXPLICIT" and populating an XmlReader with SqlCommand.ExecuteXmlReader.
"FOR XML RAW/AUTO/EXPLICIT" is slow and requires an XML serialization/deserialization
pair.
It's bad/wrong/sloppy, when people do that between app
tiers.