// (C) Ximian, Inc.\r
//\r
using System;\r
+using System.IO;\r
using System.Collections;\r
using Mono.Xml;\r
\r
public class XmlDocumentType : XmlLinkedNode\r
{\r
// Fields\r
- string name; // name of the document type\r
- string publicId; // public identifier on the DOCTYPE\r
- string systemId; // system identifier on the DOCTYPE\r
- string internalSubset; // value of the DTD internal subset\r
+// string name; // name of the document type\r
+// string publicId; // public identifier on the DOCTYPE\r
+// string systemId; // system identifier on the DOCTYPE\r
+// string internalSubset; // value of the DTD internal subset\r
internal XmlNamedNodeMap entities;\r
internal XmlNamedNodeMap notations;\r
- DTDObjectModel DTD;\r
+ DTDObjectModel dtd;\r
\r
// Constructor\r
protected internal XmlDocumentType (string name, string publicId,\r
XmlDocument doc)\r
: base (doc)\r
{\r
- this.name = name;\r
- this.publicId = publicId;\r
- this.systemId = systemId;\r
- this.internalSubset = internalSubset;\r
-\r
- XmlTextReader xtr = new XmlTextReader ("", XmlNodeType.Document, null);\r
+ XmlTextReader xtr = new XmlTextReader (BaseURI, new StringReader (""), doc.NameTable);\r
+ xtr.XmlResolver = doc.Resolver;\r
xtr.GenerateDTDObjectModel (name, publicId, systemId, internalSubset);\r
- this.DTD = xtr.DTD;\r
+ this.dtd = xtr.DTD;\r
\r
ImportFromDTD ();\r
}\r
\r
- internal XmlDocumentType (XmlTextReader reader, XmlDocument doc)\r
+ internal XmlDocumentType (DTDObjectModel dtd, XmlDocument doc)\r
: base (doc)\r
{\r
- this.name = reader.Name;\r
- this.publicId = reader ["PUBLIC"];\r
- this.systemId = reader ["SYSTEM"];\r
- this.internalSubset = reader.Value;\r
- this.DTD = reader.DTD;\r
-\r
+ this.dtd = dtd;\r
ImportFromDTD ();\r
}\r
\r
XmlNode n = new XmlEntity (decl.Name, decl.NotationName,
decl.PublicId, decl.SystemId, OwnerDocument);
// FIXME: Value is more complex, similar to Attribute.
- n.insertBeforeIntern (OwnerDocument.CreateTextNode (decl.EntityValue), null);
+ n.insertBeforeIntern (OwnerDocument.CreateTextNode (decl.LiteralEntityValue), null);
entities.Nodes.Add (n);
}
foreach (DTDNotationDeclaration decl in DTD.NotationDecls.Values) {
}\r
\r
// Properties\r
+ internal DTDObjectModel DTD {\r
+ get { return dtd; }\r
+ }\r
+\r
public XmlNamedNodeMap Entities\r
{\r
get { return entities; }\r
\r
public string InternalSubset\r
{\r
- get { return internalSubset; }\r
+ get { return dtd.InternalSubset; }\r
}\r
\r
public override bool IsReadOnly\r
\r
public override string LocalName\r
{\r
- get { return name; }\r
+ get { return dtd.Name; }\r
}\r
\r
public override string Name\r
{\r
- get { return name; }\r
+ get { return dtd.Name; }\r
}\r
\r
public override XmlNodeType NodeType\r
\r
public string PublicId\r
{\r
- get { return publicId; }\r
+ get { return dtd.PublicId; }\r
}\r
\r
public string SystemId\r
{\r
- get { return systemId; }\r
+ get { return dtd.SystemId; }\r
}\r
\r
// Methods\r
public override XmlNode CloneNode (bool deep)\r
{\r
// deep is ignored\r
- return new XmlDocumentType (name, publicId, systemId,\r
- internalSubset, OwnerDocument);\r
+// return new XmlDocumentType (Name, PublicId, SystemId,\r
+// InternalSubset, OwnerDocument);\r
+ return new XmlDocumentType (dtd, OwnerDocument);\r
}\r
\r
public override void WriteContentTo (XmlWriter w)\r
\r
public override void WriteTo (XmlWriter w)\r
{\r
- w.WriteDocType (name, publicId, systemId, internalSubset);\r
+ w.WriteDocType (Name, PublicId, SystemId, InternalSubset);\r
}\r
}\r
}\r