Beispiel #1
0
		// Constructor
		protected internal XmlDocumentType (string name, string publicId,
						    string systemId, string internalSubset,
						    XmlDocument doc)
			: base (doc)
		{
			XmlTextReaderImpl xtr = new XmlTextReaderImpl (BaseURI, new StringReader (""), doc.NameTable);
			xtr.XmlResolver = doc.Resolver;
			xtr.GenerateDTDObjectModel (name, publicId, systemId, internalSubset);
			this.dtd = xtr.DTD;

			ImportFromDTD ();
		}
Beispiel #2
0
        // Constructor
        protected internal XmlDocumentType(string name, string publicId,
                                           string systemId, string internalSubset,
                                           XmlDocument doc)
            : base(doc)
        {
            XmlTextReaderImpl xtr = new XmlTextReaderImpl(BaseURI, new StringReader(""), doc.NameTable);

            xtr.XmlResolver = doc.Resolver;
            xtr.GenerateDTDObjectModel(name, publicId, systemId, internalSubset);
            this.dtd = xtr.DTD;

            ImportFromDTD();
        }
		void ReadDoctype ()
		{
			FillAttributes ();

			IHasXmlParserContext ctx = reader as IHasXmlParserContext;
			if (ctx != null)
				dtd = ctx.ParserContext.Dtd;
			if (dtd == null) {
				XmlTextReaderImpl xmlTextReader = new XmlTextReaderImpl ("", XmlNodeType.Document, null);
				xmlTextReader.XmlResolver = resolver;
				xmlTextReader.GenerateDTDObjectModel (reader.Name,
					reader ["PUBLIC"], reader ["SYSTEM"], reader.Value);
				dtd = xmlTextReader.DTD;
			}
			currentAutomata = dtd.RootAutomata;

			// Validity Constraint Check.
			for (int i = 0; i < DTD.Errors.Length; i++)
				HandleError (DTD.Errors [i].Message, XmlSeverityType.Error);

			// NData target exists.
			foreach (DTDEntityDeclaration ent in dtd.EntityDecls.Values)
				if (ent.NotationName != null && dtd.NotationDecls [ent.NotationName] == null)
					this.HandleError ("Target notation was not found for NData in entity declaration " + ent.Name + ".",
						XmlSeverityType.Error);
			// NOTATION exists for attribute default values
			foreach (DTDAttListDeclaration attListIter in dtd.AttListDecls.Values) {
				foreach (DTDAttributeDefinition def in attListIter.Definitions) {
					if (def.Datatype.TokenizedType != XmlTokenizedType.NOTATION)
						continue;
					foreach (string notation in def.EnumeratedNotations)
						if (dtd.NotationDecls [notation] == null)
							this.HandleError ("Target notation was not found for NOTATION typed attribute default " + def.Name + ".",
								XmlSeverityType.Error);
				}
			}
		}