XmlParserContext 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供解析 XML 片段所需的 XmlReader 所有上下文資訊。
public ref class XmlParserContext
public class XmlParserContext
type XmlParserContext = class
Public Class XmlParserContext
- 繼承
-
XmlParserContext
範例
以下範例建立 XmlReader 一個讀取 XML 片段的物件。
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)
建構函式
| 名稱 | Description |
|---|---|
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) |
初始化類別的新實例 |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) |
初始化一個新的類別實例 |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) |
初始化類別的新實例 |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) |
初始化一個新的類別實例 |
屬性
| 名稱 | Description |
|---|---|
| BaseURI |
取得或設定基本的 URI。 |
| DocTypeName |
取得或設定文件類型宣告的名稱。 |
| Encoding |
取得或設定編碼類型。 |
| InternalSubset |
取得或設定內部DTD子集。 |
| NamespaceManager |
取得或設定 XmlNamespaceManager。 |
| NameTable |
用 XmlNameTable 來霧化弦。 關於原子弦的更多資訊,請參見 XmlNameTable。 |
| PublicId |
取得或設定公開識別碼。 |
| SystemId |
取得或設定系統識別碼。 |
| XmlLang |
取得或設定目前的 |
| XmlSpace |
取得或設定目前的 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |