/// <summary> /// Creates a new DTD tokenizer with the given source and container. /// </summary> /// <param name="container">The container to use.</param> /// <param name="src">The source to inspect.</param> public DtdPlainTokenizer(DtdContainer container, SourceManager src) : base(src) { _container = container; _external = true; _stream = new IntermediateStream(src); }
/// <summary> /// Creates a new tokenizer for XML documents. /// </summary> /// <param name="source">The source code manager.</param> public XmlTokenizer(SourceManager source) : base(source) { _dtd = new DtdContainer(); _dtd.AddEntity(new Entity { NodeName = "amp", NodeValue = "&" }); _dtd.AddEntity(new Entity { NodeName = "lt", NodeValue = "<" }); _dtd.AddEntity(new Entity { NodeName = "gt", NodeValue = ">" }); _dtd.AddEntity(new Entity { NodeName = "apos", NodeValue = "'" }); _dtd.AddEntity(new Entity { NodeName = "quot", NodeValue = "\"" }); }
/// <summary> /// Scans the external portion, i.e. the system identifier of the doctype. /// </summary> /// <param name="url">The url to use.</param> /// <param name="typeDefinitions">The type definitions to modify.</param> void ScanExternalSubset(String url, DtdContainer typeDefinitions) { if (Configuration.HasHttpRequester) { if (!Location.IsAbsolute(url)) { url = Location.MakeAbsolute(doc.BaseURI, url); } var http = Configuration.GetHttpRequester(); var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) }); var stream = new SourceManager(response.Content); var container = new DtdContainer(typeDefinitions) { Url = url, Parent = doc }; var dtd = new DtdParser(container, stream); dtd.IsInternal = false; dtd.Parse(); } }
/// <summary> /// Creates a new tokenizer for XML documents. /// </summary> /// <param name="source">The source code manager.</param> public XmlTokenizer(SourceManager source) : base(source) { _dtd = new DtdContainer(); _dtd.AddEntity(new DOM.Entity { NotationName = "amp", NodeValue = "&" }); _dtd.AddEntity(new DOM.Entity { NotationName = "lt", NodeValue = "<" }); _dtd.AddEntity(new DOM.Entity { NotationName = "gt", NodeValue = ">" }); _dtd.AddEntity(new DOM.Entity { NotationName = "apos", NodeValue = "'" }); _dtd.AddEntity(new DOM.Entity { NotationName = "quot", NodeValue = "\"" }); }
/// <summary> /// Creates a new Dtd parser that uses the given container /// as the result for parsing the given source. /// </summary> /// <param name="container">The container to use.</param> /// <param name="source">The source to parse.</param> public DtdParser(DtdContainer container, SourceManager source) { _tokenizer = new DtdTokenizer(container, source); _result = container; _src = source; _tokenizer.ErrorOccurred += (s, ev) => { if (ErrorOccurred != null) ErrorOccurred(this, ev); }; }
/// <summary> /// Scans the external portion, i.e. the system identifier of the doctype. /// </summary> /// <param name="url">The url to use.</param> /// <param name="typeDefinitions">The type definitions to modify.</param> void ScanExternalSubset(String url, DtdContainer typeDefinitions) { if (Configuration.HasHttpRequester) { if (!Location.IsAbsolute(url)) url = Location.MakeAbsolute(doc.BaseURI, url); var http = Configuration.GetHttpRequester(); var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) }); var stream = new SourceManager(response.Content); var container = new DtdContainer(typeDefinitions) { Url = url, Parent = doc }; var dtd = new DtdParser(container, stream); dtd.IsInternal = false; dtd.Parse(); } }
/// <summary> /// Creates a new DTD tokenizer with the given source and container. /// </summary> /// <param name="container">The container to use.</param> /// <param name="src">The source to inspect.</param> public DtdTokenizer(DtdContainer container, SourceManager src) : base(container, src) { _includes = 0; IsExternal = true; }