XmlParserContext Constructor (XmlNameTable, XmlNamespaceManager, String, XmlSpace)

XmlParserContext Constructor (XmlNameTable, XmlNamespaceManager, String, XmlSpace)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public XmlParserContext(
	XmlNameTable nt,
	XmlNamespaceManager nsMgr,
	string xmlLang,
	XmlSpace xmlSpace
)

Parameters

nt
Type: System.Xml.XmlNameTable
The XmlNameTable to use to atomize strings. If this is null, the name table used to construct the nsMgr is used instead. For more information about atomized strings, see XmlNameTable.
nsMgr
Type: System.Xml.XmlNamespaceManager
The XmlNamespaceManager to use for looking up namespace information, or null.
xmlLang
Type: System.String
The xml:lang scope.
xmlSpace
Type: System.Xml.XmlSpace
An XmlSpace value indicating the xml:space scope.

ExceptionCondition
XmlException

nt is not the same XmlNameTable used to construct nsMgr.


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;
using (XmlReader reader = XmlReader.Create(new StringReader(xmlFrag), settings, context))
{
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft