1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
//------------------------------------------------------------------------------
// <copyright file="XmlParserContext.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
//------------------------------------------------------------------------------
using System.Xml;
using System.Text;
using System;
namespace System.Xml {
// Specifies the context that the XmLReader will use for xml fragment
public class XmlParserContext {
private XmlNameTable _nt = null;
private XmlNamespaceManager _nsMgr = null;
private String _docTypeName = String.Empty;
private String _pubId = String.Empty;
private String _sysId = String.Empty;
private String _internalSubset = String.Empty;
private String _xmlLang = String.Empty;
private XmlSpace _xmlSpace;
private String _baseURI = String.Empty;
private Encoding _encoding = null;
public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,String xmlLang, XmlSpace xmlSpace)
: this(nt, nsMgr, null, null, null, null, String.Empty, xmlLang, xmlSpace)
{
// Intentionally Empty
}
public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,String xmlLang, XmlSpace xmlSpace, Encoding enc)
: this(nt, nsMgr, null, null, null, null, String.Empty, xmlLang, xmlSpace, enc)
{
// Intentionally Empty
}
public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName,
String pubId, String sysId, String internalSubset, String baseURI,
String xmlLang, XmlSpace xmlSpace)
: this(nt, nsMgr, docTypeName, pubId, sysId, internalSubset, baseURI, xmlLang, xmlSpace, null)
{
// Intentionally Empty
}
public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName,
String pubId, String sysId, String internalSubset, String baseURI,
String xmlLang, XmlSpace xmlSpace, Encoding enc)
{
if (nsMgr != null) {
if (nt == null) {
_nt = nsMgr.NameTable;
}
else {
if ( (object)nt != (object) nsMgr.NameTable ) {
throw new XmlException(Res.Xml_NotSameNametable, string.Empty);
}
_nt = nt;
}
}
else {
_nt = nt;
}
_nsMgr = nsMgr;
_docTypeName = (null == docTypeName ? String.Empty : docTypeName);
_pubId = (null == pubId ? String.Empty : pubId);
_sysId = (null == sysId ? String.Empty : sysId);
_internalSubset = (null == internalSubset ? String.Empty : internalSubset);
_baseURI = (null == baseURI ? String.Empty : baseURI);
_xmlLang = (null == xmlLang ? String.Empty : xmlLang);
_xmlSpace = xmlSpace;
_encoding = enc;
}
public XmlNameTable NameTable {
get {
return _nt;
}
set {
_nt = value;
}
}
public XmlNamespaceManager NamespaceManager {
get {
return _nsMgr;
}
set {
_nsMgr = value;
}
}
public String DocTypeName {
get {
return _docTypeName;
}
set {
_docTypeName = (null == value ? String.Empty : value);
}
}
public String PublicId {
get {
return _pubId;
}
set {
_pubId = (null == value ? String.Empty : value);
}
}
public String SystemId {
get {
return _sysId;
}
set {
_sysId = (null == value ? String.Empty : value);
}
}
public String BaseURI {
get {
return _baseURI;
}
set {
_baseURI = (null == value ? String.Empty : value);
}
}
public String InternalSubset {
get {
return _internalSubset;
}
set {
_internalSubset = (null == value ? String.Empty : value);
}
}
public String XmlLang {
get {
return _xmlLang;
}
set {
_xmlLang = (null == value ? String.Empty : value);
}
}
public XmlSpace XmlSpace {
get {
return _xmlSpace;
}
set {
_xmlSpace = value;
}
}
public Encoding Encoding {
get {
return _encoding;
}
set {
_encoding = value;
}
}
internal bool HasDtdInfo {
get {
return ( _internalSubset != string.Empty || _pubId != string.Empty || _sysId != string.Empty );
}
}
} // class XmlContext
} // namespace System.Xml
|