Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2004-11-08 09:49:47 +0300
committerAtsushi Eno <atsushieno@gmail.com>2004-11-08 09:49:47 +0300
commit70b42d2cef6ef75b0e75a4cc82e9f1d98e2b59f4 (patch)
tree0cf9d6020db2981c155514060759bd3eb78086c7 /mcs/class/System.XML/System.Xml/DTDObjectModel.cs
parentef135e361d18e831505170af7c129cdc0f2a7937 (diff)
2004-11-08 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextReader2.cs : added. It is used to serve public API, plus entity handling support. * DTDObjectModel.cs, DTDValidatingReader.cs, XmlDocumentType.cs, XmlParserContext.cs, XmlTextReader.cs : Implemented XmlTextReader.EntityHandling and ResolveEntity(). To implement them, XmlTextReader in 2.0 itself is in XmlTextReader2.cs and XmlTextReader.cs contains Mono.Xml2.XmlTextReader which is the same as 1.x XmlTextReader. XmlTextReader2 switches entity reader and source reader, and never handles tokenization. The reason for "Mono.Xml2" is to avoid large changes in constructor.f svn path=/trunk/mcs/; revision=35812
Diffstat (limited to 'mcs/class/System.XML/System.Xml/DTDObjectModel.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/DTDObjectModel.cs34
1 files changed, 32 insertions, 2 deletions
diff --git a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
index fc6f6e5c749..ccaa28bc340 100644
--- a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
+++ b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
@@ -29,7 +29,6 @@
//
using System;
using System.Collections;
-//using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Text;
@@ -37,6 +36,12 @@ using System.Xml;
using System.Xml.Schema;
using Mono.Xml.Schema;
+#if NET_2_0
+using XmlTextReaderImpl = Mono.Xml2.XmlTextReader;
+#else
+using XmlTextReaderImpl = System.Xml.XmlTextReader;
+#endif
+
namespace Mono.Xml
{
internal class DTDObjectModel
@@ -229,6 +234,31 @@ namespace Mono.Xml
{
validationErrors.Add (ex);
}
+
+#if NET_2_0
+ internal string GenerateEntityAttributeText (string entityName)
+ {
+ DTDEntityDeclaration entity = EntityDecls [entityName] as DTDEntityDeclaration;
+ if (entity == null)
+ return null;
+ return entity.EntityValue;
+ }
+
+ internal XmlTextReaderImpl GenerateEntityContentReader (string entityName, XmlParserContext context)
+ {
+ DTDEntityDeclaration entity = EntityDecls [entityName] as DTDEntityDeclaration;
+ if (entity == null)
+ return null;
+
+ if (entity.SystemId != null) {
+ Uri baseUri = entity.BaseURI == null ? null : new Uri (entity.BaseURI);
+ Stream stream = resolver.GetEntity (resolver.ResolveUri (baseUri, entity.SystemId), null, typeof (Stream)) as Stream;
+ return new XmlTextReaderImpl (stream, XmlNodeType.Element, context);
+ }
+ else
+ return new XmlTextReaderImpl (entity.EntityValue, XmlNodeType.Element, context);
+ }
+#endif
}
internal class DTDCollectionBase : DictionaryBase
@@ -844,7 +874,7 @@ namespace Mono.Xml
Stream s = null;
try {
s = resolver.GetEntity (absUri, null, typeof (Stream)) as Stream;
- XmlTextReader xtr = new XmlTextReader (s);
+ XmlTextReaderImpl xtr = new XmlTextReaderImpl (absPath, s, Root.NameTable);
// Don't skip Text declaration here. LiteralEntityValue contains it. See spec 4.5
this.BaseURI = absPath;
LiteralEntityValue = xtr.GetRemainder ().ReadToEnd ();