XmlParserContext Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Fornece toda a informação de contexto necessária para XmlReader analisar um fragmento XML.
public ref class XmlParserContext
public class XmlParserContext
type XmlParserContext = class
Public Class XmlParserContext
- Herança
-
XmlParserContext
Exemplos
O exemplo seguinte cria um XmlReader objeto que lê um fragmento 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)
Construtores
| Name | Description |
|---|---|
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) |
Inicializa uma nova instância da |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) |
Inicializa uma nova instância da |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) |
Inicializa uma nova instância da |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) |
Inicializa uma nova instância da |
Propriedades
| Name | Description |
|---|---|
| BaseURI |
Obtém ou define o URI base. |
| DocTypeName |
Recebe ou define o nome da declaração do tipo de documento. |
| Encoding |
Obtém ou define o tipo de codificação. |
| InternalSubset |
Obtém ou define o subconjunto interno do DTD. |
| NamespaceManager |
Obtém ou define o XmlNamespaceManager. |
| NameTable |
É XmlNameTable usado para atomizar cordas. Para mais informações sobre cordas atomizadas, veja XmlNameTable. |
| PublicId |
Obtém ou define o identificador público. |
| SystemId |
Obtém ou define o identificador do sistema. |
| XmlLang |
Obtém ou definem o âmbito atual |
| XmlSpace |
Obtém ou definem o âmbito atual |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |