XmlParserContext-Klasse
Stellt sämtliche Kontextinformationen bereit, die von XmlReader für das Analysieren eines XML-Fragments benötigt werden.
Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)
Syntax
'Declaration
Public Class XmlParserContext
'Usage
Dim instance As XmlParserContext
public class XmlParserContext
public ref class XmlParserContext
public class XmlParserContext
public class XmlParserContext
Beispiel
Im folgenden Beispiel wird ein XmlReader-Objekt erstellt, das ein XML-Fragment liest.
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)
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);
Vererbungshierarchie
System.Object
System.Xml.XmlParserContext
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0