XmlParserContext XmlParserContext XmlParserContext XmlParserContext Class

Definition

Provides all the context information required by the XmlReader to parse an XML fragment.

public ref class XmlParserContext
public class XmlParserContext
type XmlParserContext = class
Public Class XmlParserContext
Inheritance
XmlParserContextXmlParserContextXmlParserContextXmlParserContext

Examples

The following example creates an XmlReader object that reads an XML fragment.

string xmlFrag ="<item rk:ID='abc-23'>hammer</item> " +
                        "<item rk:ID='r2-435'>paint</item>" +
                        "<item rk:ID='abc-39'>saw</item>";

// Create the XmlNamespaceManager.
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
nsmgr.AddNamespace("rk", "urn:store-items");

// Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

// Create the reader. 
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
XmlReader reader = XmlReader.Create(new StringReader(xmlFrag), settings, context);

Dim xmlFrag As String = "<item rk:ID='abc-23'>hammer</item> " & _
                                     "<item rk:ID='r2-435'>paint</item>" & _
                                     "<item rk:ID='abc-39'>saw</item>"

' Create the XmlNamespaceManager.
Dim nt As New NameTable()
Dim nsmgr As New XmlNamespaceManager(nt)
nsmgr.AddNamespace("rk", "urn:store-items")

' Create the XmlParserContext.
Dim context As New XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)

' Create the reader. 
Dim settings As New XmlReaderSettings()
settings.ConformanceLevel = ConformanceLevel.Fragment
Dim reader As XmlReader = XmlReader.Create(New StringReader(xmlFrag), settings, context)

Constructors

XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace)

Initializes a new instance of the XmlParserContext class with the specified XmlNameTable, XmlNamespaceManager, base URI, xml:lang, xml:space, and document type values.

XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding)

Initializes a new instance of the XmlParserContext class with the specified XmlNameTable, XmlNamespaceManager, base URI, xml:lang, xml:space, encoding, and document type values.

XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace)

Initializes a new instance of the XmlParserContext class with the specified XmlNameTable, XmlNamespaceManager, xml:lang, and xml:space values.

XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding)

Initializes a new instance of the XmlParserContext class with the specified XmlNameTable, XmlNamespaceManager, xml:lang, xml:space, and encoding.

Properties

BaseURI BaseURI BaseURI BaseURI

Gets or sets the base URI.

DocTypeName DocTypeName DocTypeName DocTypeName

Gets or sets the name of the document type declaration.

Encoding Encoding Encoding Encoding

Gets or sets the encoding type.

InternalSubset InternalSubset InternalSubset InternalSubset

Gets or sets the internal DTD subset.

NamespaceManager NamespaceManager NamespaceManager NamespaceManager

Gets or sets the XmlNamespaceManager.

NameTable NameTable NameTable NameTable

Gets the XmlNameTable used to atomize strings. For more information on atomized strings, see XmlNameTable.

PublicId PublicId PublicId PublicId

Gets or sets the public identifier.

SystemId SystemId SystemId SystemId

Gets or sets the system identifier.

XmlLang XmlLang XmlLang XmlLang

Gets or sets the current xml:lang scope.

XmlSpace XmlSpace XmlSpace XmlSpace

Gets or sets the current xml:space scope.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to