// 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 (); }
// 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 ResolveEntity() { if (entity != null) { entity.ResolveEntity(); } else { if (source.NodeType != XmlNodeType.EntityReference) { throw new InvalidOperationException("The current node is not an Entity Reference"); } XmlTextReaderImpl entReader = null; #if NOT_PFX if (ParserContext.Dtd != null) { entReader = ParserContext.Dtd.GenerateEntityContentReader(source.Name, ParserContext); } #endif if (entReader == null) { throw new XmlException(this as IXmlLineInfo, this.BaseURI, String.Format("Reference to undeclared entity '{0}'.", source.Name)); } if (entityNameStack == null) { entityNameStack = new Stack <string> (); } else if (entityNameStack.Contains(Name)) { throw new XmlException(String.Format("General entity '{0}' has an invalid recursive reference to itself.", Name)); } entityNameStack.Push(Name); entity = new XmlTextReader( entReader, insideAttribute); entity.entityNameStack = entityNameStack; entity.CopyProperties(this); } }
public void Resolve() { if (ActualUri == String.Empty) { LoadFailed = true; LiteralEntityValue = String.Empty; return; } if (Root.ExternalResources.ContainsKey(ActualUri)) { LiteralEntityValue = (string)Root.ExternalResources [ActualUri]; } Stream s = null; try { s = resolver.GetEntity(absUri, null, typeof(Stream)) as Stream; XmlTextReaderImpl xtr = new XmlTextReaderImpl(ActualUri, s, Root.NameTable); // Don't skip Text declaration here. LiteralEntityValue contains it. See spec 4.5 LiteralEntityValue = xtr.GetRemainder().ReadToEnd(); Root.ExternalResources.Add(ActualUri, LiteralEntityValue); if (Root.ExternalResources.Count > DTDObjectModel.AllowedExternalEntitiesMax) { throw new InvalidOperationException("The total amount of external entities exceeded the allowed number."); } } catch (Exception) { // loadException = ex; LiteralEntityValue = String.Empty; LoadFailed = true; // throw NotWFError ("Cannot resolve external entity. URI is " + ActualUri + " ."); } finally { if (s != null) { s.Close(); } } }
public XmlTextReader (string url, TextReader input, XmlNameTable nt) { source = new XmlTextReaderImpl (url, input, nt); }
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); } } }
internal XmlTextReader(bool dummy, XmlResolver resolver, string url, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl(dummy, resolver, url, fragType, context); }
private XmlTextReader(XmlTextReaderImpl entityContainer, bool insideAttribute) { source = entityContainer; this.entityInsideAttribute = insideAttribute; }
internal XmlTextReader(string baseURI, TextReader xmlFragment, XmlNodeType fragType) { source = new XmlTextReaderImpl(baseURI, xmlFragment, fragType); }
internal XmlTextReader(string baseURI, TextReader xmlFragment, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl(baseURI, xmlFragment, fragType, context); }
public XmlTextReader(string url, TextReader input, XmlNameTable nt) { source = new XmlTextReaderImpl(url, input, nt); }
public XmlTextReader(string xmlFragment, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl(xmlFragment, fragType, context); }
public XmlTextReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl (xmlFragment, fragType, context); }
private XmlTextReader (XmlTextReaderImpl entityContainer, bool insideAttribute) { source = entityContainer; this.entityInsideAttribute = insideAttribute; }
internal XmlTextReader (bool dummy, XmlResolver resolver, string url, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl (dummy, resolver, url, fragType, context); }
internal XmlTextReader (string baseURI, TextReader xmlFragment, XmlNodeType fragType, XmlParserContext context) { source = new XmlTextReaderImpl (baseURI, xmlFragment, fragType, context); }
internal XmlTextReader (string baseURI, TextReader xmlFragment, XmlNodeType fragType) { source = new XmlTextReaderImpl (baseURI, xmlFragment, fragType); }