This constructor parses the given string as a fragment of XML. NET Framework 2.0, we recommend that you create XmlReader instances by using the XmlReader.Create method to take advantage of new functionality. If they exist, display the prefix andĬonsole.Write("", reader.Prefix, reader.LocalName)Ĭonsole.WriteLine(" The namespace URI is " + reader.NamespaceURI) If they exist, display the prefix andĬonsole.Write("", reader.Prefix, reader.LocalName) Ĭonsole.WriteLine(" The namespace URI is " + reader.NamespaceURI) ĭim nsmgr as XmlNamespaceManager = new XmlNamespaceManager(nt)ĭim context as XmlParserContext = new XmlParserContext(nothing, nsmgr, nothing, XmlSpace.None)ĭim reader as XmlTextReader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context) XmlTextReader reader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context) XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None) XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt) If they exist, display the prefix andĬonsole::WriteLine( "", reader->LocalName ) Ĭonsole::Write( "", reader->Prefix, reader->LocalName ) Ĭonsole::WriteLine( " The namespace URI is ", reader->NamespaceURI ) XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ) XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ) Nsmgr->AddNamespace( "bk", "urn:sample" ) XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ) String^ xmlFrag = " Pride And Prejudice novel " It uses the XmlParserContext and its XmlNamespaceManager to handle namespace resolution. The following example parses an XML fragment. Initializes a new instance of the XmlTextReader class with the specified TextReader and XmlNameTable. Initializes a new instance of the XmlTextReader class with the specified stream. Initializes a new instance of the XmlTextReader class with the specified TextReader. Initializes a new instance of the XmlTextReader class with the specified file. Initializes a new instance of the XmlTextReader class with the specified XmlNameTable. Initializes a new instance of the XmlTextReader class with the specified stream and XmlNameTable. Initializes a new instance of the XmlTextReader class with the specified file and XmlNameTable. Initializes a new instance of the XmlTextReader class with the specified URL and stream. Initializes a new instance of the XmlTextReader class with the specified URL and TextReader. Initializes a new instance of the XmlTextReader class with the specified stream, XmlNodeType, and XmlParserContext. XmlTextReader(Stream, XmlNodeType, XmlParserContext) Initializes a new instance of the XmlTextReader class with the specified URL, stream and XmlNameTable. XmlTextReader(String, Stream, XmlNameTable) Initializes a new instance of the XmlTextReader class with the specified URL, TextReader and XmlNameTable. XmlTextReader(String, TextReader, XmlNameTable) Initializes a new instance of the XmlTextReader class with the specified string, XmlNodeType, and XmlParserContext. XmlTextReader(String, XmlNodeType, XmlParserContext) Initializes a new instance of the XmlTextReader. In this article Overloads XmlTextReader()