XmlParserContext 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 값을 사용하여 클래스의 XmlParserContext 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace) |
지정된 , |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding) |
지정된 |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace) |
지정된 |
| XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding) |
지정된 |
XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace)
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
지정된 , XmlParserContextXmlNameTableXmlNamespaceManager 및 값을 사용하여 클래스의 xml:lang 새 인스턴스를 xml:space초기화합니다.
public:
XmlParserContext(System::Xml::XmlNameTable ^ nt, System::Xml::XmlNamespaceManager ^ nsMgr, System::String ^ xmlLang, System::Xml::XmlSpace xmlSpace);
public XmlParserContext(System.Xml.XmlNameTable nt, System.Xml.XmlNamespaceManager nsMgr, string xmlLang, System.Xml.XmlSpace xmlSpace);
public XmlParserContext(System.Xml.XmlNameTable? nt, System.Xml.XmlNamespaceManager? nsMgr, string? xmlLang, System.Xml.XmlSpace xmlSpace);
new System.Xml.XmlParserContext : System.Xml.XmlNameTable * System.Xml.XmlNamespaceManager * string * System.Xml.XmlSpace -> System.Xml.XmlParserContext
Public Sub New (nt As XmlNameTable, nsMgr As XmlNamespaceManager, xmlLang As String, xmlSpace As XmlSpace)
매개 변수
- nt
- XmlNameTable
XmlNameTable 문자열을 원자화하는 데 사용할 값입니다. 이 null경우 생성 nsMgr 에 사용되는 이름 테이블이 대신 사용됩니다. 원자화된 문자열에 대한 자세한 내용은 다음을 참조하세요 XmlNameTable.
- nsMgr
- XmlNamespaceManager
네임스페이 XmlNamespaceManager 스 정보를 null조회하는 데 사용할 또는 .
- xmlLang
- String
범위입니다 xml:lang .
예외
nt은 생성XmlNameTable에 사용되는 것과 동일 nsMgr 하지 않습니다.
예제
다음 예제에서는 XML 조각을 읽습니다. 및 해당 네임스페이 XmlParserContextXmlNamespaceManager 스를 사용하여 네임스페이스 일치를 처리합니다.
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlTextReader reader = null;
try
{
//Create the XML fragment to be parsed.
string xmlFrag = "<book> " +
"<title>Pride And Prejudice</title>" +
"<bk:genre>novel</bk:genre>" +
"</book>";
//Create the XmlNamespaceManager that is used to
//look up namespace information.
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
nsmgr.AddNamespace("bk", "urn:sample");
//Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
//Implement the reader.
reader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context);
//Parse the XML fragment. If they exist, display the
//prefix and namespace URI of each element.
while (reader.Read())
{
if (reader.IsStartElement())
{
if (string.IsNullOrEmpty(reader.Prefix))
{
Console.WriteLine("<{0}>", reader.LocalName);
}
else
{
Console.Write("<{0}:{1}>", reader.Prefix, reader.LocalName);
Console.WriteLine(" The namespace URI is " + reader.NamespaceURI);
}
}
}
}
finally
{
if (reader != null)
reader.Close();
}
}
} // End class
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim reader As XmlTextReader = Nothing
Try
'Create the XML fragment to be parsed.
Dim xmlFrag As String = "<book> " & _
"<title>Pride And Prejudice</title>" & _
"<bk:genre>novel</bk:genre>" & _
"</book>"
'Create the XmlNamespaceManager that is used to
'look up namespace information.
Dim nt As New NameTable()
Dim nsmgr As New XmlNamespaceManager(nt)
nsmgr.AddNamespace("bk", "urn:sample")
'Create the XmlParserContext.
Dim context As New XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
'Implement the reader.
reader = New XmlTextReader(xmlFrag, XmlNodeType.Element, context)
'Parse the XML fragment. If they exist, display the
'prefix and namespace URI of each element.
While reader.Read()
If reader.IsStartElement() Then
If reader.Prefix = String.Empty Then
Console.WriteLine("<{0}>", reader.LocalName)
Else
Console.Write("<{0}:{1}>", reader.Prefix, reader.LocalName)
Console.WriteLine(" The namespace URI is " & reader.NamespaceURI)
End If
End If
End While
Finally
If Not (reader Is Nothing) Then
reader.Close()
End If
End Try
End Sub
End Class
적용 대상
XmlParserContext(XmlNameTable, XmlNamespaceManager, String, XmlSpace, Encoding)
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
지정된 XmlParserContext, XmlNameTable, XmlNamespaceManagerxml:lang및 인코딩을 xml:space 사용하여 클래스의 새 인스턴스를 초기화합니다.
public:
XmlParserContext(System::Xml::XmlNameTable ^ nt, System::Xml::XmlNamespaceManager ^ nsMgr, System::String ^ xmlLang, System::Xml::XmlSpace xmlSpace, System::Text::Encoding ^ enc);
public XmlParserContext(System.Xml.XmlNameTable nt, System.Xml.XmlNamespaceManager nsMgr, string xmlLang, System.Xml.XmlSpace xmlSpace, System.Text.Encoding enc);
public XmlParserContext(System.Xml.XmlNameTable? nt, System.Xml.XmlNamespaceManager? nsMgr, string? xmlLang, System.Xml.XmlSpace xmlSpace, System.Text.Encoding? enc);
new System.Xml.XmlParserContext : System.Xml.XmlNameTable * System.Xml.XmlNamespaceManager * string * System.Xml.XmlSpace * System.Text.Encoding -> System.Xml.XmlParserContext
Public Sub New (nt As XmlNameTable, nsMgr As XmlNamespaceManager, xmlLang As String, xmlSpace As XmlSpace, enc As Encoding)
매개 변수
- nt
- XmlNameTable
XmlNameTable 문자열을 원자화하는 데 사용할 값입니다. 이 null경우 생성 nsMgr 에 사용되는 이름 테이블이 대신 사용됩니다. 원자화된 문자열에 대한 자세한 내용은 다음을 참조하세요 XmlNameTable.
- nsMgr
- XmlNamespaceManager
네임스페이 XmlNamespaceManager 스 정보를 null조회하는 데 사용할 또는 .
- xmlLang
- String
범위입니다 xml:lang .
예외
nt은 생성XmlNameTable에 사용되는 것과 동일 nsMgr 하지 않습니다.
적용 대상
XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace)
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
지정된 XmlParserContext, 기본 URI, XmlNameTableXmlNamespaceManager문서 형식 값을 사용하여 클래스의 xml:lang 새 인스턴스를 초기화xml:space합니다.
public:
XmlParserContext(System::Xml::XmlNameTable ^ nt, System::Xml::XmlNamespaceManager ^ nsMgr, System::String ^ docTypeName, System::String ^ pubId, System::String ^ sysId, System::String ^ internalSubset, System::String ^ baseURI, System::String ^ xmlLang, System::Xml::XmlSpace xmlSpace);
public XmlParserContext(System.Xml.XmlNameTable nt, System.Xml.XmlNamespaceManager nsMgr, string docTypeName, string pubId, string sysId, string internalSubset, string baseURI, string xmlLang, System.Xml.XmlSpace xmlSpace);
public XmlParserContext(System.Xml.XmlNameTable? nt, System.Xml.XmlNamespaceManager? nsMgr, string? docTypeName, string? pubId, string? sysId, string? internalSubset, string? baseURI, string? xmlLang, System.Xml.XmlSpace xmlSpace);
new System.Xml.XmlParserContext : System.Xml.XmlNameTable * System.Xml.XmlNamespaceManager * string * string * string * string * string * string * System.Xml.XmlSpace -> System.Xml.XmlParserContext
Public Sub New (nt As XmlNameTable, nsMgr As XmlNamespaceManager, docTypeName As String, pubId As String, sysId As String, internalSubset As String, baseURI As String, xmlLang As String, xmlSpace As XmlSpace)
매개 변수
- nt
- XmlNameTable
XmlNameTable 문자열을 원자화하는 데 사용할 값입니다. 이 null경우 생성 nsMgr 에 사용되는 이름 테이블이 대신 사용됩니다. 원자화된 문자열에 대한 자세한 내용은 다음을 참조하세요 XmlNameTable.
- nsMgr
- XmlNamespaceManager
네임스페이 XmlNamespaceManager 스 정보를 null조회하는 데 사용할 또는 .
- docTypeName
- String
문서 형식 선언의 이름입니다.
- pubId
- String
공용 식별자입니다.
- sysId
- String
시스템 식별자입니다.
- internalSubset
- String
내부 DTD 하위 집합입니다. DTD 하위 집합은 문서 유효성 검사가 아닌 엔터티 확인에 사용됩니다.
- baseURI
- String
XML 조각의 기본 URI(조각이 로드된 위치)입니다.
- xmlLang
- String
범위입니다 xml:lang .
예외
nt은 생성XmlNameTable에 사용되는 것과 동일 nsMgr 하지 않습니다.
예제
다음 예제에서는 XML 조각을 읽는 데 사용합니다 XmlParserContext .
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlTextReader reader = null;
try
{
//Create the XML fragment to be parsed.
string xmlFrag = "<book genre='novel' misc='sale-item &h;'></book>";
//Create the XmlParserContext. The XmlParserContext provides the
//necessary DTD information so that the entity reference can be expanded.
XmlParserContext context;
string subset = "<!ENTITY h 'hardcover'>";
context = new XmlParserContext(null, null, "book", null, null, subset, "", "", XmlSpace.None);
//Create the reader.
reader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context);
//Read the all the attributes on the book element.
reader.MoveToContent();
while (reader.MoveToNextAttribute())
{
Console.WriteLine("{0} = {1}", reader.Name, reader.Value);
}
}
finally
{
if (reader != null)
reader.Close();
}
}
} // End class
Option Explicit On
Option Strict On
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim reader As XmlTextReader = Nothing
Try
'Create the XML fragment to be parsed.
Dim xmlFrag As String = "<book genre='novel' misc='sale-item &h;'></book>"
'Create the XmlParserContext. The XmlParserContext provides the
'necessary DTD information so that the entity reference can be expanded.
Dim context As XmlParserContext
Dim subset As String = "<!ENTITY h 'hardcover'>"
context = New XmlParserContext(Nothing, Nothing, "book", Nothing, Nothing, subset, "", "", XmlSpace.None)
'Create the reader.
reader = New XmlTextReader(xmlFrag, XmlNodeType.Element, context)
'Read the all the attributes on the book element.
reader.MoveToContent()
While reader.MoveToNextAttribute()
Console.WriteLine("{0} = {1}", reader.Name, reader.Value)
End While
Finally
If Not (reader Is Nothing) Then
reader.Close()
End If
End Try
End Sub
End Class
설명
이 생성자는 필요한 모든 DocumentType 정보를 XmlValidatingReader제공합니다. 이 XmlParserContext 정보가 전달 XmlTextReader되면 모든 DTD 정보가 무시됩니다.
DTD를 DTD로 internalSubset전달하는 경우 DTD는 문서 유효성 검사가 아닌 엔터티 확인에 사용됩니다.
적용 대상
XmlParserContext(XmlNameTable, XmlNamespaceManager, String, String, String, String, String, String, XmlSpace, Encoding)
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
- Source:
- XmlParserContext.cs
지정된 XmlParserContext, 기본 URIXmlNameTableXmlNamespaceManager, , xml:lang인코딩 및 문서 형식 값을 사용하여 클래스의 xml:space 새 인스턴스를 초기화합니다.
public:
XmlParserContext(System::Xml::XmlNameTable ^ nt, System::Xml::XmlNamespaceManager ^ nsMgr, System::String ^ docTypeName, System::String ^ pubId, System::String ^ sysId, System::String ^ internalSubset, System::String ^ baseURI, System::String ^ xmlLang, System::Xml::XmlSpace xmlSpace, System::Text::Encoding ^ enc);
public XmlParserContext(System.Xml.XmlNameTable nt, System.Xml.XmlNamespaceManager nsMgr, string docTypeName, string pubId, string sysId, string internalSubset, string baseURI, string xmlLang, System.Xml.XmlSpace xmlSpace, System.Text.Encoding enc);
public XmlParserContext(System.Xml.XmlNameTable? nt, System.Xml.XmlNamespaceManager? nsMgr, string? docTypeName, string? pubId, string? sysId, string? internalSubset, string? baseURI, string? xmlLang, System.Xml.XmlSpace xmlSpace, System.Text.Encoding? enc);
new System.Xml.XmlParserContext : System.Xml.XmlNameTable * System.Xml.XmlNamespaceManager * string * string * string * string * string * string * System.Xml.XmlSpace * System.Text.Encoding -> System.Xml.XmlParserContext
Public Sub New (nt As XmlNameTable, nsMgr As XmlNamespaceManager, docTypeName As String, pubId As String, sysId As String, internalSubset As String, baseURI As String, xmlLang As String, xmlSpace As XmlSpace, enc As Encoding)
매개 변수
- nt
- XmlNameTable
XmlNameTable 문자열을 원자화하는 데 사용할 값입니다. 이 null경우 생성 nsMgr 에 사용되는 이름 테이블이 대신 사용됩니다. 원자화된 문자열에 대한 자세한 내용은 다음을 참조하세요 XmlNameTable.
- nsMgr
- XmlNamespaceManager
네임스페이 XmlNamespaceManager 스 정보를 null조회하는 데 사용할 또는 .
- docTypeName
- String
문서 형식 선언의 이름입니다.
- pubId
- String
공용 식별자입니다.
- sysId
- String
시스템 식별자입니다.
- internalSubset
- String
내부 DTD 하위 집합입니다. DTD는 문서 유효성 검사가 아닌 엔터티 확인에 사용됩니다.
- baseURI
- String
XML 조각의 기본 URI(조각이 로드된 위치)입니다.
- xmlLang
- String
범위입니다 xml:lang .
예외
nt은 생성XmlNameTable에 사용되는 것과 동일 nsMgr 하지 않습니다.