1 //------------------------------------------------------------------------------
2 // <copyright file="XmlParserContext.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
12 namespace System.Xml {
13 // Specifies the context that the XmLReader will use for xml fragment
14 public class XmlParserContext {
16 private XmlNameTable _nt = null;
17 private XmlNamespaceManager _nsMgr = null;
18 private String _docTypeName = String.Empty;
19 private String _pubId = String.Empty;
20 private String _sysId = String.Empty;
21 private String _internalSubset = String.Empty;
22 private String _xmlLang = String.Empty;
23 private XmlSpace _xmlSpace;
24 private String _baseURI = String.Empty;
25 private Encoding _encoding = null;
27 public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,String xmlLang, XmlSpace xmlSpace)
28 : this(nt, nsMgr, null, null, null, null, String.Empty, xmlLang, xmlSpace)
30 // Intentionally Empty
33 public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,String xmlLang, XmlSpace xmlSpace, Encoding enc)
34 : this(nt, nsMgr, null, null, null, null, String.Empty, xmlLang, xmlSpace, enc)
36 // Intentionally Empty
39 public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName,
40 String pubId, String sysId, String internalSubset, String baseURI,
41 String xmlLang, XmlSpace xmlSpace)
42 : this(nt, nsMgr, docTypeName, pubId, sysId, internalSubset, baseURI, xmlLang, xmlSpace, null)
44 // Intentionally Empty
47 public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName,
48 String pubId, String sysId, String internalSubset, String baseURI,
49 String xmlLang, XmlSpace xmlSpace, Encoding enc)
54 _nt = nsMgr.NameTable;
57 if ( (object)nt != (object) nsMgr.NameTable ) {
58 throw new XmlException(Res.Xml_NotSameNametable, string.Empty);
68 _docTypeName = (null == docTypeName ? String.Empty : docTypeName);
69 _pubId = (null == pubId ? String.Empty : pubId);
70 _sysId = (null == sysId ? String.Empty : sysId);
71 _internalSubset = (null == internalSubset ? String.Empty : internalSubset);
72 _baseURI = (null == baseURI ? String.Empty : baseURI);
73 _xmlLang = (null == xmlLang ? String.Empty : xmlLang);
79 public XmlNameTable NameTable {
88 public XmlNamespaceManager NamespaceManager {
97 public String DocTypeName {
102 _docTypeName = (null == value ? String.Empty : value);
106 public String PublicId {
111 _pubId = (null == value ? String.Empty : value);
115 public String SystemId {
120 _sysId = (null == value ? String.Empty : value);
124 public String BaseURI {
129 _baseURI = (null == value ? String.Empty : value);
133 public String InternalSubset {
135 return _internalSubset;
138 _internalSubset = (null == value ? String.Empty : value);
142 public String XmlLang {
147 _xmlLang = (null == value ? String.Empty : value);
151 public XmlSpace XmlSpace {
160 public Encoding Encoding {
169 internal bool HasDtdInfo {
171 return ( _internalSubset != string.Empty || _pubId != string.Empty || _sysId != string.Empty );
175 } // class XmlContext
176 } // namespace System.Xml