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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
//------------------------------------------------------------------------------
// <copyright file="DtdInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">helenak</owner>
//------------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections.Generic;
namespace System.Xml {
//
// IDtdInfo interface
//
/// <summary>
/// This is an interface for a compiled DTD information.
/// It exposes information and functionality that XmlReader need in order to be able
/// to expand entities, add default attributes and correctly normalize attribute values
/// according to their data types.
/// </summary>
internal interface IDtdInfo {
/// <summary>
/// DOCTYPE name
/// </summary>
XmlQualifiedName Name { get; }
/// <summary>
/// Internal DTD subset as specified in the XML document
/// </summary>
string InternalDtdSubset { get; }
/// <summary>
/// Returns true if the DTD contains any declaration of a default attribute
/// </summary>
bool HasDefaultAttributes { get; }
/// <summary>
/// Returns true if the DTD contains any declaration of an attribute
/// whose type is other than CDATA
/// </summary>
bool HasNonCDataAttributes { get; }
/// <summary>
/// Looks up a DTD attribute list definition by its name.
/// </summary>
/// <param name="prefix">The prefix of the attribute list to look for</param>
/// <param name="localName">The local name of the attribute list to look for</param>
/// <returns>Interface representing an attribute list or null if none was found.</returns>
IDtdAttributeListInfo LookupAttributeList(string prefix, string localName);
/// <summary>
/// Returns an enumerator of all attribute lists defined in the DTD.
/// </summary>
IEnumerable<IDtdAttributeListInfo> GetAttributeLists();
/// <summary>
/// Looks up a general DTD entity by its name.
/// </summary>
/// <param name="name">The name of the entity to look for</param>
/// <returns>Interface representing an entity or null if none was found.</returns>
IDtdEntityInfo LookupEntity(string name);
};
//
// IDtdAttributeListInfo interface
//
/// <summary>
/// Exposes information about attributes declared in an attribute list in a DTD
/// that XmlReader need in order to be able to add default attributes
/// and correctly normalize attribute values according to their data types.
/// </summary>
internal interface IDtdAttributeListInfo {
/// <summary>
/// Prefix of an element this attribute list belongs to.
/// </summary>
string Prefix { get; }
/// <summary>
/// Local name of an element this attribute list belongs to.
/// </summary>
string LocalName { get;}
/// <summary>
/// Returns true if the attribute list has some declared attributes with
/// type other than CDATA.
/// </summary>
bool HasNonCDataAttributes { get; }
/// <summary>
/// Looks up a DTD attribute definition by its name.
/// </summary>
/// <param name="prefix">The prefix of the attribute to look for</param>
/// <param name="localName">The local name of the attribute to look for</param>
/// <returns>Interface representing an attribute or null is none was found</returns>
IDtdAttributeInfo LookupAttribute(string prefix, string localName);
/// <summary>
/// Returns enumeration of all default attributes
/// defined in this attribute list.
/// </summary>
/// <returns>Enumerator of default attribute.</returns>
IEnumerable<IDtdDefaultAttributeInfo> LookupDefaultAttributes();
/// <summary>
/// Looks up a ID attribute defined in the attribute list. Returns
/// null if the attribute list does define an ID attribute.
/// </summary>
IDtdAttributeInfo LookupIdAttribute();
}
//
// IDtdAttributeInfo interface
//
/// <summary>
/// Exposes information about an attribute declared in a DTD
/// that XmlReader need in order to be able to correctly normalize
/// the attribute value according to its data types.
/// </summary>
internal interface IDtdAttributeInfo {
/// <summary>
/// The prefix of the attribute
/// </summary>
string Prefix { get; }
/// <summary>
/// The local name of the attribute
/// </summary>
string LocalName { get;}
/// <summary>
/// The line number of the DTD attribute definition
/// </summary>
int LineNumber { get; }
/// <summary>
/// The line position of the DTD attribute definition
/// </summary>
int LinePosition { get; }
/// <summary>
/// Returns true if the attribute is of a different type than CDATA
/// </summary>
bool IsNonCDataType { get; }
/// <summary>
/// Returns true if the attribute was declared in an external DTD subset
/// </summary>
bool IsDeclaredInExternal { get; }
/// <summary>
/// Returns true if the attribute is xml:space or xml:lang
/// </summary>
bool IsXmlAttribute { get; }
}
//
// IDtdDefaultAttributeInfo interface
//
/// <summary>
/// Exposes information about a default attribute
/// declared in a DTD that XmlReader need in order to be able to add
/// this attribute to the XML document (it is not present already)
/// or correctly normalize the attribute value according to its data types.
/// </summary>
internal interface IDtdDefaultAttributeInfo : IDtdAttributeInfo {
/// <summary>
/// The expanded default value of the attribute
/// the consumer assumes that all entity references
/// were already resolved in the value and that the value
/// is correctly normalized.
/// </summary>
string DefaultValueExpanded { get; }
/// <summary>
/// The typed default value of the attribute.
/// </summary>
object DefaultValueTyped { get; } /// <summary>
/// The line number of the default value (in the DTD)
/// </summary>
int ValueLineNumber { get; }
/// <summary>
/// The line position of the default value (in the DTD)
/// </summary>
int ValueLinePosition { get; }
}
//
// IDtdEntityInfo interface
//
/// <summary>
/// Exposes information about a general entity
/// declared in a DTD that XmlReader need in order to be able
/// to expand the entity.
/// </summary>
internal interface IDtdEntityInfo {
/// <summary>
/// The name of the entity
/// </summary>
string Name { get; }
/// <summary>
/// true if the entity is external (its value is in an external input)
/// </summary>
bool IsExternal { get; }
/// <summary>
/// true if the entity was declared in external DTD subset
/// </summary>
bool IsDeclaredInExternal { get; }
/// <summary>
/// true if this is an unparsed entity
/// </summary>
bool IsUnparsedEntity { get; }
/// <summary>
/// true if this is a parameter entity
/// </summary>
bool IsParameterEntity { get; }
/// <summary>
/// The base URI of the entity value
/// </summary>
string BaseUriString { get; }
/// <summary>
/// The URI of the XML document where the entity was declared
/// </summary>
string DeclaredUriString { get; }
/// <summary>
/// SYSTEM identifier (URI) of the entity value - only used for external entities
/// </summary>
string SystemId { get; }
/// <summary>
/// PUBLIC identifier of the entity value - only used for external entities
/// </summary>
string PublicId { get; }
/// <summary>
/// Replacement text of an entity. Valid only for internal entities.
/// </summary>
string Text { get; }
/// <summary>
/// The line number of the entity value
/// </summary>
int LineNumber { get; }
/// <summary>
/// The line position of the entity value
/// </summary>
int LinePosition { get; }
}
}
|