public override XmlRawWriter StartTree(XPathNodeType rootType, IXmlNamespaceResolver nsResolver, XmlNameTable nameTable) {
// Build XPathDocument
// If rootType != XPathNodeType.Root, then build an XQuery fragment
this.doc = new XPathDocument(nameTable);
this.writer = doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames | (rootType == XPathNodeType.Root ? XPathDocument.LoadFlags.None : XPathDocument.LoadFlags.Fragment), string.Empty);
this.writer.NamespaceResolver = nsResolver;
return this.writer;
}