XmlReader.Create (TextReader, XmlReaderSettings, XmlParserContext)
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
string xmlFrag ="<item rk:ID='abc'>Java</item> " +
"<item rk:ID='5'>C#</item>" +
"<item rk:ID='9'>HTML</item>";
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
nsmgr.AddNamespace("rk", "urn:store-items");
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
XmlReader reader = XmlReader.Create(new StringReader(xmlFrag), settings, context);
}
}
Related examples in the same category