diff options
Diffstat (limited to 'parser/html/javasrc/Tokenizer.java')
-rw-r--r-- | parser/html/javasrc/Tokenizer.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/parser/html/javasrc/Tokenizer.java b/parser/html/javasrc/Tokenizer.java index 0357cd0155..6d7c349155 100644 --- a/parser/html/javasrc/Tokenizer.java +++ b/parser/html/javasrc/Tokenizer.java @@ -511,6 +511,8 @@ public class Tokenizer implements Locator, Locator2 { private boolean shouldSuspend; + private boolean keepBuffer; + protected boolean confident; private int line; @@ -570,6 +572,7 @@ public class Tokenizer implements Locator, Locator2 { this.systemIdentifier = null; this.attributes = null; this.shouldSuspend = false; + this.keepBuffer = false; this.confident = false; this.line = 0; // CPPONLY: this.attributeLine = 0; @@ -632,6 +635,7 @@ public class Tokenizer implements Locator, Locator2 { // CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null; // CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder(); this.shouldSuspend = false; + this.keepBuffer = false; this.confident = false; this.line = 0; // CPPONLY: this.attributeLine = 0; @@ -653,6 +657,18 @@ public class Tokenizer implements Locator, Locator2 { // CPPONLY: return viewingXmlSource; // CPPONLY: } + public void setKeepBuffer(boolean keepBuffer) { + this.keepBuffer = keepBuffer; + } + + public boolean dropBufferIfLongerThan(int length) { + if (strBuf.length > length) { + strBuf = null; + return true; + } + return false; + } + // [NOCPP[ /** @@ -7225,7 +7241,9 @@ public class Tokenizer implements Locator, Locator2 { } public void end() throws SAXException { - strBuf = null; + if (!keepBuffer) { + strBuf = null; + } doctypeName = null; if (systemIdentifier != null) { Portability.releaseString(systemIdentifier); @@ -7415,7 +7433,9 @@ public class Tokenizer implements Locator, Locator2 { public void initializeWithoutStarting() throws SAXException { confident = false; - strBuf = null; + if (!keepBuffer) { + strBuf = null; + } line = 1; // CPPONLY: attributeLine = 1; // [NOCPP[ |