From cf4547219b996786916e029990c3d363466dc4a1 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 3 Jun 2013 08:22:52 -0400 Subject: [PATCH] another nonstrict end of file test --- dom.d | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dom.d b/dom.d index 8237f75..0b7eb5f 100644 --- a/dom.d +++ b/dom.d @@ -2220,7 +2220,7 @@ dchar parseEntity(in dchar[] entity) { case "fnof": return '\u0192'; case "circ": return '\u02C6'; case "tilde": return '\u02DC'; - + case "trade": return '\u2122'; /* @@ -3340,7 +3340,10 @@ class Document : FileResource { } else data = rawdata; - return new Utf8Stream(data); + static if(is(Utf8Stream == string)) + return data; + else + return new Utf8Stream(data); } /** @@ -3625,9 +3628,14 @@ class Document : FileResource { case '/': // closing an element pos++; // skip the start auto p = pos; - while(data[pos] != '>') + while(pos < data.length && data[pos] != '>') pos++; //writefln("", data[p..pos]); + if(pos == data.length && data[pos-1] != '>') + if(strict) + throw new MarkupException("File ended before closing tag had a required >"); + else + data ~= ">"; // just hack it in pos++; // skip the '>' string tname = data[p..pos-1]; @@ -5481,6 +5489,9 @@ struct FormFieldOptions { } // this needs to look just like a string, but can expand as needed +version(no_dom_stream) +alias string Utf8Stream; +else class Utf8Stream { protected: // these two should be overridden in subclasses to actually do the stream magic