//\r
using System;\r
using System.Collections;\r
+using Mono.Xml;\r
\r
namespace System.Xml\r
{\r
string internalSubset; // value of the DTD internal subset\r
internal XmlNamedNodeMap entities;\r
internal XmlNamedNodeMap notations;\r
- internal Hashtable elementDecls;\r
- internal Hashtable attListDecls;\r
+ DTDObjectModel DTD;\r
\r
// Constructor\r
protected internal XmlDocumentType (string name, string publicId,\r
this.publicId = publicId;\r
this.systemId = systemId;\r
this.internalSubset = internalSubset;\r
+\r
+ XmlTextReader xtr = new XmlTextReader ("", XmlNodeType.Document, null);\r
+ xtr.GenerateDTDObjectModel (name, publicId, systemId, internalSubset);\r
+ this.DTD = xtr.DTD;\r
+\r
+ ImportFromDTD ();\r
+ }\r
+\r
+ internal XmlDocumentType (XmlTextReader reader, 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
+ ImportFromDTD ();\r
+ }\r
+\r
+ private void ImportFromDTD ()\r
+ {\r
entities = new XmlNamedNodeMap (this);\r
notations = new XmlNamedNodeMap (this);\r
- elementDecls = new Hashtable ();\r
- attListDecls = new Hashtable ();\r
- }\r
\r
+ foreach (DTDEntityDeclaration decl in DTD.EntityDecls.Values) {
+ 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);
+ entities.Nodes.Add (n);
+ }
+ foreach (DTDNotationDeclaration decl in DTD.NotationDecls.Values) {
+ XmlNode n = new XmlNotation (decl.LocalName, decl.Prefix,
+ decl.PublicId, decl.SystemId, OwnerDocument);
+ notations.Nodes.Add (n);
+ }
+ }\r
\r
// Properties\r
public XmlNamedNodeMap Entities\r