Kirk Evans is a Microsoft Architect for the Azure Center of Excellence.
Introduction to SharePoint and Azure IaaS
Building SharePoint Apps with Windows Azure Platform as a Service
SharePoint Solutions and Architectures on Windows Azure Infrastructure Services
Understanding Authentication and Permissions with Apps for SharePoint and Office
Daniel points out a way to read fragments with XmlTextReader, and mentions that I posed the problem.
I was working with some rather nasty “XML” that was not well-formed, and had to find a way to successfully parse it. The SgmlReader proved perfect for this, save for 1 outstanding problem: the XML did not contain a root node. SgmlReader will read the first node in a document until it encounters the closing element for the first node encountered. When this happens, it sets its internal state to EOF (End of File).
Using Daniel's approach, I could “trick” the SgmlReader to thinking that there was a root node for the document, and then parse the entire document as though it were well-formed.
FileStream fs = new XmlFragmentStream(“someBIGfile.xml“);
SgmlReader reader = new Sgml.SgmlReader();
reader.InputStream = new StreamReader(fs,System.Text.Encoding.UTF8);
reader.WhitespaceHandling = System.Xml.WhitespaceHandling.None;
object docNode = reader.NameTable.Add("DOCUMENT");
//Use the NameTable for reference comparison
if(reader.NodeType == XmlNodeType.Element)
if(docNode == reader.Name)