summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-01-16 07:17:55 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-01-16 07:17:55 -0500
commit9dbbc6c08f2c603d29c37b3ac33f880c2507d705 (patch)
tree13f63be0110c29ed14e993c27f81d231a49fd028 /parser
parent72779c9dde868791e89f729c2abc768f21470dbf (diff)
downloadUXP-9dbbc6c08f2c603d29c37b3ac33f880c2507d705.tar
UXP-9dbbc6c08f2c603d29c37b3ac33f880c2507d705.tar.gz
UXP-9dbbc6c08f2c603d29c37b3ac33f880c2507d705.tar.lz
UXP-9dbbc6c08f2c603d29c37b3ac33f880c2507d705.tar.xz
UXP-9dbbc6c08f2c603d29c37b3ac33f880c2507d705.zip
Remove obsolete javasrc snapshot
Diffstat (limited to 'parser')
-rw-r--r--parser/html/javasrc/AttributeName.java2473
-rw-r--r--parser/html/javasrc/ElementName.java1609
-rw-r--r--parser/html/javasrc/HtmlAttributes.java618
-rw-r--r--parser/html/javasrc/MetaScanner.java854
-rw-r--r--parser/html/javasrc/Portability.java150
-rw-r--r--parser/html/javasrc/README.txt6
-rw-r--r--parser/html/javasrc/StackNode.java295
-rw-r--r--parser/html/javasrc/StateSnapshot.java204
-rw-r--r--parser/html/javasrc/Tokenizer.java7089
-rw-r--r--parser/html/javasrc/TreeBuilder.java6552
-rw-r--r--parser/html/javasrc/UTF16Buffer.java151
11 files changed, 0 insertions, 20001 deletions
diff --git a/parser/html/javasrc/AttributeName.java b/parser/html/javasrc/AttributeName.java
deleted file mode 100644
index 7b889e71e..000000000
--- a/parser/html/javasrc/AttributeName.java
+++ /dev/null
@@ -1,2473 +0,0 @@
-/*
- * Copyright (c) 2008-2011 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import java.util.Arrays;
-
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NoLength;
-import nu.validator.htmlparser.annotation.NsUri;
-import nu.validator.htmlparser.annotation.Prefix;
-import nu.validator.htmlparser.annotation.QName;
-import nu.validator.htmlparser.annotation.Virtual;
-import nu.validator.htmlparser.common.Interner;
-
-public final class AttributeName
-// Uncomment to regenerate
-// implements Comparable<AttributeName>
-{
- // [NOCPP[
-
- public static final int NCNAME_HTML = 1;
-
- public static final int NCNAME_FOREIGN = (1 << 1) | (1 << 2);
-
- public static final int NCNAME_LANG = (1 << 3);
-
- public static final int IS_XMLNS = (1 << 4);
-
- public static final int CASE_FOLDED = (1 << 5);
-
- public static final int BOOLEAN = (1 << 6);
-
- // ]NOCPP]
-
- /**
- * An array representing no namespace regardless of namespace mode (HTML,
- * SVG, MathML, lang-mapping HTML) used.
- */
- static final @NoLength @NsUri String[] ALL_NO_NS = { "", "", "",
- // [NOCPP[
- ""
- // ]NOCPP]
- };
-
- /**
- * An array that has no namespace for the HTML mode but the XMLNS namespace
- * for the SVG and MathML modes.
- */
- private static final @NoLength @NsUri String[] XMLNS_NS = { "",
- "http://www.w3.org/2000/xmlns/", "http://www.w3.org/2000/xmlns/",
- // [NOCPP[
- ""
- // ]NOCPP]
- };
-
- /**
- * An array that has no namespace for the HTML mode but the XML namespace
- * for the SVG and MathML modes.
- */
- private static final @NoLength @NsUri String[] XML_NS = { "",
- "http://www.w3.org/XML/1998/namespace",
- "http://www.w3.org/XML/1998/namespace",
- // [NOCPP[
- ""
- // ]NOCPP]
- };
-
- /**
- * An array that has no namespace for the HTML mode but the XLink namespace
- * for the SVG and MathML modes.
- */
- private static final @NoLength @NsUri String[] XLINK_NS = { "",
- "http://www.w3.org/1999/xlink", "http://www.w3.org/1999/xlink",
- // [NOCPP[
- ""
- // ]NOCPP]
- };
-
- // [NOCPP[
- /**
- * An array that has no namespace for the HTML, SVG and MathML modes but has
- * the XML namespace for the lang-mapping HTML mode.
- */
- private static final @NoLength @NsUri String[] LANG_NS = { "", "", "",
- "http://www.w3.org/XML/1998/namespace" };
-
- // ]NOCPP]
-
- /**
- * An array for no prefixes in any mode.
- */
- static final @NoLength @Prefix String[] ALL_NO_PREFIX = { null, null, null,
- // [NOCPP[
- null
- // ]NOCPP]
- };
-
- /**
- * An array for no prefixe in the HTML mode and the <code>xmlns</code>
- * prefix in the SVG and MathML modes.
- */
- private static final @NoLength @Prefix String[] XMLNS_PREFIX = { null,
- "xmlns", "xmlns",
- // [NOCPP[
- null
- // ]NOCPP]
- };
-
- /**
- * An array for no prefixe in the HTML mode and the <code>xlink</code>
- * prefix in the SVG and MathML modes.
- */
- private static final @NoLength @Prefix String[] XLINK_PREFIX = { null,
- "xlink", "xlink",
- // [NOCPP[
- null
- // ]NOCPP]
- };
-
- /**
- * An array for no prefixe in the HTML mode and the <code>xml</code> prefix
- * in the SVG and MathML modes.
- */
- private static final @NoLength @Prefix String[] XML_PREFIX = { null, "xml",
- "xml",
- // [NOCPP[
- null
- // ]NOCPP]
- };
-
- // [NOCPP[
-
- private static final @NoLength @Prefix String[] LANG_PREFIX = { null, null,
- null, "xml" };
-
- private static @QName String[] COMPUTE_QNAME(String[] local, String[] prefix) {
- @QName String[] arr = new String[4];
- for (int i = 0; i < arr.length; i++) {
- if (prefix[i] == null) {
- arr[i] = local[i];
- } else {
- arr[i] = (prefix[i] + ':' + local[i]).intern();
- }
- }
- return arr;
- }
-
- // ]NOCPP]
-
- /**
- * An initialization helper for having a one name in the SVG mode and
- * another name in the other modes.
- *
- * @param name
- * the name for the non-SVG modes
- * @param camel
- * the name for the SVG mode
- * @return the initialized name array
- */
- private static @NoLength @Local String[] SVG_DIFFERENT(@Local String name,
- @Local String camel) {
- @NoLength @Local String[] arr = new String[4];
- arr[0] = name;
- arr[1] = name;
- arr[2] = camel;
- // [NOCPP[
- arr[3] = name;
- // ]NOCPP]
- return arr;
- }
-
- /**
- * An initialization helper for having a one name in the MathML mode and
- * another name in the other modes.
- *
- * @param name
- * the name for the non-MathML modes
- * @param camel
- * the name for the MathML mode
- * @return the initialized name array
- */
- private static @NoLength @Local String[] MATH_DIFFERENT(@Local String name,
- @Local String camel) {
- @NoLength @Local String[] arr = new String[4];
- arr[0] = name;
- arr[1] = camel;
- arr[2] = name;
- // [NOCPP[
- arr[3] = name;
- // ]NOCPP]
- return arr;
- }
-
- /**
- * An initialization helper for having a different local name in the HTML
- * mode and the SVG and MathML modes.
- *
- * @param name
- * the name for the HTML mode
- * @param suffix
- * the name for the SVG and MathML modes
- * @return the initialized name array
- */
- private static @NoLength @Local String[] COLONIFIED_LOCAL(
- @Local String name, @Local String suffix) {
- @NoLength @Local String[] arr = new String[4];
- arr[0] = name;
- arr[1] = suffix;
- arr[2] = suffix;
- // [NOCPP[
- arr[3] = name;
- // ]NOCPP]
- return arr;
- }
-
- /**
- * An initialization helper for having the same local name in all modes.
- *
- * @param name
- * the name
- * @return the initialized name array
- */
- static @NoLength @Local String[] SAME_LOCAL(@Local String name) {
- @NoLength @Local String[] arr = new String[4];
- arr[0] = name;
- arr[1] = name;
- arr[2] = name;
- // [NOCPP[
- arr[3] = name;
- // ]NOCPP]
- return arr;
- }
-
- /**
- * Returns an attribute name by buffer.
- *
- * <p>
- * C++ ownership: The return value is either released by the caller if the
- * attribute is a duplicate or the ownership is transferred to
- * HtmlAttributes and released upon clearing or destroying that object.
- *
- * @param buf
- * the buffer
- * @param offset
- * ignored
- * @param length
- * length of data
- * @param checkNcName
- * whether to check ncnameness
- * @return an <code>AttributeName</code> corresponding to the argument data
- */
- static AttributeName nameByBuffer(@NoLength char[] buf, int offset,
- int length
- // [NOCPP[
- , boolean checkNcName
- // ]NOCPP]
- , Interner interner) {
- // XXX deal with offset
- int hash = AttributeName.bufToHash(buf, length);
- int index = Arrays.binarySearch(AttributeName.ATTRIBUTE_HASHES, hash);
- if (index < 0) {
- return AttributeName.createAttributeName(
- Portability.newLocalNameFromBuffer(buf, offset, length,
- interner)
- // [NOCPP[
- , checkNcName
- // ]NOCPP]
- );
- } else {
- AttributeName attributeName = AttributeName.ATTRIBUTE_NAMES[index];
- @Local String name = attributeName.getLocal(AttributeName.HTML);
- if (!Portability.localEqualsBuffer(name, buf, offset, length)) {
- return AttributeName.createAttributeName(
- Portability.newLocalNameFromBuffer(buf, offset, length,
- interner)
- // [NOCPP[
- , checkNcName
- // ]NOCPP]
- );
- }
- return attributeName;
- }
- }
-
- /**
- * This method has to return a unique integer for each well-known
- * lower-cased attribute name.
- *
- * @param buf
- * @param len
- * @return
- */
- private static int bufToHash(@NoLength char[] buf, int len) {
- int hash2 = 0;
- int hash = len;
- hash <<= 5;
- hash += buf[0] - 0x60;
- int j = len;
- for (int i = 0; i < 4 && j > 0; i++) {
- j--;
- hash <<= 5;
- hash += buf[j] - 0x60;
- hash2 <<= 6;
- hash2 += buf[i] - 0x5F;
- }
- return hash ^ hash2;
- }
-
- /**
- * The mode value for HTML.
- */
- public static final int HTML = 0;
-
- /**
- * The mode value for MathML.
- */
- public static final int MATHML = 1;
-
- /**
- * The mode value for SVG.
- */
- public static final int SVG = 2;
-
- // [NOCPP[
-
- /**
- * The mode value for lang-mapping HTML.
- */
- public static final int HTML_LANG = 3;
-
- // ]NOCPP]
-
- /**
- * The namespaces indexable by mode.
- */
- private final @NsUri @NoLength String[] uri;
-
- /**
- * The local names indexable by mode.
- */
- private final @Local @NoLength String[] local;
-
- /**
- * The prefixes indexably by mode.
- */
- private final @Prefix @NoLength String[] prefix;
-
- // [NOCPP[
-
- private final int flags;
-
- /**
- * The qnames indexable by mode.
- */
- private final @QName @NoLength String[] qName;
-
- // ]NOCPP]
-
- /**
- * The startup-time constructor.
- *
- * @param uri
- * the namespace
- * @param local
- * the local name
- * @param prefix
- * the prefix
- * @param ncname
- * the ncnameness
- * @param xmlns
- * whether this is an xmlns attribute
- */
- protected AttributeName(@NsUri @NoLength String[] uri,
- @Local @NoLength String[] local, @Prefix @NoLength String[] prefix
- // [NOCPP[
- , int flags
- // ]NOCPP]
- ) {
- this.uri = uri;
- this.local = local;
- this.prefix = prefix;
- // [NOCPP[
- this.qName = COMPUTE_QNAME(local, prefix);
- this.flags = flags;
- // ]NOCPP]
- }
-
- /**
- * Creates an <code>AttributeName</code> for a local name.
- *
- * @param name
- * the name
- * @param checkNcName
- * whether to check ncnameness
- * @return an <code>AttributeName</code>
- */
- private static AttributeName createAttributeName(@Local String name
- // [NOCPP[
- , boolean checkNcName
- // ]NOCPP]
- ) {
- // [NOCPP[
- int flags = NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG;
- if (name.startsWith("xmlns:")) {
- flags = IS_XMLNS;
- } else if (checkNcName && !NCName.isNCName(name)) {
- flags = 0;
- }
- // ]NOCPP]
- return new AttributeName(AttributeName.ALL_NO_NS,
- AttributeName.SAME_LOCAL(name), ALL_NO_PREFIX, flags);
- }
-
- /**
- * Deletes runtime-allocated instances in C++.
- */
- @Virtual void release() {
- // No-op in Java.
- // Implement as |delete this;| in subclass.
- }
-
- /**
- * The C++ destructor.
- */
- @SuppressWarnings("unused") @Virtual private void destructor() {
- Portability.deleteArray(local);
- }
-
- /**
- * Clones the attribute using an interner. Returns <code>this</code> in Java
- * and for non-dynamic instances in C++.
- *
- * @param interner
- * an interner
- * @return a clone
- */
- @Virtual public AttributeName cloneAttributeName(Interner interner) {
- return this;
- }
-
- // [NOCPP[
- /**
- * Creator for use when the XML violation policy requires an attribute name
- * to be changed.
- *
- * @param name
- * the name of the attribute to create
- */
- static AttributeName create(@Local String name) {
- return new AttributeName(AttributeName.ALL_NO_NS,
- AttributeName.SAME_LOCAL(name), ALL_NO_PREFIX,
- NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- }
-
- /**
- * Queries whether this name is an XML 1.0 4th ed. NCName.
- *
- * @param mode
- * the SVG/MathML/HTML mode
- * @return <code>true</code> if this is an NCName in the given mode
- */
- public boolean isNcName(int mode) {
- return (flags & (1 << mode)) != 0;
- }
-
- /**
- * Queries whether this is an <code>xmlns</code> attribute.
- *
- * @return <code>true</code> if this is an <code>xmlns</code> attribute
- */
- public boolean isXmlns() {
- return (flags & IS_XMLNS) != 0;
- }
-
- /**
- * Queries whether this attribute has a case-folded value in the HTML4 mode
- * of the parser.
- *
- * @return <code>true</code> if the value is case-folded
- */
- boolean isCaseFolded() {
- return (flags & CASE_FOLDED) != 0;
- }
-
- boolean isBoolean() {
- return (flags & BOOLEAN) != 0;
- }
-
- public @QName String getQName(int mode) {
- return qName[mode];
- }
-
- // ]NOCPP]
-
- public @NsUri String getUri(int mode) {
- return uri[mode];
- }
-
- public @Local String getLocal(int mode) {
- return local[mode];
- }
-
- public @Prefix String getPrefix(int mode) {
- return prefix[mode];
- }
-
- boolean equalsAnother(AttributeName another) {
- return this.getLocal(AttributeName.HTML) == another.getLocal(AttributeName.HTML);
- }
-
- // START CODE ONLY USED FOR GENERATING CODE uncomment to regenerate
-
-// /**
-// * @see java.lang.Object#toString()
-// */
-// @Override public String toString() {
-// return "(" + formatNs() + ", " + formatLocal() + ", " + formatPrefix()
-// + ", " + formatFlags() + ")";
-// }
-//
-// private String formatFlags() {
-// StringBuilder builder = new StringBuilder();
-// if ((flags & NCNAME_HTML) != 0) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("NCNAME_HTML");
-// }
-// if ((flags & NCNAME_FOREIGN) != 0) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("NCNAME_FOREIGN");
-// }
-// if ((flags & NCNAME_LANG) != 0) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("NCNAME_LANG");
-// }
-// if (isXmlns()) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("IS_XMLNS");
-// }
-// if (isCaseFolded()) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("CASE_FOLDED");
-// }
-// if (isBoolean()) {
-// if (builder.length() != 0) {
-// builder.append(" | ");
-// }
-// builder.append("BOOLEAN");
-// }
-// if (builder.length() == 0) {
-// return "0";
-// }
-// return builder.toString();
-// }
-//
-// public int compareTo(AttributeName other) {
-// int thisHash = this.hash();
-// int otherHash = other.hash();
-// if (thisHash < otherHash) {
-// return -1;
-// } else if (thisHash == otherHash) {
-// return 0;
-// } else {
-// return 1;
-// }
-// }
-//
-// private String formatPrefix() {
-// if (prefix[0] == null && prefix[1] == null && prefix[2] == null
-// && prefix[3] == null) {
-// return "ALL_NO_PREFIX";
-// } else if (prefix[0] == null && prefix[1] == prefix[2]
-// && prefix[3] == null) {
-// if ("xmlns".equals(prefix[1])) {
-// return "XMLNS_PREFIX";
-// } else if ("xml".equals(prefix[1])) {
-// return "XML_PREFIX";
-// } else if ("xlink".equals(prefix[1])) {
-// return "XLINK_PREFIX";
-// } else {
-// throw new IllegalStateException();
-// }
-// } else if (prefix[0] == null && prefix[1] == null && prefix[2] == null
-// && prefix[3] == "xml") {
-// return "LANG_PREFIX";
-// } else {
-// throw new IllegalStateException();
-// }
-// }
-//
-// private String formatLocal() {
-// if (local[0] == local[1] && local[0] == local[3]
-// && local[0] != local[2]) {
-// return "SVG_DIFFERENT(\"" + local[0] + "\", \"" + local[2] + "\")";
-// }
-// if (local[0] == local[2] && local[0] == local[3]
-// && local[0] != local[1]) {
-// return "MATH_DIFFERENT(\"" + local[0] + "\", \"" + local[1] + "\")";
-// }
-// if (local[0] == local[3] && local[1] == local[2]
-// && local[0] != local[1]) {
-// return "COLONIFIED_LOCAL(\"" + local[0] + "\", \"" + local[1]
-// + "\")";
-// }
-// for (int i = 1; i < local.length; i++) {
-// if (local[0] != local[i]) {
-// throw new IllegalStateException();
-// }
-// }
-// return "SAME_LOCAL(\"" + local[0] + "\")";
-// }
-//
-// private String formatNs() {
-// if (uri[0] == "" && uri[1] == "" && uri[2] == "" && uri[3] == "") {
-// return "ALL_NO_NS";
-// } else if (uri[0] == "" && uri[1] == uri[2] && uri[3] == "") {
-// if ("http://www.w3.org/2000/xmlns/".equals(uri[1])) {
-// return "XMLNS_NS";
-// } else if ("http://www.w3.org/XML/1998/namespace".equals(uri[1])) {
-// return "XML_NS";
-// } else if ("http://www.w3.org/1999/xlink".equals(uri[1])) {
-// return "XLINK_NS";
-// } else {
-// throw new IllegalStateException();
-// }
-// } else if (uri[0] == "" && uri[1] == "" && uri[2] == ""
-// && uri[3] == "http://www.w3.org/XML/1998/namespace") {
-// return "LANG_NS";
-// } else {
-// throw new IllegalStateException();
-// }
-// }
-//
-// private String constName() {
-// String name = getLocal(HTML);
-// char[] buf = new char[name.length()];
-// for (int i = 0; i < name.length(); i++) {
-// char c = name.charAt(i);
-// if (c == '-' || c == ':') {
-// buf[i] = '_';
-// } else if (c >= 'a' && c <= 'z') {
-// buf[i] = (char) (c - 0x20);
-// } else {
-// buf[i] = c;
-// }
-// }
-// return new String(buf);
-// }
-//
-// private int hash() {
-// String name = getLocal(HTML);
-// return bufToHash(name.toCharArray(), name.length());
-// }
-//
-// /**
-// * Regenerate self
-// *
-// * @param args
-// */
-// public static void main(String[] args) {
-// Arrays.sort(ATTRIBUTE_NAMES);
-// for (int i = 1; i < ATTRIBUTE_NAMES.length; i++) {
-// if (ATTRIBUTE_NAMES[i].hash() == ATTRIBUTE_NAMES[i - 1].hash()) {
-// System.err.println("Hash collision: "
-// + ATTRIBUTE_NAMES[i].getLocal(HTML) + ", "
-// + ATTRIBUTE_NAMES[i - 1].getLocal(HTML));
-// return;
-// }
-// }
-// for (int i = 0; i < ATTRIBUTE_NAMES.length; i++) {
-// AttributeName att = ATTRIBUTE_NAMES[i];
-// System.out.println("public static final AttributeName "
-// + att.constName() + " = new AttributeName" + att.toString()
-// + ";");
-// }
-// System.out.println("private final static @NoLength AttributeName[] ATTRIBUTE_NAMES = {");
-// for (int i = 0; i < ATTRIBUTE_NAMES.length; i++) {
-// AttributeName att = ATTRIBUTE_NAMES[i];
-// System.out.println(att.constName() + ",");
-// }
-// System.out.println("};");
-// System.out.println("private final static int[] ATTRIBUTE_HASHES = {");
-// for (int i = 0; i < ATTRIBUTE_NAMES.length; i++) {
-// AttributeName att = ATTRIBUTE_NAMES[i];
-// System.out.println(Integer.toString(att.hash()) + ",");
-// }
-// System.out.println("};");
-// }
-
- // START GENERATED CODE
- public static final AttributeName D = new AttributeName(ALL_NO_NS, SAME_LOCAL("d"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName K = new AttributeName(ALL_NO_NS, SAME_LOCAL("k"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName R = new AttributeName(ALL_NO_NS, SAME_LOCAL("r"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName X = new AttributeName(ALL_NO_NS, SAME_LOCAL("x"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName Y = new AttributeName(ALL_NO_NS, SAME_LOCAL("y"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName Z = new AttributeName(ALL_NO_NS, SAME_LOCAL("z"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BY = new AttributeName(ALL_NO_NS, SAME_LOCAL("by"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CX = new AttributeName(ALL_NO_NS, SAME_LOCAL("cx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CY = new AttributeName(ALL_NO_NS, SAME_LOCAL("cy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DX = new AttributeName(ALL_NO_NS, SAME_LOCAL("dx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DY = new AttributeName(ALL_NO_NS, SAME_LOCAL("dy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName G2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("g2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName G1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("g1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FX = new AttributeName(ALL_NO_NS, SAME_LOCAL("fx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName K4 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k4"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName K2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName K3 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k3"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName K1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("k1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ID = new AttributeName(ALL_NO_NS, SAME_LOCAL("id"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName IN = new AttributeName(ALL_NO_NS, SAME_LOCAL("in"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName U2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("u2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName U1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("u1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RT = new AttributeName(ALL_NO_NS, SAME_LOCAL("rt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RX = new AttributeName(ALL_NO_NS, SAME_LOCAL("rx"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RY = new AttributeName(ALL_NO_NS, SAME_LOCAL("ry"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TO = new AttributeName(ALL_NO_NS, SAME_LOCAL("to"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName Y2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("y2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName Y1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("y1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName X1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("x1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName X2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("x2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ALT = new AttributeName(ALL_NO_NS, SAME_LOCAL("alt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DIR = new AttributeName(ALL_NO_NS, SAME_LOCAL("dir"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName DUR = new AttributeName(ALL_NO_NS, SAME_LOCAL("dur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName END = new AttributeName(ALL_NO_NS, SAME_LOCAL("end"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("for"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName IN2 = new AttributeName(ALL_NO_NS, SAME_LOCAL("in2"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MAX = new AttributeName(ALL_NO_NS, SAME_LOCAL("max"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("min"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("low"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REL = new AttributeName(ALL_NO_NS, SAME_LOCAL("rel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REV = new AttributeName(ALL_NO_NS, SAME_LOCAL("rev"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SRC = new AttributeName(ALL_NO_NS, SAME_LOCAL("src"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName AXIS = new AttributeName(ALL_NO_NS, SAME_LOCAL("axis"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ABBR = new AttributeName(ALL_NO_NS, SAME_LOCAL("abbr"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BBOX = new AttributeName(ALL_NO_NS, SAME_LOCAL("bbox"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CITE = new AttributeName(ALL_NO_NS, SAME_LOCAL("cite"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("code"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BIAS = new AttributeName(ALL_NO_NS, SAME_LOCAL("bias"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("cols"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLIP = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CHAR = new AttributeName(ALL_NO_NS, SAME_LOCAL("char"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BASE = new AttributeName(ALL_NO_NS, SAME_LOCAL("base"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName EDGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("edge"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DATA = new AttributeName(ALL_NO_NS, SAME_LOCAL("data"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FILL = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FROM = new AttributeName(ALL_NO_NS, SAME_LOCAL("from"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FORM = new AttributeName(ALL_NO_NS, SAME_LOCAL("form"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("face"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HIGH = new AttributeName(ALL_NO_NS, SAME_LOCAL("high"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("href"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OPEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("open"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ICON = new AttributeName(ALL_NO_NS, SAME_LOCAL("icon"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NAME = new AttributeName(ALL_NO_NS, SAME_LOCAL("name"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("mode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MASK = new AttributeName(ALL_NO_NS, SAME_LOCAL("mask"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("link"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LANG = new AttributeName(LANG_NS, SAME_LOCAL("lang"), LANG_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LOOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("loop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LIST = new AttributeName(ALL_NO_NS, SAME_LOCAL("list"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("type"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName WHEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("when"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName WRAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("wrap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEXT = new AttributeName(ALL_NO_NS, SAME_LOCAL("text"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATH = new AttributeName(ALL_NO_NS, SAME_LOCAL("path"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PING = new AttributeName(ALL_NO_NS, SAME_LOCAL("ping"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REFX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("refx", "refX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REFY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("refy", "refY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("size"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SEED = new AttributeName(ALL_NO_NS, SAME_LOCAL("seed"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ROWS = new AttributeName(ALL_NO_NS, SAME_LOCAL("rows"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("span"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STEP = new AttributeName(ALL_NO_NS, SAME_LOCAL("step"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName ROLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("role"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("xref"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ASYNC = new AttributeName(ALL_NO_NS, SAME_LOCAL("async"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ALINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("alink"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("align"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName CLOSE = new AttributeName(ALL_NO_NS, SAME_LOCAL("close"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLASS = new AttributeName(ALL_NO_NS, SAME_LOCAL("class"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLEAR = new AttributeName(ALL_NO_NS, SAME_LOCAL("clear"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName BEGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("begin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DEPTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("depth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DEFER = new AttributeName(ALL_NO_NS, SAME_LOCAL("defer"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName FENCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fence"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FRAME = new AttributeName(ALL_NO_NS, SAME_LOCAL("frame"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName ISMAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ismap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ONEND = new AttributeName(ALL_NO_NS, SAME_LOCAL("onend"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName INDEX = new AttributeName(ALL_NO_NS, SAME_LOCAL("index"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("order"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OTHER = new AttributeName(ALL_NO_NS, SAME_LOCAL("other"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncut"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NARGS = new AttributeName(ALL_NO_NS, SAME_LOCAL("nargs"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MEDIA = new AttributeName(ALL_NO_NS, SAME_LOCAL("media"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LABEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("label"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LOCAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("local"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName WIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("width"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TITLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("title"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VLINK = new AttributeName(ALL_NO_NS, SAME_LOCAL("vlink"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VALUE = new AttributeName(ALL_NO_NS, SAME_LOCAL("value"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SLOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("slope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SHAPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("shape"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName SCOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName SCALE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scale"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPEED = new AttributeName(ALL_NO_NS, SAME_LOCAL("speed"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("style"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RULES = new AttributeName(ALL_NO_NS, SAME_LOCAL("rules"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName STEMH = new AttributeName(ALL_NO_NS, SAME_LOCAL("stemh"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SIZES = new AttributeName(ALL_NO_NS, SAME_LOCAL("sizes"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STEMV = new AttributeName(ALL_NO_NS, SAME_LOCAL("stemv"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName START = new AttributeName(ALL_NO_NS, SAME_LOCAL("start"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XMLNS = new AttributeName(XMLNS_NS, SAME_LOCAL("xmlns"), ALL_NO_PREFIX, IS_XMLNS);
- public static final AttributeName ACCEPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("accept"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACCENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("accent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ASCENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("ascent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACTIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("active"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ALTIMG = new AttributeName(ALL_NO_NS, SAME_LOCAL("altimg"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("action"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("border"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CURSOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("cursor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COORDS = new AttributeName(ALL_NO_NS, SAME_LOCAL("coords"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FILTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("filter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FORMAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("format"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HIDDEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("hidden"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("hspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("height"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmove"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAG = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondrag"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ORIGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("origin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONZOOM = new AttributeName(ALL_NO_NS, SAME_LOCAL("onzoom"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONHELP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onhelp"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSTOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onstop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDROP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondrop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBLUR = new AttributeName(ALL_NO_NS, SAME_LOCAL("onblur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OBJECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("object"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OFFSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("offset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ORIENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("orient"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCOPY = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncopy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NOWRAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("nowrap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName NOHREF = new AttributeName(ALL_NO_NS, SAME_LOCAL("nohref"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName MACROS = new AttributeName(ALL_NO_NS, SAME_LOCAL("macros"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName METHOD = new AttributeName(ALL_NO_NS, SAME_LOCAL("method"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName LOWSRC = new AttributeName(ALL_NO_NS, SAME_LOCAL("lowsrc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("lquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName USEMAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("usemap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName WIDTHS = new AttributeName(ALL_NO_NS, SAME_LOCAL("widths"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TARGET = new AttributeName(ALL_NO_NS, SAME_LOCAL("target"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VALUES = new AttributeName(ALL_NO_NS, SAME_LOCAL("values"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("valign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName VSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("vspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName POSTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("poster"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName POINTS = new AttributeName(ALL_NO_NS, SAME_LOCAL("points"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PROMPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("prompt"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SRCDOC = new AttributeName(ALL_NO_NS, SAME_LOCAL("srcdoc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCOPED = new AttributeName(ALL_NO_NS, SAME_LOCAL("scoped"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STRING = new AttributeName(ALL_NO_NS, SAME_LOCAL("string"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCHEME = new AttributeName(ALL_NO_NS, SAME_LOCAL("scheme"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RADIUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("radius"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RESULT = new AttributeName(ALL_NO_NS, SAME_LOCAL("result"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SRCSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("srcset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ROTATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rotate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RQUOTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("rquote"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ALTTEXT = new AttributeName(ALL_NO_NS, SAME_LOCAL("alttext"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARCHIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("archive"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName AZIMUTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("azimuth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLOSURE = new AttributeName(ALL_NO_NS, SAME_LOCAL("closure"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CHECKED = new AttributeName(ALL_NO_NS, SAME_LOCAL("checked"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName CLASSID = new AttributeName(ALL_NO_NS, SAME_LOCAL("classid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CHAROFF = new AttributeName(ALL_NO_NS, SAME_LOCAL("charoff"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BGCOLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("bgcolor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("colspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CHARSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("charset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COMPACT = new AttributeName(ALL_NO_NS, SAME_LOCAL("compact"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName CONTENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("content"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ENCTYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("enctype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName DATASRC = new AttributeName(ALL_NO_NS, SAME_LOCAL("datasrc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DATAFLD = new AttributeName(ALL_NO_NS, SAME_LOCAL("datafld"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DECLARE = new AttributeName(ALL_NO_NS, SAME_LOCAL("declare"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName DISPLAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("display"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DIVISOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("divisor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DEFAULT = new AttributeName(ALL_NO_NS, SAME_LOCAL("default"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName DESCENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("descent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KERNING = new AttributeName(ALL_NO_NS, SAME_LOCAL("kerning"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HANGING = new AttributeName(ALL_NO_NS, SAME_LOCAL("hanging"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HEADERS = new AttributeName(ALL_NO_NS, SAME_LOCAL("headers"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONPASTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onpaste"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCLICK = new AttributeName(ALL_NO_NS, SAME_LOCAL("onclick"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OPTIMUM = new AttributeName(ALL_NO_NS, SAME_LOCAL("optimum"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbegin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONKEYUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeyup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONERROR = new AttributeName(ALL_NO_NS, SAME_LOCAL("onerror"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONINPUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oninput"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONABORT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onabort"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("onstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONRESET = new AttributeName(ALL_NO_NS, SAME_LOCAL("onreset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NOSHADE = new AttributeName(ALL_NO_NS, SAME_LOCAL("noshade"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName MINSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("minsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MAXSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("maxsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LARGEOP = new AttributeName(ALL_NO_NS, SAME_LOCAL("largeop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNICODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("unicode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TARGETX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("targetx", "targetX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TARGETY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("targety", "targetY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VIEWBOX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("viewbox", "viewBox"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERSION = new AttributeName(ALL_NO_NS, SAME_LOCAL("version"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATTERN = new AttributeName(ALL_NO_NS, SAME_LOCAL("pattern"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PROFILE = new AttributeName(ALL_NO_NS, SAME_LOCAL("profile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RESTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("restart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ROWSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SANDBOX = new AttributeName(ALL_NO_NS, SAME_LOCAL("sandbox"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SUMMARY = new AttributeName(ALL_NO_NS, SAME_LOCAL("summary"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STANDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("standby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPLACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("replace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName AUTOPLAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("autoplay"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ADDITIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("additive"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CALCMODE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("calcmode", "calcMode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CODETYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("codetype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CODEBASE = new AttributeName(ALL_NO_NS, SAME_LOCAL("codebase"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CONTROLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("controls"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BEVELLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("bevelled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName EXPONENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("exponent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName EDGEMODE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("edgemode", "edgeMode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ENCODING = new AttributeName(ALL_NO_NS, SAME_LOCAL("encoding"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GLYPHREF = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("glyphref", "glyphRef"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DATETIME = new AttributeName(ALL_NO_NS, SAME_LOCAL("datetime"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DISABLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("disabled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName FONTSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KEYTIMES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keytimes", "keyTimes"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PANOSE_1 = new AttributeName(ALL_NO_NS, SAME_LOCAL("panose-1"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HREFLANG = new AttributeName(ALL_NO_NS, SAME_LOCAL("hreflang"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONRESIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onresize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onchange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBOUNCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbounce"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONUNLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onunload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFINISH = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfinish"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSCROLL = new AttributeName(ALL_NO_NS, SAME_LOCAL("onscroll"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OPERATOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("operator"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OVERFLOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("overflow"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSUBMIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onsubmit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONREPEAT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrepeat"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSELECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onselect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NOTATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("notation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NORESIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("noresize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName MANIFEST = new AttributeName(ALL_NO_NS, SAME_LOCAL("manifest"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MATHSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MULTIPLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("multiple"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName LONGDESC = new AttributeName(ALL_NO_NS, SAME_LOCAL("longdesc"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LANGUAGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("language"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEMPLATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("template"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TABINDEX = new AttributeName(ALL_NO_NS, SAME_LOCAL("tabindex"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PROPERTY = new AttributeName(ALL_NO_NS, SAME_LOCAL("property"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName READONLY = new AttributeName(ALL_NO_NS, SAME_LOCAL("readonly"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName SELECTED = new AttributeName(ALL_NO_NS, SAME_LOCAL("selected"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ROWLINES = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowlines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SEAMLESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("seamless"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ROWALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STRETCHY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stretchy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REQUIRED = new AttributeName(ALL_NO_NS, SAME_LOCAL("required"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName XML_BASE = new AttributeName(XML_NS, COLONIFIED_LOCAL("xml:base", "base"), XML_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName XML_LANG = new AttributeName(XML_NS, COLONIFIED_LOCAL("xml:lang", "lang"), XML_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName X_HEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("x-height"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_OWNS = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-owns"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName AUTOFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("autofocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ARIA_SORT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-sort"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACCESSKEY = new AttributeName(ALL_NO_NS, SAME_LOCAL("accesskey"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_BUSY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-busy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_GRAB = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-grab"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName AMPLITUDE = new AttributeName(ALL_NO_NS, SAME_LOCAL("amplitude"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_LIVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-live"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLIP_RULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip-rule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLIP_PATH = new AttributeName(ALL_NO_NS, SAME_LOCAL("clip-path"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName EQUALROWS = new AttributeName(ALL_NO_NS, SAME_LOCAL("equalrows"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ELEVATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("elevation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DIRECTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("direction"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DRAGGABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("draggable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FILL_RULE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill-rule"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONTSTYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontstyle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_SIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-size"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KEYSYSTEM = new AttributeName(ALL_NO_NS, SAME_LOCAL("keysystem"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KEYPOINTS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keypoints", "keyPoints"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HIDEFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("hidefocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMESSAGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmessage"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName INTERCEPT = new AttributeName(ALL_NO_NS, SAME_LOCAL("intercept"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGEND = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragend"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOVEEND = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmoveend"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONINVALID = new AttributeName(ALL_NO_NS, SAME_LOCAL("oninvalid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName INTEGRITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("integrity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONKEYDOWN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeydown"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFOCUSIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocusin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName INPUTMODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("inputmode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONROWEXIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrowexit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MATHCOLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathcolor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MASKUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("maskunits", "maskUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MAXLENGTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("maxlength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LINEBREAK = new AttributeName(ALL_NO_NS, SAME_LOCAL("linebreak"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TRANSFORM = new AttributeName(ALL_NO_NS, SAME_LOCAL("transform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName V_HANGING = new AttributeName(ALL_NO_NS, SAME_LOCAL("v-hanging"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VALUETYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("valuetype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName POINTSATZ = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsatz", "pointsAtZ"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName POINTSATX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsatx", "pointsAtX"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName POINTSATY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pointsaty", "pointsAtY"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SYMMETRIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("symmetric"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCROLLING = new AttributeName(ALL_NO_NS, SAME_LOCAL("scrolling"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName REPEATDUR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("repeatdur", "repeatDur"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SELECTION = new AttributeName(ALL_NO_NS, SAME_LOCAL("selection"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SEPARATOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("separator"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XML_SPACE = new AttributeName(XML_NS, COLONIFIED_LOCAL("xml:space", "space"), XML_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName AUTOSUBMIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("autosubmit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED | BOOLEAN);
- public static final AttributeName ALPHABETIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("alphabetic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACTIONTYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("actiontype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACCUMULATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("accumulate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_LEVEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-level"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLUMNSPAN = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnspan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CAP_HEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("cap-height"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("background"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GLYPH_NAME = new AttributeName(ALL_NO_NS, SAME_LOCAL("glyph-name"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GROUPALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("groupalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONTFAMILY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontfamily"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONTWEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("fontweight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_STYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-style"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KEYSPLINES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("keysplines", "keySplines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HTTP_EQUIV = new AttributeName(ALL_NO_NS, SAME_LOCAL("http-equiv"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONACTIVATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onactivate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OCCURRENCE = new AttributeName(ALL_NO_NS, SAME_LOCAL("occurrence"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName IRRELEVANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("irrelevant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDBLCLICK = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondblclick"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGDROP = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragdrop"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONKEYPRESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("onkeypress"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONROWENTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrowenter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGOVER = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragover"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFOCUSOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfocusout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEOUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseout"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName NUMOCTAVES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("numoctaves", "numOctaves"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKER_MID = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-mid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKER_END = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-end"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEXTLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("textlength", "textLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VISIBILITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("visibility"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VIEWTARGET = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("viewtarget", "viewTarget"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERT_ADV_Y = new AttributeName(ALL_NO_NS, SAME_LOCAL("vert-adv-y"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATHLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("pathlength", "pathLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEAT_MAX = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat-max"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RADIOGROUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("radiogroup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STOP_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("stop-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SEPARATORS = new AttributeName(ALL_NO_NS, SAME_LOCAL("separators"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEAT_MIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat-min"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ROWSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("rowspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ZOOMANDPAN = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("zoomandpan", "zoomAndPan"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XLINK_TYPE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:type", "type"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName XLINK_ROLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:role", "role"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName XLINK_HREF = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:href", "href"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName XLINK_SHOW = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:show", "show"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName ACCENTUNDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("accentunder"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_SECRET = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-secret"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_ATOMIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-atomic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_HIDDEN = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-hidden"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_FLOWTO = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-flowto"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARABIC_FORM = new AttributeName(ALL_NO_NS, SAME_LOCAL("arabic-form"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CELLPADDING = new AttributeName(ALL_NO_NS, SAME_LOCAL("cellpadding"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CELLSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("cellspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLUMNWIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnwidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CROSSORIGIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("crossorigin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLUMNALIGN = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnalign"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLUMNLINES = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnlines"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CONTEXTMENU = new AttributeName(ALL_NO_NS, SAME_LOCAL("contextmenu"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BASEPROFILE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("baseprofile", "baseProfile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_FAMILY = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-family"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FRAMEBORDER = new AttributeName(ALL_NO_NS, SAME_LOCAL("frameborder"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FILTERUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("filterunits", "filterUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FLOOD_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("flood-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_WEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-weight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HORIZ_ADV_X = new AttributeName(ALL_NO_NS, SAME_LOCAL("horiz-adv-x"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGLEAVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragleave"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEMOVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousemove"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ORIENTATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("orientation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEDOWN = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousedown"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEOVER = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseover"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGENTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragenter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName IDEOGRAPHIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("ideographic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFORECUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforecut"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFORMINPUT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onforminput"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDRAGSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondragstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOVESTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmovestart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKERUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerunits", "markerUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MATHVARIANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathvariant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARGINWIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("marginwidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKERWIDTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerwidth", "markerWidth"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEXT_ANCHOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-anchor"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TABLEVALUES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("tablevalues", "tableValues"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCRIPTLEVEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptlevel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEATCOUNT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("repeatcount", "repeatCount"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STITCHTILES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("stitchtiles", "stitchTiles"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STARTOFFSET = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("startoffset", "startOffset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCROLLDELAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("scrolldelay"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XMLNS_XLINK = new AttributeName(XMLNS_NS, COLONIFIED_LOCAL("xmlns:xlink", "xlink"), XMLNS_PREFIX, IS_XMLNS);
- public static final AttributeName XLINK_TITLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:title", "title"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName ARIA_INVALID = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-invalid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_PRESSED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-pressed"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_CHECKED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-checked"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName AUTOCOMPLETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("autocomplete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName ARIA_SETSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-setsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_CHANNEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-channel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName EQUALCOLUMNS = new AttributeName(ALL_NO_NS, SAME_LOCAL("equalcolumns"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DISPLAYSTYLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("displaystyle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DATAFORMATAS = new AttributeName(ALL_NO_NS, SAME_LOCAL("dataformatas"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG | CASE_FOLDED);
- public static final AttributeName FILL_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("fill-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_VARIANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-variant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_STRETCH = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-stretch"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FRAMESPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("framespacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KERNELMATRIX = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("kernelmatrix", "kernelMatrix"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDEACTIVATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondeactivate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONROWSDELETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrowsdelete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSELEAVE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseleave"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFORMCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onformchange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCELLCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncellchange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEWHEEL = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmousewheel"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONMOUSEENTER = new AttributeName(ALL_NO_NS, SAME_LOCAL("onmouseenter"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONAFTERPRINT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onafterprint"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFORECOPY = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforecopy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARGINHEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("marginheight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKERHEIGHT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("markerheight", "markerHeight"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MARKER_START = new AttributeName(ALL_NO_NS, SAME_LOCAL("marker-start"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MATHEMATICAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathematical"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LENGTHADJUST = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("lengthadjust", "lengthAdjust"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNSELECTABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("unselectable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNICODE_BIDI = new AttributeName(ALL_NO_NS, SAME_LOCAL("unicode-bidi"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNITS_PER_EM = new AttributeName(ALL_NO_NS, SAME_LOCAL("units-per-em"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName WORD_SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("word-spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName WRITING_MODE = new AttributeName(ALL_NO_NS, SAME_LOCAL("writing-mode"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName V_ALPHABETIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("v-alphabetic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATTERNUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patternunits", "patternUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPREADMETHOD = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("spreadmethod", "spreadMethod"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SURFACESCALE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("surfacescale", "surfaceScale"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_WIDTH = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-width"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEAT_START = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat-start"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STDDEVIATION = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("stddeviation", "stdDeviation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STOP_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stop-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_CONTROLS = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-controls"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_HASPOPUP = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-haspopup"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ACCENT_HEIGHT = new AttributeName(ALL_NO_NS, SAME_LOCAL("accent-height"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_VALUENOW = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuenow"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_RELEVANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-relevant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_POSINSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-posinset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_VALUEMAX = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuemax"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_READONLY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-readonly"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_SELECTED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-selected"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_REQUIRED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-required"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_EXPANDED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-expanded"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_DISABLED = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-disabled"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ATTRIBUTETYPE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("attributetype", "attributeType"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ATTRIBUTENAME = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("attributename", "attributeName"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_DATATYPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-datatype"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_VALUEMIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-valuemin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BASEFREQUENCY = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("basefrequency", "baseFrequency"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLUMNSPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("columnspacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLOR_PROFILE = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-profile"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CLIPPATHUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("clippathunits", "clipPathUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DEFINITIONURL = new AttributeName(ALL_NO_NS, MATH_DIFFERENT("definitionurl", "definitionURL"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GRADIENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("gradientunits", "gradientUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FLOOD_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("flood-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONAFTERUPDATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onafterupdate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONERRORUPDATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onerrorupdate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREPASTE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforepaste"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONLOSECAPTURE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onlosecapture"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCONTEXTMENU = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncontextmenu"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONSELECTSTART = new AttributeName(ALL_NO_NS, SAME_LOCAL("onselectstart"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREPRINT = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeprint"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MOVABLELIMITS = new AttributeName(ALL_NO_NS, SAME_LOCAL("movablelimits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LINETHICKNESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("linethickness"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNICODE_RANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("unicode-range"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName THINMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("thinmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERT_ORIGIN_X = new AttributeName(ALL_NO_NS, SAME_LOCAL("vert-origin-x"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERT_ORIGIN_Y = new AttributeName(ALL_NO_NS, SAME_LOCAL("vert-origin-y"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName V_IDEOGRAPHIC = new AttributeName(ALL_NO_NS, SAME_LOCAL("v-ideographic"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PRESERVEALPHA = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("preservealpha", "preserveAlpha"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCRIPTMINSIZE = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptminsize"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPECIFICATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("specification"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XLINK_ACTUATE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:actuate", "actuate"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName XLINK_ARCROLE = new AttributeName(XLINK_NS, COLONIFIED_LOCAL("xlink:arcrole", "arcrole"), XLINK_PREFIX, NCNAME_FOREIGN);
- public static final AttributeName ACCEPT_CHARSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("accept-charset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ALIGNMENTSCOPE = new AttributeName(ALL_NO_NS, SAME_LOCAL("alignmentscope"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_MULTILINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-multiline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName BASELINE_SHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("baseline-shift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HORIZ_ORIGIN_X = new AttributeName(ALL_NO_NS, SAME_LOCAL("horiz-origin-x"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName HORIZ_ORIGIN_Y = new AttributeName(ALL_NO_NS, SAME_LOCAL("horiz-origin-y"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREUPDATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeupdate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONFILTERCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onfilterchange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONROWSINSERTED = new AttributeName(ALL_NO_NS, SAME_LOCAL("onrowsinserted"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREUNLOAD = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeunload"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MATHBACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("mathbackground"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LETTER_SPACING = new AttributeName(ALL_NO_NS, SAME_LOCAL("letter-spacing"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LIGHTING_COLOR = new AttributeName(ALL_NO_NS, SAME_LOCAL("lighting-color"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName THICKMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("thickmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEXT_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName V_MATHEMATICAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("v-mathematical"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName POINTER_EVENTS = new AttributeName(ALL_NO_NS, SAME_LOCAL("pointer-events"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PRIMITIVEUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("primitiveunits", "primitiveUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REFERRERPOLICY = new AttributeName(ALL_NO_NS, SAME_LOCAL("referrerpolicy"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SYSTEMLANGUAGE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("systemlanguage", "systemLanguage"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_LINECAP = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-linecap"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SUBSCRIPTSHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("subscriptshift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_OPACITY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-opacity"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_DROPEFFECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-dropeffect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_LABELLEDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-labelledby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_TEMPLATEID = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-templateid"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLOR_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName CONTENTEDITABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("contenteditable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DIFFUSECONSTANT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("diffuseconstant", "diffuseConstant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDATAAVAILABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondataavailable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONCONTROLSELECT = new AttributeName(ALL_NO_NS, SAME_LOCAL("oncontrolselect"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName IMAGE_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("image-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MEDIUMMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("mediummathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName TEXT_DECORATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("text-decoration"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SHAPE_RENDERING = new AttributeName(ALL_NO_NS, SAME_LOCAL("shape-rendering"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_LINEJOIN = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-linejoin"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REPEAT_TEMPLATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("repeat-template"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_DESCRIBEDBY = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-describedby"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName FONT_SIZE_ADJUST = new AttributeName(ALL_NO_NS, SAME_LOCAL("font-size-adjust"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName KERNELUNITLENGTH = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("kernelunitlength", "kernelUnitLength"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREACTIVATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeactivate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONPROPERTYCHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onpropertychange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDATASETCHANGED = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondatasetchanged"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName MASKCONTENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("maskcontentunits", "maskContentUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATTERNTRANSFORM = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patterntransform", "patternTransform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REQUIREDFEATURES = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("requiredfeatures", "requiredFeatures"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName RENDERING_INTENT = new AttributeName(ALL_NO_NS, SAME_LOCAL("rendering-intent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPECULAREXPONENT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("specularexponent", "specularExponent"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SPECULARCONSTANT = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("specularconstant", "specularConstant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SUPERSCRIPTSHIFT = new AttributeName(ALL_NO_NS, SAME_LOCAL("superscriptshift"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_DASHARRAY = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-dasharray"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName XCHANNELSELECTOR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("xchannelselector", "xChannelSelector"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName YCHANNELSELECTOR = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("ychannelselector", "yChannelSelector"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_AUTOCOMPLETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-autocomplete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ENABLE_BACKGROUND = new AttributeName(ALL_NO_NS, SAME_LOCAL("enable-background"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName DOMINANT_BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("dominant-baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GRADIENTTRANSFORM = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("gradienttransform", "gradientTransform"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFORDEACTIVATE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbefordeactivate"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONDATASETCOMPLETE = new AttributeName(ALL_NO_NS, SAME_LOCAL("ondatasetcomplete"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OVERLINE_POSITION = new AttributeName(ALL_NO_NS, SAME_LOCAL("overline-position"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONBEFOREEDITFOCUS = new AttributeName(ALL_NO_NS, SAME_LOCAL("onbeforeeditfocus"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName LIMITINGCONEANGLE = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("limitingconeangle", "limitingConeAngle"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERYTHINMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("verythinmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_DASHOFFSET = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-dashoffset"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STROKE_MITERLIMIT = new AttributeName(ALL_NO_NS, SAME_LOCAL("stroke-miterlimit"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ALIGNMENT_BASELINE = new AttributeName(ALL_NO_NS, SAME_LOCAL("alignment-baseline"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ONREADYSTATECHANGE = new AttributeName(ALL_NO_NS, SAME_LOCAL("onreadystatechange"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName OVERLINE_THICKNESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("overline-thickness"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNDERLINE_POSITION = new AttributeName(ALL_NO_NS, SAME_LOCAL("underline-position"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERYTHICKMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("verythickmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName REQUIREDEXTENSIONS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("requiredextensions", "requiredExtensions"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLOR_INTERPOLATION = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-interpolation"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName UNDERLINE_THICKNESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("underline-thickness"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PRESERVEASPECTRATIO = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("preserveaspectratio", "preserveAspectRatio"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName PATTERNCONTENTUNITS = new AttributeName(ALL_NO_NS, SVG_DIFFERENT("patterncontentunits", "patternContentUnits"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_MULTISELECTABLE = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-multiselectable"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName SCRIPTSIZEMULTIPLIER = new AttributeName(ALL_NO_NS, SAME_LOCAL("scriptsizemultiplier"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName ARIA_ACTIVEDESCENDANT = new AttributeName(ALL_NO_NS, SAME_LOCAL("aria-activedescendant"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERYVERYTHINMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("veryverythinmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName VERYVERYTHICKMATHSPACE = new AttributeName(ALL_NO_NS, SAME_LOCAL("veryverythickmathspace"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STRIKETHROUGH_POSITION = new AttributeName(ALL_NO_NS, SAME_LOCAL("strikethrough-position"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName STRIKETHROUGH_THICKNESS = new AttributeName(ALL_NO_NS, SAME_LOCAL("strikethrough-thickness"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GLYPH_ORIENTATION_VERTICAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("glyph-orientation-vertical"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName COLOR_INTERPOLATION_FILTERS = new AttributeName(ALL_NO_NS, SAME_LOCAL("color-interpolation-filters"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- public static final AttributeName GLYPH_ORIENTATION_HORIZONTAL = new AttributeName(ALL_NO_NS, SAME_LOCAL("glyph-orientation-horizontal"), ALL_NO_PREFIX, NCNAME_HTML | NCNAME_FOREIGN | NCNAME_LANG);
- private final static @NoLength AttributeName[] ATTRIBUTE_NAMES = {
- D,
- K,
- R,
- X,
- Y,
- Z,
- BY,
- CX,
- CY,
- DX,
- DY,
- G2,
- G1,
- FX,
- FY,
- K4,
- K2,
- K3,
- K1,
- ID,
- IN,
- U2,
- U1,
- RT,
- RX,
- RY,
- TO,
- Y2,
- Y1,
- X1,
- X2,
- ALT,
- DIR,
- DUR,
- END,
- FOR,
- IN2,
- MAX,
- MIN,
- LOW,
- REL,
- REV,
- SRC,
- AXIS,
- ABBR,
- BBOX,
- CITE,
- CODE,
- BIAS,
- COLS,
- CLIP,
- CHAR,
- BASE,
- EDGE,
- DATA,
- FILL,
- FROM,
- FORM,
- FACE,
- HIGH,
- HREF,
- OPEN,
- ICON,
- NAME,
- MODE,
- MASK,
- LINK,
- LANG,
- LOOP,
- LIST,
- TYPE,
- WHEN,
- WRAP,
- TEXT,
- PATH,
- PING,
- REFX,
- REFY,
- SIZE,
- SEED,
- ROWS,
- SPAN,
- STEP,
- ROLE,
- XREF,
- ASYNC,
- ALINK,
- ALIGN,
- CLOSE,
- COLOR,
- CLASS,
- CLEAR,
- BEGIN,
- DEPTH,
- DEFER,
- FENCE,
- FRAME,
- ISMAP,
- ONEND,
- INDEX,
- ORDER,
- OTHER,
- ONCUT,
- NARGS,
- MEDIA,
- LABEL,
- LOCAL,
- WIDTH,
- TITLE,
- VLINK,
- VALUE,
- SLOPE,
- SHAPE,
- SCOPE,
- SCALE,
- SPEED,
- STYLE,
- RULES,
- STEMH,
- SIZES,
- STEMV,
- START,
- XMLNS,
- ACCEPT,
- ACCENT,
- ASCENT,
- ACTIVE,
- ALTIMG,
- ACTION,
- BORDER,
- CURSOR,
- COORDS,
- FILTER,
- FORMAT,
- HIDDEN,
- HSPACE,
- HEIGHT,
- ONMOVE,
- ONLOAD,
- ONDRAG,
- ORIGIN,
- ONZOOM,
- ONHELP,
- ONSTOP,
- ONDROP,
- ONBLUR,
- OBJECT,
- OFFSET,
- ORIENT,
- ONCOPY,
- NOWRAP,
- NOHREF,
- MACROS,
- METHOD,
- LOWSRC,
- LSPACE,
- LQUOTE,
- USEMAP,
- WIDTHS,
- TARGET,
- VALUES,
- VALIGN,
- VSPACE,
- POSTER,
- POINTS,
- PROMPT,
- SRCDOC,
- SCOPED,
- STRING,
- SCHEME,
- STROKE,
- RADIUS,
- RESULT,
- REPEAT,
- SRCSET,
- RSPACE,
- ROTATE,
- RQUOTE,
- ALTTEXT,
- ARCHIVE,
- AZIMUTH,
- CLOSURE,
- CHECKED,
- CLASSID,
- CHAROFF,
- BGCOLOR,
- COLSPAN,
- CHARSET,
- COMPACT,
- CONTENT,
- ENCTYPE,
- DATASRC,
- DATAFLD,
- DECLARE,
- DISPLAY,
- DIVISOR,
- DEFAULT,
- DESCENT,
- KERNING,
- HANGING,
- HEADERS,
- ONPASTE,
- ONCLICK,
- OPTIMUM,
- ONBEGIN,
- ONKEYUP,
- ONFOCUS,
- ONERROR,
- ONINPUT,
- ONABORT,
- ONSTART,
- ONRESET,
- OPACITY,
- NOSHADE,
- MINSIZE,
- MAXSIZE,
- LARGEOP,
- UNICODE,
- TARGETX,
- TARGETY,
- VIEWBOX,
- VERSION,
- PATTERN,
- PROFILE,
- SPACING,
- RESTART,
- ROWSPAN,
- SANDBOX,
- SUMMARY,
- STANDBY,
- REPLACE,
- AUTOPLAY,
- ADDITIVE,
- CALCMODE,
- CODETYPE,
- CODEBASE,
- CONTROLS,
- BEVELLED,
- BASELINE,
- EXPONENT,
- EDGEMODE,
- ENCODING,
- GLYPHREF,
- DATETIME,
- DISABLED,
- FONTSIZE,
- KEYTIMES,
- PANOSE_1,
- HREFLANG,
- ONRESIZE,
- ONCHANGE,
- ONBOUNCE,
- ONUNLOAD,
- ONFINISH,
- ONSCROLL,
- OPERATOR,
- OVERFLOW,
- ONSUBMIT,
- ONREPEAT,
- ONSELECT,
- NOTATION,
- NORESIZE,
- MANIFEST,
- MATHSIZE,
- MULTIPLE,
- LONGDESC,
- LANGUAGE,
- TEMPLATE,
- TABINDEX,
- PROPERTY,
- READONLY,
- SELECTED,
- ROWLINES,
- SEAMLESS,
- ROWALIGN,
- STRETCHY,
- REQUIRED,
- XML_BASE,
- XML_LANG,
- X_HEIGHT,
- ARIA_OWNS,
- AUTOFOCUS,
- ARIA_SORT,
- ACCESSKEY,
- ARIA_BUSY,
- ARIA_GRAB,
- AMPLITUDE,
- ARIA_LIVE,
- CLIP_RULE,
- CLIP_PATH,
- EQUALROWS,
- ELEVATION,
- DIRECTION,
- DRAGGABLE,
- FILL_RULE,
- FONTSTYLE,
- FONT_SIZE,
- KEYSYSTEM,
- KEYPOINTS,
- HIDEFOCUS,
- ONMESSAGE,
- INTERCEPT,
- ONDRAGEND,
- ONMOVEEND,
- ONINVALID,
- INTEGRITY,
- ONKEYDOWN,
- ONFOCUSIN,
- ONMOUSEUP,
- INPUTMODE,
- ONROWEXIT,
- MATHCOLOR,
- MASKUNITS,
- MAXLENGTH,
- LINEBREAK,
- TRANSFORM,
- V_HANGING,
- VALUETYPE,
- POINTSATZ,
- POINTSATX,
- POINTSATY,
- SYMMETRIC,
- SCROLLING,
- REPEATDUR,
- SELECTION,
- SEPARATOR,
- XML_SPACE,
- AUTOSUBMIT,
- ALPHABETIC,
- ACTIONTYPE,
- ACCUMULATE,
- ARIA_LEVEL,
- COLUMNSPAN,
- CAP_HEIGHT,
- BACKGROUND,
- GLYPH_NAME,
- GROUPALIGN,
- FONTFAMILY,
- FONTWEIGHT,
- FONT_STYLE,
- KEYSPLINES,
- HTTP_EQUIV,
- ONACTIVATE,
- OCCURRENCE,
- IRRELEVANT,
- ONDBLCLICK,
- ONDRAGDROP,
- ONKEYPRESS,
- ONROWENTER,
- ONDRAGOVER,
- ONFOCUSOUT,
- ONMOUSEOUT,
- NUMOCTAVES,
- MARKER_MID,
- MARKER_END,
- TEXTLENGTH,
- VISIBILITY,
- VIEWTARGET,
- VERT_ADV_Y,
- PATHLENGTH,
- REPEAT_MAX,
- RADIOGROUP,
- STOP_COLOR,
- SEPARATORS,
- REPEAT_MIN,
- ROWSPACING,
- ZOOMANDPAN,
- XLINK_TYPE,
- XLINK_ROLE,
- XLINK_HREF,
- XLINK_SHOW,
- ACCENTUNDER,
- ARIA_SECRET,
- ARIA_ATOMIC,
- ARIA_HIDDEN,
- ARIA_FLOWTO,
- ARABIC_FORM,
- CELLPADDING,
- CELLSPACING,
- COLUMNWIDTH,
- CROSSORIGIN,
- COLUMNALIGN,
- COLUMNLINES,
- CONTEXTMENU,
- BASEPROFILE,
- FONT_FAMILY,
- FRAMEBORDER,
- FILTERUNITS,
- FLOOD_COLOR,
- FONT_WEIGHT,
- HORIZ_ADV_X,
- ONDRAGLEAVE,
- ONMOUSEMOVE,
- ORIENTATION,
- ONMOUSEDOWN,
- ONMOUSEOVER,
- ONDRAGENTER,
- IDEOGRAPHIC,
- ONBEFORECUT,
- ONFORMINPUT,
- ONDRAGSTART,
- ONMOVESTART,
- MARKERUNITS,
- MATHVARIANT,
- MARGINWIDTH,
- MARKERWIDTH,
- TEXT_ANCHOR,
- TABLEVALUES,
- SCRIPTLEVEL,
- REPEATCOUNT,
- STITCHTILES,
- STARTOFFSET,
- SCROLLDELAY,
- XMLNS_XLINK,
- XLINK_TITLE,
- ARIA_INVALID,
- ARIA_PRESSED,
- ARIA_CHECKED,
- AUTOCOMPLETE,
- ARIA_SETSIZE,
- ARIA_CHANNEL,
- EQUALCOLUMNS,
- DISPLAYSTYLE,
- DATAFORMATAS,
- FILL_OPACITY,
- FONT_VARIANT,
- FONT_STRETCH,
- FRAMESPACING,
- KERNELMATRIX,
- ONDEACTIVATE,
- ONROWSDELETE,
- ONMOUSELEAVE,
- ONFORMCHANGE,
- ONCELLCHANGE,
- ONMOUSEWHEEL,
- ONMOUSEENTER,
- ONAFTERPRINT,
- ONBEFORECOPY,
- MARGINHEIGHT,
- MARKERHEIGHT,
- MARKER_START,
- MATHEMATICAL,
- LENGTHADJUST,
- UNSELECTABLE,
- UNICODE_BIDI,
- UNITS_PER_EM,
- WORD_SPACING,
- WRITING_MODE,
- V_ALPHABETIC,
- PATTERNUNITS,
- SPREADMETHOD,
- SURFACESCALE,
- STROKE_WIDTH,
- REPEAT_START,
- STDDEVIATION,
- STOP_OPACITY,
- ARIA_CONTROLS,
- ARIA_HASPOPUP,
- ACCENT_HEIGHT,
- ARIA_VALUENOW,
- ARIA_RELEVANT,
- ARIA_POSINSET,
- ARIA_VALUEMAX,
- ARIA_READONLY,
- ARIA_SELECTED,
- ARIA_REQUIRED,
- ARIA_EXPANDED,
- ARIA_DISABLED,
- ATTRIBUTETYPE,
- ATTRIBUTENAME,
- ARIA_DATATYPE,
- ARIA_VALUEMIN,
- BASEFREQUENCY,
- COLUMNSPACING,
- COLOR_PROFILE,
- CLIPPATHUNITS,
- DEFINITIONURL,
- GRADIENTUNITS,
- FLOOD_OPACITY,
- ONAFTERUPDATE,
- ONERRORUPDATE,
- ONBEFOREPASTE,
- ONLOSECAPTURE,
- ONCONTEXTMENU,
- ONSELECTSTART,
- ONBEFOREPRINT,
- MOVABLELIMITS,
- LINETHICKNESS,
- UNICODE_RANGE,
- THINMATHSPACE,
- VERT_ORIGIN_X,
- VERT_ORIGIN_Y,
- V_IDEOGRAPHIC,
- PRESERVEALPHA,
- SCRIPTMINSIZE,
- SPECIFICATION,
- XLINK_ACTUATE,
- XLINK_ARCROLE,
- ACCEPT_CHARSET,
- ALIGNMENTSCOPE,
- ARIA_MULTILINE,
- BASELINE_SHIFT,
- HORIZ_ORIGIN_X,
- HORIZ_ORIGIN_Y,
- ONBEFOREUPDATE,
- ONFILTERCHANGE,
- ONROWSINSERTED,
- ONBEFOREUNLOAD,
- MATHBACKGROUND,
- LETTER_SPACING,
- LIGHTING_COLOR,
- THICKMATHSPACE,
- TEXT_RENDERING,
- V_MATHEMATICAL,
- POINTER_EVENTS,
- PRIMITIVEUNITS,
- REFERRERPOLICY,
- SYSTEMLANGUAGE,
- STROKE_LINECAP,
- SUBSCRIPTSHIFT,
- STROKE_OPACITY,
- ARIA_DROPEFFECT,
- ARIA_LABELLEDBY,
- ARIA_TEMPLATEID,
- COLOR_RENDERING,
- CONTENTEDITABLE,
- DIFFUSECONSTANT,
- ONDATAAVAILABLE,
- ONCONTROLSELECT,
- IMAGE_RENDERING,
- MEDIUMMATHSPACE,
- TEXT_DECORATION,
- SHAPE_RENDERING,
- STROKE_LINEJOIN,
- REPEAT_TEMPLATE,
- ARIA_DESCRIBEDBY,
- FONT_SIZE_ADJUST,
- KERNELUNITLENGTH,
- ONBEFOREACTIVATE,
- ONPROPERTYCHANGE,
- ONDATASETCHANGED,
- MASKCONTENTUNITS,
- PATTERNTRANSFORM,
- REQUIREDFEATURES,
- RENDERING_INTENT,
- SPECULAREXPONENT,
- SPECULARCONSTANT,
- SUPERSCRIPTSHIFT,
- STROKE_DASHARRAY,
- XCHANNELSELECTOR,
- YCHANNELSELECTOR,
- ARIA_AUTOCOMPLETE,
- ENABLE_BACKGROUND,
- DOMINANT_BASELINE,
- GRADIENTTRANSFORM,
- ONBEFORDEACTIVATE,
- ONDATASETCOMPLETE,
- OVERLINE_POSITION,
- ONBEFOREEDITFOCUS,
- LIMITINGCONEANGLE,
- VERYTHINMATHSPACE,
- STROKE_DASHOFFSET,
- STROKE_MITERLIMIT,
- ALIGNMENT_BASELINE,
- ONREADYSTATECHANGE,
- OVERLINE_THICKNESS,
- UNDERLINE_POSITION,
- VERYTHICKMATHSPACE,
- REQUIREDEXTENSIONS,
- COLOR_INTERPOLATION,
- UNDERLINE_THICKNESS,
- PRESERVEASPECTRATIO,
- PATTERNCONTENTUNITS,
- ARIA_MULTISELECTABLE,
- SCRIPTSIZEMULTIPLIER,
- ARIA_ACTIVEDESCENDANT,
- VERYVERYTHINMATHSPACE,
- VERYVERYTHICKMATHSPACE,
- STRIKETHROUGH_POSITION,
- STRIKETHROUGH_THICKNESS,
- GLYPH_ORIENTATION_VERTICAL,
- COLOR_INTERPOLATION_FILTERS,
- GLYPH_ORIENTATION_HORIZONTAL,
- };
- private final static int[] ATTRIBUTE_HASHES = {
- 1153,
- 1383,
- 1601,
- 1793,
- 1827,
- 1857,
- 68600,
- 69146,
- 69177,
- 70237,
- 70270,
- 71572,
- 71669,
- 72415,
- 72444,
- 74846,
- 74904,
- 74943,
- 75001,
- 75276,
- 75590,
- 84742,
- 84839,
- 85575,
- 85963,
- 85992,
- 87204,
- 88074,
- 88171,
- 89130,
- 89163,
- 3207892,
- 3283895,
- 3284791,
- 3338752,
- 3358197,
- 3369562,
- 3539124,
- 3562402,
- 3574260,
- 3670335,
- 3696933,
- 3721879,
- 135280021,
- 135346322,
- 136317019,
- 136475749,
- 136548517,
- 136652214,
- 136884919,
- 136902418,
- 136942992,
- 137292068,
- 139120259,
- 139785574,
- 142250603,
- 142314056,
- 142331176,
- 142519584,
- 144752417,
- 145106895,
- 146147200,
- 146765926,
- 148805544,
- 149655723,
- 149809441,
- 150018784,
- 150445028,
- 150813181,
- 150923321,
- 152528754,
- 152536216,
- 152647366,
- 152962785,
- 155219321,
- 155654904,
- 157317483,
- 157350248,
- 157437941,
- 157447478,
- 157604838,
- 157685404,
- 157894402,
- 158315188,
- 166078431,
- 169409980,
- 169700259,
- 169856932,
- 170007032,
- 170409695,
- 170466488,
- 170513710,
- 170608367,
- 173028944,
- 173896963,
- 176090625,
- 176129212,
- 179390001,
- 179489057,
- 179627464,
- 179840468,
- 179849042,
- 180004216,
- 181779081,
- 183027151,
- 183645319,
- 183698797,
- 185922012,
- 185997252,
- 188312483,
- 188675799,
- 190977533,
- 190992569,
- 191006194,
- 191033518,
- 191038774,
- 191096249,
- 191166163,
- 191194426,
- 191443343,
- 191522106,
- 191568039,
- 200104642,
- 202506661,
- 202537381,
- 202602917,
- 203070590,
- 203120766,
- 203389054,
- 203690071,
- 203971238,
- 203986524,
- 209040857,
- 209125756,
- 212055489,
- 212322418,
- 212746849,
- 213002877,
- 213055164,
- 213088023,
- 213259873,
- 213273386,
- 213435118,
- 213437318,
- 213438231,
- 213493071,
- 213532268,
- 213542834,
- 213584431,
- 213659891,
- 215285828,
- 215880731,
- 216112976,
- 216684637,
- 217369699,
- 217565298,
- 217576549,
- 218186795,
- 219743185,
- 220082234,
- 221623802,
- 221986406,
- 222283890,
- 223089542,
- 223138630,
- 223311265,
- 224431494,
- 224547358,
- 224587256,
- 224589550,
- 224655650,
- 224785518,
- 224810917,
- 224813302,
- 225126263,
- 225429618,
- 225432950,
- 225440869,
- 236107233,
- 236709921,
- 236838947,
- 237117095,
- 237143271,
- 237172455,
- 237209953,
- 237354143,
- 237372743,
- 237668065,
- 237703073,
- 237714273,
- 239743521,
- 240512803,
- 240522627,
- 240560417,
- 240656513,
- 241015715,
- 241062755,
- 241065383,
- 243523041,
- 245865199,
- 246261793,
- 246556195,
- 246774817,
- 246923491,
- 246928419,
- 246981667,
- 247014847,
- 247058369,
- 247112833,
- 247118177,
- 247119137,
- 247128739,
- 247316903,
- 249533729,
- 250235623,
- 250269543,
- 251402351,
- 252339047,
- 253260911,
- 253293679,
- 254844367,
- 255547879,
- 256077281,
- 256345377,
- 258124199,
- 258354465,
- 258605063,
- 258744193,
- 258845603,
- 258856961,
- 258926689,
- 269869248,
- 270174334,
- 270709417,
- 270778994,
- 270781796,
- 271102503,
- 271478858,
- 271490090,
- 272870654,
- 273335275,
- 273369140,
- 273924313,
- 274108530,
- 274116736,
- 276818662,
- 277476156,
- 279156579,
- 279349675,
- 280108533,
- 280128712,
- 280132869,
- 280162403,
- 280280292,
- 280413430,
- 280506130,
- 280677397,
- 280678580,
- 280686710,
- 280689066,
- 282736758,
- 283110901,
- 283275116,
- 283823226,
- 283890012,
- 284479340,
- 284606461,
- 286700477,
- 286798916,
- 290055764,
- 291557706,
- 291665349,
- 291804100,
- 292138018,
- 292166446,
- 292418738,
- 292451039,
- 300298041,
- 300374839,
- 300597935,
- 303073389,
- 303083839,
- 303266673,
- 303354997,
- 303430688,
- 303576261,
- 303724281,
- 303819694,
- 304242723,
- 304382625,
- 306247792,
- 307227811,
- 307468786,
- 307724489,
- 310252031,
- 310358241,
- 310373094,
- 310833159,
- 311015256,
- 313357609,
- 313683893,
- 313701861,
- 313706996,
- 313707317,
- 313710350,
- 313795700,
- 314027746,
- 314038181,
- 314091299,
- 314205627,
- 314233813,
- 316741830,
- 316797986,
- 317486755,
- 317794164,
- 320076137,
- 322657125,
- 322887778,
- 323506876,
- 323572412,
- 323605180,
- 325060058,
- 325320188,
- 325398738,
- 325541490,
- 325671619,
- 333868843,
- 336806130,
- 337212108,
- 337282686,
- 337285434,
- 337585223,
- 338036037,
- 338298087,
- 338566051,
- 340943551,
- 341190970,
- 342995704,
- 343352124,
- 343912673,
- 344585053,
- 346977248,
- 347218098,
- 347262163,
- 347278576,
- 347438191,
- 347655959,
- 347684788,
- 347726430,
- 347727772,
- 347776035,
- 347776629,
- 349500753,
- 350880161,
- 350887073,
- 353384123,
- 355496998,
- 355906922,
- 355979793,
- 356545959,
- 358637867,
- 358905016,
- 359164318,
- 359247286,
- 359350571,
- 359579447,
- 365560330,
- 367399355,
- 367420285,
- 367510727,
- 368013212,
- 370234760,
- 370353345,
- 370710317,
- 371074566,
- 371122285,
- 371194213,
- 371448425,
- 371448430,
- 371545055,
- 371593469,
- 371596922,
- 371758751,
- 371964792,
- 372151328,
- 376550136,
- 376710172,
- 376795771,
- 376826271,
- 376906556,
- 380514830,
- 380774774,
- 380775037,
- 381030322,
- 381136500,
- 381281631,
- 381282269,
- 381285504,
- 381330595,
- 381331422,
- 381335911,
- 381336484,
- 383907298,
- 383917408,
- 384595009,
- 384595013,
- 387799894,
- 387823201,
- 392581647,
- 392584937,
- 392742684,
- 392906485,
- 393003349,
- 400644707,
- 400973830,
- 404428547,
- 404432113,
- 404432865,
- 404469244,
- 404478897,
- 404694860,
- 406887479,
- 408294949,
- 408789955,
- 410022510,
- 410467324,
- 410586448,
- 410945965,
- 411845275,
- 414327152,
- 414327932,
- 414329781,
- 414346257,
- 414346439,
- 414639928,
- 414835998,
- 414894517,
- 414986533,
- 417465377,
- 417465381,
- 417492216,
- 418259232,
- 419310946,
- 420103495,
- 420242342,
- 420380455,
- 420658662,
- 420717432,
- 423183880,
- 424539259,
- 425929170,
- 425972964,
- 426050649,
- 426126450,
- 426142833,
- 426607922,
- 437289840,
- 437347469,
- 437412335,
- 437423943,
- 437455540,
- 437462252,
- 437597991,
- 437617485,
- 437986305,
- 437986507,
- 437986828,
- 437987072,
- 438015591,
- 438034813,
- 438038966,
- 438179623,
- 438347971,
- 438483573,
- 438547062,
- 438895551,
- 441592676,
- 442032555,
- 443548979,
- 447881379,
- 447881655,
- 447881895,
- 447887844,
- 448416189,
- 448445746,
- 448449012,
- 450942191,
- 452816744,
- 453668677,
- 454434495,
- 456610076,
- 456642844,
- 456738709,
- 457544600,
- 459451897,
- 459680944,
- 468058810,
- 468083581,
- 470964084,
- 471470955,
- 471567278,
- 472267822,
- 481177859,
- 481210627,
- 481435874,
- 481455115,
- 481485378,
- 481490218,
- 485105638,
- 486005878,
- 486383494,
- 487988916,
- 488103783,
- 490661867,
- 491574090,
- 491578272,
- 492891370,
- 493041952,
- 493441205,
- 493582844,
- 493716979,
- 504577572,
- 504740359,
- 505091638,
- 505592418,
- 505656212,
- 509516275,
- 514998531,
- 515571132,
- 515594682,
- 518712698,
- 521362273,
- 526592419,
- 526807354,
- 527348842,
- 538294791,
- 544689535,
- 545535009,
- 548544752,
- 548563346,
- 548595116,
- 551679010,
- 558034099,
- 560329411,
- 560356209,
- 560671018,
- 560671152,
- 560692590,
- 560845442,
- 569212097,
- 569474241,
- 572252718,
- 575326764,
- 576174758,
- 576190819,
- 582099184,
- 582099438,
- 582372519,
- 582558889,
- 586552164,
- 591325418,
- 594231990,
- 594243961,
- 605711268,
- 615672071,
- 616086845,
- 621792370,
- 624879850,
- 627432831,
- 640040548,
- 654392808,
- 658675477,
- 659420283,
- 672891587,
- 694768102,
- 705890982,
- 725543146,
- 759097578,
- 761686526,
- 795383908,
- 878105336,
- 908643300,
- 945213471,
- };
-}
diff --git a/parser/html/javasrc/ElementName.java b/parser/html/javasrc/ElementName.java
deleted file mode 100644
index ee551a737..000000000
--- a/parser/html/javasrc/ElementName.java
+++ /dev/null
@@ -1,1609 +0,0 @@
-/*
- * Copyright (c) 2008-2014 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import java.util.Arrays;
-
-import nu.validator.htmlparser.annotation.Inline;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NoLength;
-import nu.validator.htmlparser.annotation.Virtual;
-import nu.validator.htmlparser.common.Interner;
-
-public final class ElementName
-// uncomment when regenerating self
-// implements Comparable<ElementName>
-{
-
- /**
- * The mask for extracting the dispatch group.
- */
- public static final int GROUP_MASK = 127;
-
- /**
- * Indicates that the element is not a pre-interned element. Forbidden
- * on preinterned elements.
- */
- public static final int CUSTOM = (1 << 30);
-
- /**
- * Indicates that the element is in the "special" category. This bit
- * should not be pre-set on MathML or SVG specials--only on HTML specials.
- */
- public static final int SPECIAL = (1 << 29);
-
- /**
- * The element is foster-parenting. This bit should be pre-set on elements
- * that are foster-parenting as HTML.
- */
- public static final int FOSTER_PARENTING = (1 << 28);
-
- /**
- * The element is scoping. This bit should be pre-set on elements
- * that are scoping as HTML.
- */
- public static final int SCOPING = (1 << 27);
-
- /**
- * The element is scoping as SVG.
- */
- public static final int SCOPING_AS_SVG = (1 << 26);
-
- /**
- * The element is scoping as MathML.
- */
- public static final int SCOPING_AS_MATHML = (1 << 25);
-
- /**
- * The element is an HTML integration point.
- */
- public static final int HTML_INTEGRATION_POINT = (1 << 24);
-
- /**
- * The element has an optional end tag.
- */
- public static final int OPTIONAL_END_TAG = (1 << 23);
-
- public static final ElementName NULL_ELEMENT_NAME = new ElementName(null);
-
- public final @Local String name;
-
- public final @Local String camelCaseName;
-
- /**
- * The lowest 7 bits are the dispatch group. The high bits are flags.
- */
- public final int flags;
-
- @Inline public int getFlags() {
- return flags;
- }
-
- public int getGroup() {
- return flags & GROUP_MASK;
- }
-
- public boolean isCustom() {
- return (flags & CUSTOM) != 0;
- }
-
- static ElementName elementNameByBuffer(@NoLength char[] buf, int offset, int length, Interner interner) {
- int hash = ElementName.bufToHash(buf, length);
- int index = Arrays.binarySearch(ElementName.ELEMENT_HASHES, hash);
- if (index < 0) {
- return new ElementName(Portability.newLocalNameFromBuffer(buf, offset, length, interner));
- } else {
- ElementName elementName = ElementName.ELEMENT_NAMES[index];
- @Local String name = elementName.name;
- if (!Portability.localEqualsBuffer(name, buf, offset, length)) {
- return new ElementName(Portability.newLocalNameFromBuffer(buf,
- offset, length, interner));
- }
- return elementName;
- }
- }
-
- /**
- * This method has to return a unique integer for each well-known
- * lower-cased element name.
- *
- * @param buf
- * @param len
- * @return
- */
- private static int bufToHash(@NoLength char[] buf, int len) {
- int hash = len;
- hash <<= 5;
- hash += buf[0] - 0x60;
- int j = len;
- for (int i = 0; i < 4 && j > 0; i++) {
- j--;
- hash <<= 5;
- hash += buf[j] - 0x60;
- }
- return hash;
- }
-
- private ElementName(@Local String name, @Local String camelCaseName,
- int flags) {
- this.name = name;
- this.camelCaseName = camelCaseName;
- this.flags = flags;
- }
-
- protected ElementName(@Local String name) {
- this.name = name;
- this.camelCaseName = name;
- this.flags = TreeBuilder.OTHER | CUSTOM;
- }
-
- @Virtual void release() {
- // No-op in Java.
- // Implement as delete this in subclass.
- // Be sure to release the local name
- }
-
- @SuppressWarnings("unused") @Virtual private void destructor() {
- }
-
- @Virtual public ElementName cloneElementName(Interner interner) {
- return this;
- }
-
- // START CODE ONLY USED FOR GENERATING CODE uncomment and run to regenerate
-
-// /**
-// * @see java.lang.Object#toString()
-// */
-// @Override public String toString() {
-// return "(\"" + name + "\", \"" + camelCaseName + "\", " + decomposedFlags() + ")";
-// }
-//
-// private String decomposedFlags() {
-// StringBuilder buf = new StringBuilder("TreeBuilder.");
-// buf.append(treeBuilderGroupToName());
-// if ((flags & SPECIAL) != 0) {
-// buf.append(" | SPECIAL");
-// }
-// if ((flags & FOSTER_PARENTING) != 0) {
-// buf.append(" | FOSTER_PARENTING");
-// }
-// if ((flags & SCOPING) != 0) {
-// buf.append(" | SCOPING");
-// }
-// if ((flags & SCOPING_AS_MATHML) != 0) {
-// buf.append(" | SCOPING_AS_MATHML");
-// }
-// if ((flags & SCOPING_AS_SVG) != 0) {
-// buf.append(" | SCOPING_AS_SVG");
-// }
-// if ((flags & OPTIONAL_END_TAG) != 0) {
-// buf.append(" | OPTIONAL_END_TAG");
-// }
-// return buf.toString();
-// }
-//
-// private String constName() {
-// char[] buf = new char[name.length()];
-// for (int i = 0; i < name.length(); i++) {
-// char c = name.charAt(i);
-// if (c == '-') {
-// buf[i] = '_';
-// } else if (c >= '0' && c <= '9') {
-// buf[i] = c;
-// } else {
-// buf[i] = (char) (c - 0x20);
-// }
-// }
-// return new String(buf);
-// }
-//
-// private int hash() {
-// return bufToHash(name.toCharArray(), name.length());
-// }
-//
-// public int compareTo(ElementName other) {
-// int thisHash = this.hash();
-// int otherHash = other.hash();
-// if (thisHash < otherHash) {
-// return -1;
-// } else if (thisHash == otherHash) {
-// return 0;
-// } else {
-// return 1;
-// }
-// }
-//
-// private String treeBuilderGroupToName() {
-// switch (getGroup()) {
-// case TreeBuilder.OTHER:
-// return "OTHER";
-// case TreeBuilder.A:
-// return "A";
-// case TreeBuilder.BASE:
-// return "BASE";
-// case TreeBuilder.BODY:
-// return "BODY";
-// case TreeBuilder.BR:
-// return "BR";
-// case TreeBuilder.BUTTON:
-// return "BUTTON";
-// case TreeBuilder.CAPTION:
-// return "CAPTION";
-// case TreeBuilder.COL:
-// return "COL";
-// case TreeBuilder.COLGROUP:
-// return "COLGROUP";
-// case TreeBuilder.FONT:
-// return "FONT";
-// case TreeBuilder.FORM:
-// return "FORM";
-// case TreeBuilder.FRAME:
-// return "FRAME";
-// case TreeBuilder.FRAMESET:
-// return "FRAMESET";
-// case TreeBuilder.IMAGE:
-// return "IMAGE";
-// case TreeBuilder.INPUT:
-// return "INPUT";
-// case TreeBuilder.ISINDEX:
-// return "ISINDEX";
-// case TreeBuilder.LI:
-// return "LI";
-// case TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND:
-// return "LINK_OR_BASEFONT_OR_BGSOUND";
-// case TreeBuilder.MATH:
-// return "MATH";
-// case TreeBuilder.META:
-// return "META";
-// case TreeBuilder.SVG:
-// return "SVG";
-// case TreeBuilder.HEAD:
-// return "HEAD";
-// case TreeBuilder.HR:
-// return "HR";
-// case TreeBuilder.HTML:
-// return "HTML";
-// case TreeBuilder.KEYGEN:
-// return "KEYGEN";
-// case TreeBuilder.NOBR:
-// return "NOBR";
-// case TreeBuilder.NOFRAMES:
-// return "NOFRAMES";
-// case TreeBuilder.NOSCRIPT:
-// return "NOSCRIPT";
-// case TreeBuilder.OPTGROUP:
-// return "OPTGROUP";
-// case TreeBuilder.OPTION:
-// return "OPTION";
-// case TreeBuilder.P:
-// return "P";
-// case TreeBuilder.PLAINTEXT:
-// return "PLAINTEXT";
-// case TreeBuilder.SCRIPT:
-// return "SCRIPT";
-// case TreeBuilder.SELECT:
-// return "SELECT";
-// case TreeBuilder.STYLE:
-// return "STYLE";
-// case TreeBuilder.TABLE:
-// return "TABLE";
-// case TreeBuilder.TEXTAREA:
-// return "TEXTAREA";
-// case TreeBuilder.TITLE:
-// return "TITLE";
-// case TreeBuilder.TEMPLATE:
-// return "TEMPLATE";
-// case TreeBuilder.TR:
-// return "TR";
-// case TreeBuilder.XMP:
-// return "XMP";
-// case TreeBuilder.TBODY_OR_THEAD_OR_TFOOT:
-// return "TBODY_OR_THEAD_OR_TFOOT";
-// case TreeBuilder.TD_OR_TH:
-// return "TD_OR_TH";
-// case TreeBuilder.DD_OR_DT:
-// return "DD_OR_DT";
-// case TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
-// return "H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6";
-// case TreeBuilder.OBJECT:
-// return "OBJECT";
-// case TreeBuilder.OUTPUT:
-// return "OUTPUT";
-// case TreeBuilder.MARQUEE_OR_APPLET:
-// return "MARQUEE_OR_APPLET";
-// case TreeBuilder.PRE_OR_LISTING:
-// return "PRE_OR_LISTING";
-// case TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
-// return "B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U";
-// case TreeBuilder.UL_OR_OL_OR_DL:
-// return "UL_OR_OL_OR_DL";
-// case TreeBuilder.IFRAME:
-// return "IFRAME";
-// case TreeBuilder.NOEMBED:
-// return "NOEMBED";
-// case TreeBuilder.EMBED:
-// return "EMBED";
-// case TreeBuilder.IMG:
-// return "IMG";
-// case TreeBuilder.AREA_OR_WBR:
-// return "AREA_OR_WBR";
-// case TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
-// return "DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU";
-// case TreeBuilder.FIELDSET:
-// return "FIELDSET";
-// case TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
-// return "ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY";
-// case TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
-// return "RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR";
-// case TreeBuilder.RB_OR_RTC:
-// return "RB_OR_RTC";
-// case TreeBuilder.RT_OR_RP:
-// return "RT_OR_RP";
-// case TreeBuilder.PARAM_OR_SOURCE_OR_TRACK:
-// return "PARAM_OR_SOURCE_OR_TRACK";
-// case TreeBuilder.MGLYPH_OR_MALIGNMARK:
-// return "MGLYPH_OR_MALIGNMARK";
-// case TreeBuilder.MI_MO_MN_MS_MTEXT:
-// return "MI_MO_MN_MS_MTEXT";
-// case TreeBuilder.ANNOTATION_XML:
-// return "ANNOTATION_XML";
-// case TreeBuilder.FOREIGNOBJECT_OR_DESC:
-// return "FOREIGNOBJECT_OR_DESC";
-// case TreeBuilder.MENUITEM:
-// return "MENUITEM";
-// }
-// return null;
-// }
-//
-// /**
-// * Regenerate self
-// *
-// * @param args
-// */
-// public static void main(String[] args) {
-// Arrays.sort(ELEMENT_NAMES);
-// for (int i = 1; i < ELEMENT_NAMES.length; i++) {
-// if (ELEMENT_NAMES[i].hash() == ELEMENT_NAMES[i - 1].hash()) {
-// System.err.println("Hash collision: " + ELEMENT_NAMES[i].name
-// + ", " + ELEMENT_NAMES[i - 1].name);
-// return;
-// }
-// }
-// for (int i = 0; i < ELEMENT_NAMES.length; i++) {
-// ElementName el = ELEMENT_NAMES[i];
-// System.out.println("public static final ElementName "
-// + el.constName() + " = new ElementName" + el.toString()
-// + ";");
-// }
-// System.out.println("private final static @NoLength ElementName[] ELEMENT_NAMES = {");
-// for (int i = 0; i < ELEMENT_NAMES.length; i++) {
-// ElementName el = ELEMENT_NAMES[i];
-// System.out.println(el.constName() + ",");
-// }
-// System.out.println("};");
-// System.out.println("private final static int[] ELEMENT_HASHES = {");
-// for (int i = 0; i < ELEMENT_NAMES.length; i++) {
-// ElementName el = ELEMENT_NAMES[i];
-// System.out.println(Integer.toString(el.hash()) + ",");
-// }
-// System.out.println("};");
-// }
-
- // START GENERATED CODE
- public static final ElementName A = new ElementName("a", "a", TreeBuilder.A);
- public static final ElementName B = new ElementName("b", "b", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName G = new ElementName("g", "g", TreeBuilder.OTHER);
- public static final ElementName I = new ElementName("i", "i", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName P = new ElementName("p", "p", TreeBuilder.P | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName Q = new ElementName("q", "q", TreeBuilder.OTHER);
- public static final ElementName S = new ElementName("s", "s", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName U = new ElementName("u", "u", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName BR = new ElementName("br", "br", TreeBuilder.BR | SPECIAL);
- public static final ElementName CI = new ElementName("ci", "ci", TreeBuilder.OTHER);
- public static final ElementName CN = new ElementName("cn", "cn", TreeBuilder.OTHER);
- public static final ElementName DD = new ElementName("dd", "dd", TreeBuilder.DD_OR_DT | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName DL = new ElementName("dl", "dl", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
- public static final ElementName DT = new ElementName("dt", "dt", TreeBuilder.DD_OR_DT | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName EM = new ElementName("em", "em", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName EQ = new ElementName("eq", "eq", TreeBuilder.OTHER);
- public static final ElementName FN = new ElementName("fn", "fn", TreeBuilder.OTHER);
- public static final ElementName H1 = new ElementName("h1", "h1", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName H2 = new ElementName("h2", "h2", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName H3 = new ElementName("h3", "h3", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName H4 = new ElementName("h4", "h4", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName H5 = new ElementName("h5", "h5", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName H6 = new ElementName("h6", "h6", TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 | SPECIAL);
- public static final ElementName GT = new ElementName("gt", "gt", TreeBuilder.OTHER);
- public static final ElementName HR = new ElementName("hr", "hr", TreeBuilder.HR | SPECIAL);
- public static final ElementName IN = new ElementName("in", "in", TreeBuilder.OTHER);
- public static final ElementName LI = new ElementName("li", "li", TreeBuilder.LI | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName LN = new ElementName("ln", "ln", TreeBuilder.OTHER);
- public static final ElementName LT = new ElementName("lt", "lt", TreeBuilder.OTHER);
- public static final ElementName MI = new ElementName("mi", "mi", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
- public static final ElementName MN = new ElementName("mn", "mn", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
- public static final ElementName MO = new ElementName("mo", "mo", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
- public static final ElementName MS = new ElementName("ms", "ms", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
- public static final ElementName OL = new ElementName("ol", "ol", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
- public static final ElementName OR = new ElementName("or", "or", TreeBuilder.OTHER);
- public static final ElementName PI = new ElementName("pi", "pi", TreeBuilder.OTHER);
- public static final ElementName RB = new ElementName("rb", "rb", TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
- public static final ElementName RP = new ElementName("rp", "rp", TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
- public static final ElementName RT = new ElementName("rt", "rt", TreeBuilder.RT_OR_RP | OPTIONAL_END_TAG);
- public static final ElementName TD = new ElementName("td", "td", TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
- public static final ElementName TH = new ElementName("th", "th", TreeBuilder.TD_OR_TH | SPECIAL | SCOPING | OPTIONAL_END_TAG);
- public static final ElementName TR = new ElementName("tr", "tr", TreeBuilder.TR | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
- public static final ElementName TT = new ElementName("tt", "tt", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName UL = new ElementName("ul", "ul", TreeBuilder.UL_OR_OL_OR_DL | SPECIAL);
- public static final ElementName AND = new ElementName("and", "and", TreeBuilder.OTHER);
- public static final ElementName ARG = new ElementName("arg", "arg", TreeBuilder.OTHER);
- public static final ElementName ABS = new ElementName("abs", "abs", TreeBuilder.OTHER);
- public static final ElementName BIG = new ElementName("big", "big", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName BDO = new ElementName("bdo", "bdo", TreeBuilder.OTHER);
- public static final ElementName CSC = new ElementName("csc", "csc", TreeBuilder.OTHER);
- public static final ElementName COL = new ElementName("col", "col", TreeBuilder.COL | SPECIAL);
- public static final ElementName COS = new ElementName("cos", "cos", TreeBuilder.OTHER);
- public static final ElementName COT = new ElementName("cot", "cot", TreeBuilder.OTHER);
- public static final ElementName DEL = new ElementName("del", "del", TreeBuilder.OTHER);
- public static final ElementName DFN = new ElementName("dfn", "dfn", TreeBuilder.OTHER);
- public static final ElementName DIR = new ElementName("dir", "dir", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName DIV = new ElementName("div", "div", TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
- public static final ElementName EXP = new ElementName("exp", "exp", TreeBuilder.OTHER);
- public static final ElementName GCD = new ElementName("gcd", "gcd", TreeBuilder.OTHER);
- public static final ElementName GEQ = new ElementName("geq", "geq", TreeBuilder.OTHER);
- public static final ElementName IMG = new ElementName("img", "img", TreeBuilder.IMG | SPECIAL);
- public static final ElementName INS = new ElementName("ins", "ins", TreeBuilder.OTHER);
- public static final ElementName INT = new ElementName("int", "int", TreeBuilder.OTHER);
- public static final ElementName KBD = new ElementName("kbd", "kbd", TreeBuilder.OTHER);
- public static final ElementName LOG = new ElementName("log", "log", TreeBuilder.OTHER);
- public static final ElementName LCM = new ElementName("lcm", "lcm", TreeBuilder.OTHER);
- public static final ElementName LEQ = new ElementName("leq", "leq", TreeBuilder.OTHER);
- public static final ElementName MTD = new ElementName("mtd", "mtd", TreeBuilder.OTHER);
- public static final ElementName MIN = new ElementName("min", "min", TreeBuilder.OTHER);
- public static final ElementName MAP = new ElementName("map", "map", TreeBuilder.OTHER);
- public static final ElementName MTR = new ElementName("mtr", "mtr", TreeBuilder.OTHER);
- public static final ElementName MAX = new ElementName("max", "max", TreeBuilder.OTHER);
- public static final ElementName NEQ = new ElementName("neq", "neq", TreeBuilder.OTHER);
- public static final ElementName NOT = new ElementName("not", "not", TreeBuilder.OTHER);
- public static final ElementName NAV = new ElementName("nav", "nav", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName PRE = new ElementName("pre", "pre", TreeBuilder.PRE_OR_LISTING | SPECIAL);
- public static final ElementName RTC = new ElementName("rtc", "rtc", TreeBuilder.RB_OR_RTC | OPTIONAL_END_TAG);
- public static final ElementName REM = new ElementName("rem", "rem", TreeBuilder.OTHER);
- public static final ElementName SUB = new ElementName("sub", "sub", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
- public static final ElementName SEC = new ElementName("sec", "sec", TreeBuilder.OTHER);
- public static final ElementName SVG = new ElementName("svg", "svg", TreeBuilder.SVG);
- public static final ElementName SUM = new ElementName("sum", "sum", TreeBuilder.OTHER);
- public static final ElementName SIN = new ElementName("sin", "sin", TreeBuilder.OTHER);
- public static final ElementName SEP = new ElementName("sep", "sep", TreeBuilder.OTHER);
- public static final ElementName SUP = new ElementName("sup", "sup", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
- public static final ElementName SET = new ElementName("set", "set", TreeBuilder.OTHER);
- public static final ElementName TAN = new ElementName("tan", "tan", TreeBuilder.OTHER);
- public static final ElementName USE = new ElementName("use", "use", TreeBuilder.OTHER);
- public static final ElementName VAR = new ElementName("var", "var", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
- public static final ElementName WBR = new ElementName("wbr", "wbr", TreeBuilder.AREA_OR_WBR | SPECIAL);
- public static final ElementName XMP = new ElementName("xmp", "xmp", TreeBuilder.XMP | SPECIAL);
- public static final ElementName XOR = new ElementName("xor", "xor", TreeBuilder.OTHER);
- public static final ElementName AREA = new ElementName("area", "area", TreeBuilder.AREA_OR_WBR | SPECIAL);
- public static final ElementName ABBR = new ElementName("abbr", "abbr", TreeBuilder.OTHER);
- public static final ElementName BASE = new ElementName("base", "base", TreeBuilder.BASE | SPECIAL);
- public static final ElementName BVAR = new ElementName("bvar", "bvar", TreeBuilder.OTHER);
- public static final ElementName BODY = new ElementName("body", "body", TreeBuilder.BODY | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName CARD = new ElementName("card", "card", TreeBuilder.OTHER);
- public static final ElementName CODE = new ElementName("code", "code", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName CITE = new ElementName("cite", "cite", TreeBuilder.OTHER);
- public static final ElementName CSCH = new ElementName("csch", "csch", TreeBuilder.OTHER);
- public static final ElementName COSH = new ElementName("cosh", "cosh", TreeBuilder.OTHER);
- public static final ElementName COTH = new ElementName("coth", "coth", TreeBuilder.OTHER);
- public static final ElementName CURL = new ElementName("curl", "curl", TreeBuilder.OTHER);
- public static final ElementName DESC = new ElementName("desc", "desc", TreeBuilder.FOREIGNOBJECT_OR_DESC | SCOPING_AS_SVG);
- public static final ElementName DIFF = new ElementName("diff", "diff", TreeBuilder.OTHER);
- public static final ElementName DEFS = new ElementName("defs", "defs", TreeBuilder.OTHER);
- public static final ElementName FORM = new ElementName("form", "form", TreeBuilder.FORM | SPECIAL);
- public static final ElementName FONT = new ElementName("font", "font", TreeBuilder.FONT);
- public static final ElementName GRAD = new ElementName("grad", "grad", TreeBuilder.OTHER);
- public static final ElementName HEAD = new ElementName("head", "head", TreeBuilder.HEAD | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName HTML = new ElementName("html", "html", TreeBuilder.HTML | SPECIAL | SCOPING | OPTIONAL_END_TAG);
- public static final ElementName LINE = new ElementName("line", "line", TreeBuilder.OTHER);
- public static final ElementName LINK = new ElementName("link", "link", TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
- public static final ElementName LIST = new ElementName("list", "list", TreeBuilder.OTHER);
- public static final ElementName META = new ElementName("meta", "meta", TreeBuilder.META | SPECIAL);
- public static final ElementName MSUB = new ElementName("msub", "msub", TreeBuilder.OTHER);
- public static final ElementName MODE = new ElementName("mode", "mode", TreeBuilder.OTHER);
- public static final ElementName MATH = new ElementName("math", "math", TreeBuilder.MATH);
- public static final ElementName MARK = new ElementName("mark", "mark", TreeBuilder.OTHER);
- public static final ElementName MASK = new ElementName("mask", "mask", TreeBuilder.OTHER);
- public static final ElementName MEAN = new ElementName("mean", "mean", TreeBuilder.OTHER);
- public static final ElementName MAIN = new ElementName("main", "main", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName MSUP = new ElementName("msup", "msup", TreeBuilder.OTHER);
- public static final ElementName MENU = new ElementName("menu", "menu", TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
- public static final ElementName MROW = new ElementName("mrow", "mrow", TreeBuilder.OTHER);
- public static final ElementName NONE = new ElementName("none", "none", TreeBuilder.OTHER);
- public static final ElementName NOBR = new ElementName("nobr", "nobr", TreeBuilder.NOBR);
- public static final ElementName NEST = new ElementName("nest", "nest", TreeBuilder.OTHER);
- public static final ElementName PATH = new ElementName("path", "path", TreeBuilder.OTHER);
- public static final ElementName PLUS = new ElementName("plus", "plus", TreeBuilder.OTHER);
- public static final ElementName RULE = new ElementName("rule", "rule", TreeBuilder.OTHER);
- public static final ElementName REAL = new ElementName("real", "real", TreeBuilder.OTHER);
- public static final ElementName RELN = new ElementName("reln", "reln", TreeBuilder.OTHER);
- public static final ElementName RECT = new ElementName("rect", "rect", TreeBuilder.OTHER);
- public static final ElementName ROOT = new ElementName("root", "root", TreeBuilder.OTHER);
- public static final ElementName RUBY = new ElementName("ruby", "ruby", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
- public static final ElementName SECH = new ElementName("sech", "sech", TreeBuilder.OTHER);
- public static final ElementName SINH = new ElementName("sinh", "sinh", TreeBuilder.OTHER);
- public static final ElementName SPAN = new ElementName("span", "span", TreeBuilder.RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR);
- public static final ElementName SAMP = new ElementName("samp", "samp", TreeBuilder.OTHER);
- public static final ElementName STOP = new ElementName("stop", "stop", TreeBuilder.OTHER);
- public static final ElementName SDEV = new ElementName("sdev", "sdev", TreeBuilder.OTHER);
- public static final ElementName TIME = new ElementName("time", "time", TreeBuilder.OTHER);
- public static final ElementName TRUE = new ElementName("true", "true", TreeBuilder.OTHER);
- public static final ElementName TREF = new ElementName("tref", "tref", TreeBuilder.OTHER);
- public static final ElementName TANH = new ElementName("tanh", "tanh", TreeBuilder.OTHER);
- public static final ElementName TEXT = new ElementName("text", "text", TreeBuilder.OTHER);
- public static final ElementName VIEW = new ElementName("view", "view", TreeBuilder.OTHER);
- public static final ElementName ASIDE = new ElementName("aside", "aside", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName AUDIO = new ElementName("audio", "audio", TreeBuilder.OTHER);
- public static final ElementName APPLY = new ElementName("apply", "apply", TreeBuilder.OTHER);
- public static final ElementName EMBED = new ElementName("embed", "embed", TreeBuilder.EMBED | SPECIAL);
- public static final ElementName FRAME = new ElementName("frame", "frame", TreeBuilder.FRAME | SPECIAL);
- public static final ElementName FALSE = new ElementName("false", "false", TreeBuilder.OTHER);
- public static final ElementName FLOOR = new ElementName("floor", "floor", TreeBuilder.OTHER);
- public static final ElementName GLYPH = new ElementName("glyph", "glyph", TreeBuilder.OTHER);
- public static final ElementName HKERN = new ElementName("hkern", "hkern", TreeBuilder.OTHER);
- public static final ElementName IMAGE = new ElementName("image", "image", TreeBuilder.IMAGE);
- public static final ElementName IDENT = new ElementName("ident", "ident", TreeBuilder.OTHER);
- public static final ElementName INPUT = new ElementName("input", "input", TreeBuilder.INPUT | SPECIAL);
- public static final ElementName LABEL = new ElementName("label", "label", TreeBuilder.OTHER);
- public static final ElementName LIMIT = new ElementName("limit", "limit", TreeBuilder.OTHER);
- public static final ElementName MFRAC = new ElementName("mfrac", "mfrac", TreeBuilder.OTHER);
- public static final ElementName MPATH = new ElementName("mpath", "mpath", TreeBuilder.OTHER);
- public static final ElementName METER = new ElementName("meter", "meter", TreeBuilder.OTHER);
- public static final ElementName MOVER = new ElementName("mover", "mover", TreeBuilder.OTHER);
- public static final ElementName MINUS = new ElementName("minus", "minus", TreeBuilder.OTHER);
- public static final ElementName MROOT = new ElementName("mroot", "mroot", TreeBuilder.OTHER);
- public static final ElementName MSQRT = new ElementName("msqrt", "msqrt", TreeBuilder.OTHER);
- public static final ElementName MTEXT = new ElementName("mtext", "mtext", TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
- public static final ElementName NOTIN = new ElementName("notin", "notin", TreeBuilder.OTHER);
- public static final ElementName PIECE = new ElementName("piece", "piece", TreeBuilder.OTHER);
- public static final ElementName PARAM = new ElementName("param", "param", TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
- public static final ElementName POWER = new ElementName("power", "power", TreeBuilder.OTHER);
- public static final ElementName REALS = new ElementName("reals", "reals", TreeBuilder.OTHER);
- public static final ElementName STYLE = new ElementName("style", "style", TreeBuilder.STYLE | SPECIAL);
- public static final ElementName SMALL = new ElementName("small", "small", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName THEAD = new ElementName("thead", "thead", TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
- public static final ElementName TABLE = new ElementName("table", "table", TreeBuilder.TABLE | SPECIAL | FOSTER_PARENTING | SCOPING);
- public static final ElementName TITLE = new ElementName("title", "title", TreeBuilder.TITLE | SPECIAL | SCOPING_AS_SVG);
- public static final ElementName TRACK = new ElementName("track", "track", TreeBuilder.PARAM_OR_SOURCE_OR_TRACK | SPECIAL);
- public static final ElementName TSPAN = new ElementName("tspan", "tspan", TreeBuilder.OTHER);
- public static final ElementName TIMES = new ElementName("times", "times", TreeBuilder.OTHER);
- public static final ElementName TFOOT = new ElementName("tfoot", "tfoot", TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
- public static final ElementName TBODY = new ElementName("tbody", "tbody", TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
- public static final ElementName UNION = new ElementName("union", "union", TreeBuilder.OTHER);
- public static final ElementName VKERN = new ElementName("vkern", "vkern", TreeBuilder.OTHER);
- public static final ElementName VIDEO = new ElementName("video", "video", TreeBuilder.OTHER);
- public static final ElementName ARCSEC = new ElementName("arcsec", "arcsec", TreeBuilder.OTHER);
- public static final ElementName ARCCSC = new ElementName("arccsc", "arccsc", TreeBuilder.OTHER);
- public static final ElementName ARCTAN = new ElementName("arctan", "arctan", TreeBuilder.OTHER);
- public static final ElementName ARCSIN = new ElementName("arcsin", "arcsin", TreeBuilder.OTHER);
- public static final ElementName ARCCOS = new ElementName("arccos", "arccos", TreeBuilder.OTHER);
- public static final ElementName APPLET = new ElementName("applet", "applet", TreeBuilder.MARQUEE_OR_APPLET | SPECIAL | SCOPING);
- public static final ElementName ARCCOT = new ElementName("arccot", "arccot", TreeBuilder.OTHER);
- public static final ElementName APPROX = new ElementName("approx", "approx", TreeBuilder.OTHER);
- public static final ElementName BUTTON = new ElementName("button", "button", TreeBuilder.BUTTON | SPECIAL);
- public static final ElementName CIRCLE = new ElementName("circle", "circle", TreeBuilder.OTHER);
- public static final ElementName CENTER = new ElementName("center", "center", TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
- public static final ElementName CURSOR = new ElementName("cursor", "cursor", TreeBuilder.OTHER);
- public static final ElementName CANVAS = new ElementName("canvas", "canvas", TreeBuilder.OTHER);
- public static final ElementName DIVIDE = new ElementName("divide", "divide", TreeBuilder.OTHER);
- public static final ElementName DEGREE = new ElementName("degree", "degree", TreeBuilder.OTHER);
- public static final ElementName DOMAIN = new ElementName("domain", "domain", TreeBuilder.OTHER);
- public static final ElementName EXISTS = new ElementName("exists", "exists", TreeBuilder.OTHER);
- public static final ElementName FETILE = new ElementName("fetile", "feTile", TreeBuilder.OTHER);
- public static final ElementName FIGURE = new ElementName("figure", "figure", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName FORALL = new ElementName("forall", "forall", TreeBuilder.OTHER);
- public static final ElementName FILTER = new ElementName("filter", "filter", TreeBuilder.OTHER);
- public static final ElementName FOOTER = new ElementName("footer", "footer", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName HGROUP = new ElementName("hgroup", "hgroup", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName HEADER = new ElementName("header", "header", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName IFRAME = new ElementName("iframe", "iframe", TreeBuilder.IFRAME | SPECIAL);
- public static final ElementName KEYGEN = new ElementName("keygen", "keygen", TreeBuilder.KEYGEN);
- public static final ElementName LAMBDA = new ElementName("lambda", "lambda", TreeBuilder.OTHER);
- public static final ElementName LEGEND = new ElementName("legend", "legend", TreeBuilder.OTHER);
- public static final ElementName MSPACE = new ElementName("mspace", "mspace", TreeBuilder.OTHER);
- public static final ElementName MTABLE = new ElementName("mtable", "mtable", TreeBuilder.OTHER);
- public static final ElementName MSTYLE = new ElementName("mstyle", "mstyle", TreeBuilder.OTHER);
- public static final ElementName MGLYPH = new ElementName("mglyph", "mglyph", TreeBuilder.MGLYPH_OR_MALIGNMARK);
- public static final ElementName MEDIAN = new ElementName("median", "median", TreeBuilder.OTHER);
- public static final ElementName MUNDER = new ElementName("munder", "munder", TreeBuilder.OTHER);
- public static final ElementName MARKER = new ElementName("marker", "marker", TreeBuilder.OTHER);
- public static final ElementName MERROR = new ElementName("merror", "merror", TreeBuilder.OTHER);
- public static final ElementName MOMENT = new ElementName("moment", "moment", TreeBuilder.OTHER);
- public static final ElementName MATRIX = new ElementName("matrix", "matrix", TreeBuilder.OTHER);
- public static final ElementName OPTION = new ElementName("option", "option", TreeBuilder.OPTION | OPTIONAL_END_TAG);
- public static final ElementName OBJECT = new ElementName("object", "object", TreeBuilder.OBJECT | SPECIAL | SCOPING);
- public static final ElementName OUTPUT = new ElementName("output", "output", TreeBuilder.OUTPUT);
- public static final ElementName PRIMES = new ElementName("primes", "primes", TreeBuilder.OTHER);
- public static final ElementName SOURCE = new ElementName("source", "source", TreeBuilder.PARAM_OR_SOURCE_OR_TRACK);
- public static final ElementName STRIKE = new ElementName("strike", "strike", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName STRONG = new ElementName("strong", "strong", TreeBuilder.B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U);
- public static final ElementName SWITCH = new ElementName("switch", "switch", TreeBuilder.OTHER);
- public static final ElementName SYMBOL = new ElementName("symbol", "symbol", TreeBuilder.OTHER);
- public static final ElementName SELECT = new ElementName("select", "select", TreeBuilder.SELECT | SPECIAL);
- public static final ElementName SUBSET = new ElementName("subset", "subset", TreeBuilder.OTHER);
- public static final ElementName SCRIPT = new ElementName("script", "script", TreeBuilder.SCRIPT | SPECIAL);
- public static final ElementName TBREAK = new ElementName("tbreak", "tbreak", TreeBuilder.OTHER);
- public static final ElementName VECTOR = new ElementName("vector", "vector", TreeBuilder.OTHER);
- public static final ElementName ARTICLE = new ElementName("article", "article", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName ANIMATE = new ElementName("animate", "animate", TreeBuilder.OTHER);
- public static final ElementName ARCSECH = new ElementName("arcsech", "arcsech", TreeBuilder.OTHER);
- public static final ElementName ARCCSCH = new ElementName("arccsch", "arccsch", TreeBuilder.OTHER);
- public static final ElementName ARCTANH = new ElementName("arctanh", "arctanh", TreeBuilder.OTHER);
- public static final ElementName ARCSINH = new ElementName("arcsinh", "arcsinh", TreeBuilder.OTHER);
- public static final ElementName ARCCOSH = new ElementName("arccosh", "arccosh", TreeBuilder.OTHER);
- public static final ElementName ARCCOTH = new ElementName("arccoth", "arccoth", TreeBuilder.OTHER);
- public static final ElementName ACRONYM = new ElementName("acronym", "acronym", TreeBuilder.OTHER);
- public static final ElementName ADDRESS = new ElementName("address", "address", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName BGSOUND = new ElementName("bgsound", "bgsound", TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
- public static final ElementName COMPOSE = new ElementName("compose", "compose", TreeBuilder.OTHER);
- public static final ElementName CEILING = new ElementName("ceiling", "ceiling", TreeBuilder.OTHER);
- public static final ElementName CSYMBOL = new ElementName("csymbol", "csymbol", TreeBuilder.OTHER);
- public static final ElementName CAPTION = new ElementName("caption", "caption", TreeBuilder.CAPTION | SPECIAL | SCOPING);
- public static final ElementName DISCARD = new ElementName("discard", "discard", TreeBuilder.OTHER);
- public static final ElementName DECLARE = new ElementName("declare", "declare", TreeBuilder.OTHER);
- public static final ElementName DETAILS = new ElementName("details", "details", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName ELLIPSE = new ElementName("ellipse", "ellipse", TreeBuilder.OTHER);
- public static final ElementName FEFUNCA = new ElementName("fefunca", "feFuncA", TreeBuilder.OTHER);
- public static final ElementName FEFUNCB = new ElementName("fefuncb", "feFuncB", TreeBuilder.OTHER);
- public static final ElementName FEBLEND = new ElementName("feblend", "feBlend", TreeBuilder.OTHER);
- public static final ElementName FEFLOOD = new ElementName("feflood", "feFlood", TreeBuilder.OTHER);
- public static final ElementName FEIMAGE = new ElementName("feimage", "feImage", TreeBuilder.OTHER);
- public static final ElementName FEMERGE = new ElementName("femerge", "feMerge", TreeBuilder.OTHER);
- public static final ElementName FEFUNCG = new ElementName("fefuncg", "feFuncG", TreeBuilder.OTHER);
- public static final ElementName FEFUNCR = new ElementName("fefuncr", "feFuncR", TreeBuilder.OTHER);
- public static final ElementName HANDLER = new ElementName("handler", "handler", TreeBuilder.OTHER);
- public static final ElementName INVERSE = new ElementName("inverse", "inverse", TreeBuilder.OTHER);
- public static final ElementName IMPLIES = new ElementName("implies", "implies", TreeBuilder.OTHER);
- public static final ElementName ISINDEX = new ElementName("isindex", "isindex", TreeBuilder.ISINDEX | SPECIAL);
- public static final ElementName LOGBASE = new ElementName("logbase", "logbase", TreeBuilder.OTHER);
- public static final ElementName LISTING = new ElementName("listing", "listing", TreeBuilder.PRE_OR_LISTING | SPECIAL);
- public static final ElementName MFENCED = new ElementName("mfenced", "mfenced", TreeBuilder.OTHER);
- public static final ElementName MPADDED = new ElementName("mpadded", "mpadded", TreeBuilder.OTHER);
- public static final ElementName MARQUEE = new ElementName("marquee", "marquee", TreeBuilder.MARQUEE_OR_APPLET | SPECIAL | SCOPING);
- public static final ElementName MACTION = new ElementName("maction", "maction", TreeBuilder.OTHER);
- public static final ElementName MSUBSUP = new ElementName("msubsup", "msubsup", TreeBuilder.OTHER);
- public static final ElementName NOEMBED = new ElementName("noembed", "noembed", TreeBuilder.NOEMBED | SPECIAL);
- public static final ElementName POLYGON = new ElementName("polygon", "polygon", TreeBuilder.OTHER);
- public static final ElementName PATTERN = new ElementName("pattern", "pattern", TreeBuilder.OTHER);
- public static final ElementName PICTURE = new ElementName("picture", "picture", TreeBuilder.OTHER);
- public static final ElementName PRODUCT = new ElementName("product", "product", TreeBuilder.OTHER);
- public static final ElementName SETDIFF = new ElementName("setdiff", "setdiff", TreeBuilder.OTHER);
- public static final ElementName SECTION = new ElementName("section", "section", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName SUMMARY = new ElementName("summary", "summary", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName TENDSTO = new ElementName("tendsto", "tendsto", TreeBuilder.OTHER);
- public static final ElementName UPLIMIT = new ElementName("uplimit", "uplimit", TreeBuilder.OTHER);
- public static final ElementName ALTGLYPH = new ElementName("altglyph", "altGlyph", TreeBuilder.OTHER);
- public static final ElementName BASEFONT = new ElementName("basefont", "basefont", TreeBuilder.LINK_OR_BASEFONT_OR_BGSOUND | SPECIAL);
- public static final ElementName CLIPPATH = new ElementName("clippath", "clipPath", TreeBuilder.OTHER);
- public static final ElementName CODOMAIN = new ElementName("codomain", "codomain", TreeBuilder.OTHER);
- public static final ElementName COLGROUP = new ElementName("colgroup", "colgroup", TreeBuilder.COLGROUP | SPECIAL | OPTIONAL_END_TAG);
- public static final ElementName EMPTYSET = new ElementName("emptyset", "emptyset", TreeBuilder.OTHER);
- public static final ElementName FACTOROF = new ElementName("factorof", "factorof", TreeBuilder.OTHER);
- public static final ElementName FIELDSET = new ElementName("fieldset", "fieldset", TreeBuilder.FIELDSET | SPECIAL);
- public static final ElementName FRAMESET = new ElementName("frameset", "frameset", TreeBuilder.FRAMESET | SPECIAL);
- public static final ElementName FEOFFSET = new ElementName("feoffset", "feOffset", TreeBuilder.OTHER);
- public static final ElementName GLYPHREF = new ElementName("glyphref", "glyphRef", TreeBuilder.OTHER);
- public static final ElementName INTERVAL = new ElementName("interval", "interval", TreeBuilder.OTHER);
- public static final ElementName INTEGERS = new ElementName("integers", "integers", TreeBuilder.OTHER);
- public static final ElementName INFINITY = new ElementName("infinity", "infinity", TreeBuilder.OTHER);
- public static final ElementName LISTENER = new ElementName("listener", "listener", TreeBuilder.OTHER);
- public static final ElementName LOWLIMIT = new ElementName("lowlimit", "lowlimit", TreeBuilder.OTHER);
- public static final ElementName METADATA = new ElementName("metadata", "metadata", TreeBuilder.OTHER);
- public static final ElementName MENCLOSE = new ElementName("menclose", "menclose", TreeBuilder.OTHER);
- public static final ElementName MENUITEM = new ElementName("menuitem", "menuitem", TreeBuilder.MENUITEM);
- public static final ElementName MPHANTOM = new ElementName("mphantom", "mphantom", TreeBuilder.OTHER);
- public static final ElementName NOFRAMES = new ElementName("noframes", "noframes", TreeBuilder.NOFRAMES | SPECIAL);
- public static final ElementName NOSCRIPT = new ElementName("noscript", "noscript", TreeBuilder.NOSCRIPT | SPECIAL);
- public static final ElementName OPTGROUP = new ElementName("optgroup", "optgroup", TreeBuilder.OPTGROUP | OPTIONAL_END_TAG);
- public static final ElementName POLYLINE = new ElementName("polyline", "polyline", TreeBuilder.OTHER);
- public static final ElementName PREFETCH = new ElementName("prefetch", "prefetch", TreeBuilder.OTHER);
- public static final ElementName PROGRESS = new ElementName("progress", "progress", TreeBuilder.OTHER);
- public static final ElementName PRSUBSET = new ElementName("prsubset", "prsubset", TreeBuilder.OTHER);
- public static final ElementName QUOTIENT = new ElementName("quotient", "quotient", TreeBuilder.OTHER);
- public static final ElementName SELECTOR = new ElementName("selector", "selector", TreeBuilder.OTHER);
- public static final ElementName TEXTAREA = new ElementName("textarea", "textarea", TreeBuilder.TEXTAREA | SPECIAL);
- public static final ElementName TEMPLATE = new ElementName("template", "template", TreeBuilder.TEMPLATE | SPECIAL | SCOPING);
- public static final ElementName TEXTPATH = new ElementName("textpath", "textPath", TreeBuilder.OTHER);
- public static final ElementName VARIANCE = new ElementName("variance", "variance", TreeBuilder.OTHER);
- public static final ElementName ANIMATION = new ElementName("animation", "animation", TreeBuilder.OTHER);
- public static final ElementName CONJUGATE = new ElementName("conjugate", "conjugate", TreeBuilder.OTHER);
- public static final ElementName CONDITION = new ElementName("condition", "condition", TreeBuilder.OTHER);
- public static final ElementName COMPLEXES = new ElementName("complexes", "complexes", TreeBuilder.OTHER);
- public static final ElementName FONT_FACE = new ElementName("font-face", "font-face", TreeBuilder.OTHER);
- public static final ElementName FACTORIAL = new ElementName("factorial", "factorial", TreeBuilder.OTHER);
- public static final ElementName INTERSECT = new ElementName("intersect", "intersect", TreeBuilder.OTHER);
- public static final ElementName IMAGINARY = new ElementName("imaginary", "imaginary", TreeBuilder.OTHER);
- public static final ElementName LAPLACIAN = new ElementName("laplacian", "laplacian", TreeBuilder.OTHER);
- public static final ElementName MATRIXROW = new ElementName("matrixrow", "matrixrow", TreeBuilder.OTHER);
- public static final ElementName NOTSUBSET = new ElementName("notsubset", "notsubset", TreeBuilder.OTHER);
- public static final ElementName OTHERWISE = new ElementName("otherwise", "otherwise", TreeBuilder.OTHER);
- public static final ElementName PIECEWISE = new ElementName("piecewise", "piecewise", TreeBuilder.OTHER);
- public static final ElementName PLAINTEXT = new ElementName("plaintext", "plaintext", TreeBuilder.PLAINTEXT | SPECIAL);
- public static final ElementName RATIONALS = new ElementName("rationals", "rationals", TreeBuilder.OTHER);
- public static final ElementName SEMANTICS = new ElementName("semantics", "semantics", TreeBuilder.OTHER);
- public static final ElementName TRANSPOSE = new ElementName("transpose", "transpose", TreeBuilder.OTHER);
- public static final ElementName ANNOTATION = new ElementName("annotation", "annotation", TreeBuilder.OTHER);
- public static final ElementName BLOCKQUOTE = new ElementName("blockquote", "blockquote", TreeBuilder.DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU | SPECIAL);
- public static final ElementName DIVERGENCE = new ElementName("divergence", "divergence", TreeBuilder.OTHER);
- public static final ElementName EULERGAMMA = new ElementName("eulergamma", "eulergamma", TreeBuilder.OTHER);
- public static final ElementName EQUIVALENT = new ElementName("equivalent", "equivalent", TreeBuilder.OTHER);
- public static final ElementName FIGCAPTION = new ElementName("figcaption", "figcaption", TreeBuilder.ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY | SPECIAL);
- public static final ElementName IMAGINARYI = new ElementName("imaginaryi", "imaginaryi", TreeBuilder.OTHER);
- public static final ElementName MALIGNMARK = new ElementName("malignmark", "malignmark", TreeBuilder.MGLYPH_OR_MALIGNMARK);
- public static final ElementName MUNDEROVER = new ElementName("munderover", "munderover", TreeBuilder.OTHER);
- public static final ElementName MLABELEDTR = new ElementName("mlabeledtr", "mlabeledtr", TreeBuilder.OTHER);
- public static final ElementName NOTANUMBER = new ElementName("notanumber", "notanumber", TreeBuilder.OTHER);
- public static final ElementName SOLIDCOLOR = new ElementName("solidcolor", "solidcolor", TreeBuilder.OTHER);
- public static final ElementName ALTGLYPHDEF = new ElementName("altglyphdef", "altGlyphDef", TreeBuilder.OTHER);
- public static final ElementName DETERMINANT = new ElementName("determinant", "determinant", TreeBuilder.OTHER);
- public static final ElementName FEMERGENODE = new ElementName("femergenode", "feMergeNode", TreeBuilder.OTHER);
- public static final ElementName FECOMPOSITE = new ElementName("fecomposite", "feComposite", TreeBuilder.OTHER);
- public static final ElementName FESPOTLIGHT = new ElementName("fespotlight", "feSpotLight", TreeBuilder.OTHER);
- public static final ElementName MALIGNGROUP = new ElementName("maligngroup", "maligngroup", TreeBuilder.OTHER);
- public static final ElementName MPRESCRIPTS = new ElementName("mprescripts", "mprescripts", TreeBuilder.OTHER);
- public static final ElementName MOMENTABOUT = new ElementName("momentabout", "momentabout", TreeBuilder.OTHER);
- public static final ElementName NOTPRSUBSET = new ElementName("notprsubset", "notprsubset", TreeBuilder.OTHER);
- public static final ElementName PARTIALDIFF = new ElementName("partialdiff", "partialdiff", TreeBuilder.OTHER);
- public static final ElementName ALTGLYPHITEM = new ElementName("altglyphitem", "altGlyphItem", TreeBuilder.OTHER);
- public static final ElementName ANIMATECOLOR = new ElementName("animatecolor", "animateColor", TreeBuilder.OTHER);
- public static final ElementName DATATEMPLATE = new ElementName("datatemplate", "datatemplate", TreeBuilder.OTHER);
- public static final ElementName EXPONENTIALE = new ElementName("exponentiale", "exponentiale", TreeBuilder.OTHER);
- public static final ElementName FETURBULENCE = new ElementName("feturbulence", "feTurbulence", TreeBuilder.OTHER);
- public static final ElementName FEPOINTLIGHT = new ElementName("fepointlight", "fePointLight", TreeBuilder.OTHER);
- public static final ElementName FEDROPSHADOW = new ElementName("fedropshadow", "feDropShadow", TreeBuilder.OTHER);
- public static final ElementName FEMORPHOLOGY = new ElementName("femorphology", "feMorphology", TreeBuilder.OTHER);
- public static final ElementName OUTERPRODUCT = new ElementName("outerproduct", "outerproduct", TreeBuilder.OTHER);
- public static final ElementName ANIMATEMOTION = new ElementName("animatemotion", "animateMotion", TreeBuilder.OTHER);
- public static final ElementName COLOR_PROFILE = new ElementName("color-profile", "color-profile", TreeBuilder.OTHER);
- public static final ElementName FONT_FACE_SRC = new ElementName("font-face-src", "font-face-src", TreeBuilder.OTHER);
- public static final ElementName FONT_FACE_URI = new ElementName("font-face-uri", "font-face-uri", TreeBuilder.OTHER);
- public static final ElementName FOREIGNOBJECT = new ElementName("foreignobject", "foreignObject", TreeBuilder.FOREIGNOBJECT_OR_DESC | SCOPING_AS_SVG);
- public static final ElementName FECOLORMATRIX = new ElementName("fecolormatrix", "feColorMatrix", TreeBuilder.OTHER);
- public static final ElementName MISSING_GLYPH = new ElementName("missing-glyph", "missing-glyph", TreeBuilder.OTHER);
- public static final ElementName MMULTISCRIPTS = new ElementName("mmultiscripts", "mmultiscripts", TreeBuilder.OTHER);
- public static final ElementName SCALARPRODUCT = new ElementName("scalarproduct", "scalarproduct", TreeBuilder.OTHER);
- public static final ElementName VECTORPRODUCT = new ElementName("vectorproduct", "vectorproduct", TreeBuilder.OTHER);
- public static final ElementName ANNOTATION_XML = new ElementName("annotation-xml", "annotation-xml", TreeBuilder.ANNOTATION_XML | SCOPING_AS_MATHML);
- public static final ElementName DEFINITION_SRC = new ElementName("definition-src", "definition-src", TreeBuilder.OTHER);
- public static final ElementName FONT_FACE_NAME = new ElementName("font-face-name", "font-face-name", TreeBuilder.OTHER);
- public static final ElementName FEGAUSSIANBLUR = new ElementName("fegaussianblur", "feGaussianBlur", TreeBuilder.OTHER);
- public static final ElementName FEDISTANTLIGHT = new ElementName("fedistantlight", "feDistantLight", TreeBuilder.OTHER);
- public static final ElementName LINEARGRADIENT = new ElementName("lineargradient", "linearGradient", TreeBuilder.OTHER);
- public static final ElementName NATURALNUMBERS = new ElementName("naturalnumbers", "naturalnumbers", TreeBuilder.OTHER);
- public static final ElementName RADIALGRADIENT = new ElementName("radialgradient", "radialGradient", TreeBuilder.OTHER);
- public static final ElementName ANIMATETRANSFORM = new ElementName("animatetransform", "animateTransform", TreeBuilder.OTHER);
- public static final ElementName CARTESIANPRODUCT = new ElementName("cartesianproduct", "cartesianproduct", TreeBuilder.OTHER);
- public static final ElementName FONT_FACE_FORMAT = new ElementName("font-face-format", "font-face-format", TreeBuilder.OTHER);
- public static final ElementName FECONVOLVEMATRIX = new ElementName("feconvolvematrix", "feConvolveMatrix", TreeBuilder.OTHER);
- public static final ElementName FEDIFFUSELIGHTING = new ElementName("fediffuselighting", "feDiffuseLighting", TreeBuilder.OTHER);
- public static final ElementName FEDISPLACEMENTMAP = new ElementName("fedisplacementmap", "feDisplacementMap", TreeBuilder.OTHER);
- public static final ElementName FESPECULARLIGHTING = new ElementName("fespecularlighting", "feSpecularLighting", TreeBuilder.OTHER);
- public static final ElementName DOMAINOFAPPLICATION = new ElementName("domainofapplication", "domainofapplication", TreeBuilder.OTHER);
- public static final ElementName FECOMPONENTTRANSFER = new ElementName("fecomponenttransfer", "feComponentTransfer", TreeBuilder.OTHER);
- private final static @NoLength ElementName[] ELEMENT_NAMES = {
- A,
- B,
- G,
- I,
- P,
- Q,
- S,
- U,
- BR,
- CI,
- CN,
- DD,
- DL,
- DT,
- EM,
- EQ,
- FN,
- H1,
- H2,
- H3,
- H4,
- H5,
- H6,
- GT,
- HR,
- IN,
- LI,
- LN,
- LT,
- MI,
- MN,
- MO,
- MS,
- OL,
- OR,
- PI,
- RB,
- RP,
- RT,
- TD,
- TH,
- TR,
- TT,
- UL,
- AND,
- ARG,
- ABS,
- BIG,
- BDO,
- CSC,
- COL,
- COS,
- COT,
- DEL,
- DFN,
- DIR,
- DIV,
- EXP,
- GCD,
- GEQ,
- IMG,
- INS,
- INT,
- KBD,
- LOG,
- LCM,
- LEQ,
- MTD,
- MIN,
- MAP,
- MTR,
- MAX,
- NEQ,
- NOT,
- NAV,
- PRE,
- RTC,
- REM,
- SUB,
- SEC,
- SVG,
- SUM,
- SIN,
- SEP,
- SUP,
- SET,
- TAN,
- USE,
- VAR,
- WBR,
- XMP,
- XOR,
- AREA,
- ABBR,
- BASE,
- BVAR,
- BODY,
- CARD,
- CODE,
- CITE,
- CSCH,
- COSH,
- COTH,
- CURL,
- DESC,
- DIFF,
- DEFS,
- FORM,
- FONT,
- GRAD,
- HEAD,
- HTML,
- LINE,
- LINK,
- LIST,
- META,
- MSUB,
- MODE,
- MATH,
- MARK,
- MASK,
- MEAN,
- MAIN,
- MSUP,
- MENU,
- MROW,
- NONE,
- NOBR,
- NEST,
- PATH,
- PLUS,
- RULE,
- REAL,
- RELN,
- RECT,
- ROOT,
- RUBY,
- SECH,
- SINH,
- SPAN,
- SAMP,
- STOP,
- SDEV,
- TIME,
- TRUE,
- TREF,
- TANH,
- TEXT,
- VIEW,
- ASIDE,
- AUDIO,
- APPLY,
- EMBED,
- FRAME,
- FALSE,
- FLOOR,
- GLYPH,
- HKERN,
- IMAGE,
- IDENT,
- INPUT,
- LABEL,
- LIMIT,
- MFRAC,
- MPATH,
- METER,
- MOVER,
- MINUS,
- MROOT,
- MSQRT,
- MTEXT,
- NOTIN,
- PIECE,
- PARAM,
- POWER,
- REALS,
- STYLE,
- SMALL,
- THEAD,
- TABLE,
- TITLE,
- TRACK,
- TSPAN,
- TIMES,
- TFOOT,
- TBODY,
- UNION,
- VKERN,
- VIDEO,
- ARCSEC,
- ARCCSC,
- ARCTAN,
- ARCSIN,
- ARCCOS,
- APPLET,
- ARCCOT,
- APPROX,
- BUTTON,
- CIRCLE,
- CENTER,
- CURSOR,
- CANVAS,
- DIVIDE,
- DEGREE,
- DOMAIN,
- EXISTS,
- FETILE,
- FIGURE,
- FORALL,
- FILTER,
- FOOTER,
- HGROUP,
- HEADER,
- IFRAME,
- KEYGEN,
- LAMBDA,
- LEGEND,
- MSPACE,
- MTABLE,
- MSTYLE,
- MGLYPH,
- MEDIAN,
- MUNDER,
- MARKER,
- MERROR,
- MOMENT,
- MATRIX,
- OPTION,
- OBJECT,
- OUTPUT,
- PRIMES,
- SOURCE,
- STRIKE,
- STRONG,
- SWITCH,
- SYMBOL,
- SELECT,
- SUBSET,
- SCRIPT,
- TBREAK,
- VECTOR,
- ARTICLE,
- ANIMATE,
- ARCSECH,
- ARCCSCH,
- ARCTANH,
- ARCSINH,
- ARCCOSH,
- ARCCOTH,
- ACRONYM,
- ADDRESS,
- BGSOUND,
- COMPOSE,
- CEILING,
- CSYMBOL,
- CAPTION,
- DISCARD,
- DECLARE,
- DETAILS,
- ELLIPSE,
- FEFUNCA,
- FEFUNCB,
- FEBLEND,
- FEFLOOD,
- FEIMAGE,
- FEMERGE,
- FEFUNCG,
- FEFUNCR,
- HANDLER,
- INVERSE,
- IMPLIES,
- ISINDEX,
- LOGBASE,
- LISTING,
- MFENCED,
- MPADDED,
- MARQUEE,
- MACTION,
- MSUBSUP,
- NOEMBED,
- POLYGON,
- PATTERN,
- PICTURE,
- PRODUCT,
- SETDIFF,
- SECTION,
- SUMMARY,
- TENDSTO,
- UPLIMIT,
- ALTGLYPH,
- BASEFONT,
- CLIPPATH,
- CODOMAIN,
- COLGROUP,
- EMPTYSET,
- FACTOROF,
- FIELDSET,
- FRAMESET,
- FEOFFSET,
- GLYPHREF,
- INTERVAL,
- INTEGERS,
- INFINITY,
- LISTENER,
- LOWLIMIT,
- METADATA,
- MENCLOSE,
- MENUITEM,
- MPHANTOM,
- NOFRAMES,
- NOSCRIPT,
- OPTGROUP,
- POLYLINE,
- PREFETCH,
- PROGRESS,
- PRSUBSET,
- QUOTIENT,
- SELECTOR,
- TEXTAREA,
- TEMPLATE,
- TEXTPATH,
- VARIANCE,
- ANIMATION,
- CONJUGATE,
- CONDITION,
- COMPLEXES,
- FONT_FACE,
- FACTORIAL,
- INTERSECT,
- IMAGINARY,
- LAPLACIAN,
- MATRIXROW,
- NOTSUBSET,
- OTHERWISE,
- PIECEWISE,
- PLAINTEXT,
- RATIONALS,
- SEMANTICS,
- TRANSPOSE,
- ANNOTATION,
- BLOCKQUOTE,
- DIVERGENCE,
- EULERGAMMA,
- EQUIVALENT,
- FIGCAPTION,
- IMAGINARYI,
- MALIGNMARK,
- MUNDEROVER,
- MLABELEDTR,
- NOTANUMBER,
- SOLIDCOLOR,
- ALTGLYPHDEF,
- DETERMINANT,
- FEMERGENODE,
- FECOMPOSITE,
- FESPOTLIGHT,
- MALIGNGROUP,
- MPRESCRIPTS,
- MOMENTABOUT,
- NOTPRSUBSET,
- PARTIALDIFF,
- ALTGLYPHITEM,
- ANIMATECOLOR,
- DATATEMPLATE,
- EXPONENTIALE,
- FETURBULENCE,
- FEPOINTLIGHT,
- FEDROPSHADOW,
- FEMORPHOLOGY,
- OUTERPRODUCT,
- ANIMATEMOTION,
- COLOR_PROFILE,
- FONT_FACE_SRC,
- FONT_FACE_URI,
- FOREIGNOBJECT,
- FECOLORMATRIX,
- MISSING_GLYPH,
- MMULTISCRIPTS,
- SCALARPRODUCT,
- VECTORPRODUCT,
- ANNOTATION_XML,
- DEFINITION_SRC,
- FONT_FACE_NAME,
- FEGAUSSIANBLUR,
- FEDISTANTLIGHT,
- LINEARGRADIENT,
- NATURALNUMBERS,
- RADIALGRADIENT,
- ANIMATETRANSFORM,
- CARTESIANPRODUCT,
- FONT_FACE_FORMAT,
- FECONVOLVEMATRIX,
- FEDIFFUSELIGHTING,
- FEDISPLACEMENTMAP,
- FESPECULARLIGHTING,
- DOMAINOFAPPLICATION,
- FECOMPONENTTRANSFER,
- };
- private final static int[] ELEMENT_HASHES = {
- 1057,
- 1090,
- 1255,
- 1321,
- 1552,
- 1585,
- 1651,
- 1717,
- 68162,
- 68899,
- 69059,
- 69764,
- 70020,
- 70276,
- 71077,
- 71205,
- 72134,
- 72232,
- 72264,
- 72296,
- 72328,
- 72360,
- 72392,
- 73351,
- 74312,
- 75209,
- 78124,
- 78284,
- 78476,
- 79149,
- 79309,
- 79341,
- 79469,
- 81295,
- 81487,
- 82224,
- 84050,
- 84498,
- 84626,
- 86164,
- 86292,
- 86612,
- 86676,
- 87445,
- 3183041,
- 3186241,
- 3198017,
- 3218722,
- 3226754,
- 3247715,
- 3256803,
- 3263971,
- 3264995,
- 3289252,
- 3291332,
- 3295524,
- 3299620,
- 3326725,
- 3379303,
- 3392679,
- 3448233,
- 3460553,
- 3461577,
- 3510347,
- 3546604,
- 3552364,
- 3556524,
- 3576461,
- 3586349,
- 3588141,
- 3590797,
- 3596333,
- 3622062,
- 3625454,
- 3627054,
- 3675728,
- 3739282,
- 3749042,
- 3771059,
- 3771571,
- 3776211,
- 3782323,
- 3782963,
- 3784883,
- 3785395,
- 3788979,
- 3815476,
- 3839605,
- 3885110,
- 3917911,
- 3948984,
- 3951096,
- 135304769,
- 135858241,
- 136498210,
- 136906434,
- 137138658,
- 137512995,
- 137531875,
- 137548067,
- 137629283,
- 137645539,
- 137646563,
- 137775779,
- 138529956,
- 138615076,
- 139040932,
- 140954086,
- 141179366,
- 141690439,
- 142738600,
- 143013512,
- 146979116,
- 147175724,
- 147475756,
- 147902637,
- 147936877,
- 148017645,
- 148131885,
- 148228141,
- 148229165,
- 148309165,
- 148317229,
- 148395629,
- 148551853,
- 148618829,
- 149076462,
- 149490158,
- 149572782,
- 151277616,
- 151639440,
- 153268914,
- 153486514,
- 153563314,
- 153750706,
- 153763314,
- 153914034,
- 154406067,
- 154417459,
- 154600979,
- 154678323,
- 154680979,
- 154866835,
- 155366708,
- 155375188,
- 155391572,
- 155465780,
- 155869364,
- 158045494,
- 168988979,
- 169321621,
- 169652752,
- 173151309,
- 174240818,
- 174247297,
- 174669292,
- 175391532,
- 176638123,
- 177380397,
- 177879204,
- 177886734,
- 180753473,
- 181020073,
- 181503558,
- 181686320,
- 181999237,
- 181999311,
- 182048201,
- 182074866,
- 182078003,
- 182083764,
- 182920847,
- 184716457,
- 184976961,
- 185145071,
- 187281445,
- 187872052,
- 188100653,
- 188875944,
- 188919873,
- 188920457,
- 189107250,
- 189203987,
- 189371817,
- 189414886,
- 189567458,
- 190266670,
- 191318187,
- 191337609,
- 202479203,
- 202493027,
- 202835587,
- 202843747,
- 203013219,
- 203036048,
- 203045987,
- 203177552,
- 203898516,
- 204648562,
- 205067918,
- 205078130,
- 205096654,
- 205689142,
- 205690439,
- 205988909,
- 207213161,
- 207794484,
- 207800999,
- 208023602,
- 208213644,
- 208213647,
- 210261490,
- 210310273,
- 210940978,
- 213325049,
- 213946445,
- 214055079,
- 215125040,
- 215134273,
- 215135028,
- 215237420,
- 215418148,
- 215553166,
- 215553394,
- 215563858,
- 215627949,
- 215754324,
- 217529652,
- 217713834,
- 217732628,
- 218731945,
- 221417045,
- 221424946,
- 221493746,
- 221515401,
- 221658189,
- 221908140,
- 221910626,
- 221921586,
- 222659762,
- 225001091,
- 236105833,
- 236113965,
- 236194995,
- 236195427,
- 236206132,
- 236206387,
- 236211683,
- 236212707,
- 236381647,
- 236571826,
- 237124271,
- 238210544,
- 238270764,
- 238435405,
- 238501172,
- 239224867,
- 239257644,
- 239710497,
- 240307721,
- 241208789,
- 241241557,
- 241318060,
- 241319404,
- 241343533,
- 241344069,
- 241405397,
- 241765845,
- 243864964,
- 244502085,
- 244946220,
- 245109902,
- 247647266,
- 247707956,
- 248648814,
- 248648836,
- 248682161,
- 248986932,
- 249058914,
- 249697357,
- 252132601,
- 252135604,
- 251841204,
- 252317348,
- 255007012,
- 255278388,
- 255641645,
- 256365156,
- 257566121,
- 269763372,
- 271202790,
- 271863856,
- 272049197,
- 272127474,
- 274339449,
- 274939471,
- 275388004,
- 275388005,
- 275388006,
- 275977800,
- 278267602,
- 278513831,
- 278712622,
- 281613765,
- 281683369,
- 282120228,
- 282250732,
- 282498697,
- 282508942,
- 283743649,
- 283787570,
- 284710386,
- 285391148,
- 285478533,
- 285854898,
- 285873762,
- 286931113,
- 288964227,
- 289445441,
- 289591340,
- 289689648,
- 291671489,
- 303512884,
- 305319975,
- 305610036,
- 305764101,
- 308448294,
- 308675890,
- 312085683,
- 312264750,
- 315032867,
- 316391000,
- 317331042,
- 317902135,
- 318950711,
- 319447220,
- 321499182,
- 322538804,
- 323145200,
- 337067316,
- 337826293,
- 339905989,
- 340833697,
- 341457068,
- 342310196,
- 345302593,
- 349554733,
- 349771471,
- 349786245,
- 350819405,
- 356072847,
- 370349192,
- 373962798,
- 375558638,
- 375574835,
- 376053993,
- 383276530,
- 383373833,
- 383407586,
- 384439906,
- 386079012,
- 404133513,
- 404307343,
- 407031852,
- 408072233,
- 409112005,
- 409608425,
- 409713793,
- 409771500,
- 419040932,
- 437730612,
- 439529766,
- 442616365,
- 442813037,
- 443157674,
- 443295316,
- 450118444,
- 450482697,
- 456789668,
- 459935396,
- 471217869,
- 474073645,
- 476230702,
- 476665218,
- 476717289,
- 483014825,
- 485083298,
- 489306281,
- 538364390,
- 540675748,
- 543819186,
- 543958612,
- 576960820,
- 577242548,
- 610515252,
- 642202932,
- 644420819,
- };
-}
diff --git a/parser/html/javasrc/HtmlAttributes.java b/parser/html/javasrc/HtmlAttributes.java
deleted file mode 100644
index 0ec25f96f..000000000
--- a/parser/html/javasrc/HtmlAttributes.java
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2007 Henri Sivonen
- * Copyright (c) 2008-2011 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import nu.validator.htmlparser.annotation.Auto;
-import nu.validator.htmlparser.annotation.IdType;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NsUri;
-import nu.validator.htmlparser.annotation.Prefix;
-import nu.validator.htmlparser.annotation.QName;
-import nu.validator.htmlparser.common.Interner;
-import nu.validator.htmlparser.common.XmlViolationPolicy;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * Be careful with this class. QName is the name in from HTML tokenization.
- * Otherwise, please refer to the interface doc.
- *
- * @version $Id: AttributesImpl.java 206 2008-03-20 14:09:29Z hsivonen $
- * @author hsivonen
- */
-public final class HtmlAttributes implements Attributes {
-
- // [NOCPP[
-
- private static final AttributeName[] EMPTY_ATTRIBUTENAMES = new AttributeName[0];
-
- private static final String[] EMPTY_STRINGS = new String[0];
-
- // ]NOCPP]
-
- public static final HtmlAttributes EMPTY_ATTRIBUTES = new HtmlAttributes(
- AttributeName.HTML);
-
- private int mode;
-
- private int length;
-
- private @Auto AttributeName[] names;
-
- private @Auto String[] values; // XXX perhaps make this @NoLength?
-
- // CPPONLY: private @Auto int[] lines; // XXX perhaps make this @NoLength?
-
- // [NOCPP[
-
- private String idValue;
-
- private int xmlnsLength;
-
- private AttributeName[] xmlnsNames;
-
- private String[] xmlnsValues;
-
- // ]NOCPP]
-
- public HtmlAttributes(int mode) {
- this.mode = mode;
- this.length = 0;
- /*
- * The length of 5 covers covers 98.3% of elements
- * according to Hixie, but lets round to the next power of two for
- * jemalloc.
- */
- this.names = new AttributeName[8];
- this.values = new String[8];
- // CPPONLY: this.lines = new int[8];
-
- // [NOCPP[
-
- this.idValue = null;
-
- this.xmlnsLength = 0;
-
- this.xmlnsNames = HtmlAttributes.EMPTY_ATTRIBUTENAMES;
-
- this.xmlnsValues = HtmlAttributes.EMPTY_STRINGS;
-
- // ]NOCPP]
- }
- /*
- public HtmlAttributes(HtmlAttributes other) {
- this.mode = other.mode;
- this.length = other.length;
- this.names = new AttributeName[other.length];
- this.values = new String[other.length];
- // [NOCPP[
- this.idValue = other.idValue;
- this.xmlnsLength = other.xmlnsLength;
- this.xmlnsNames = new AttributeName[other.xmlnsLength];
- this.xmlnsValues = new String[other.xmlnsLength];
- // ]NOCPP]
- }
- */
-
- void destructor() {
- clear(0);
- }
-
- /**
- * Only use with a static argument
- *
- * @param name
- * @return
- */
- public int getIndex(AttributeName name) {
- for (int i = 0; i < length; i++) {
- if (names[i] == name) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Only use with static argument.
- *
- * @see org.xml.sax.Attributes#getValue(java.lang.String)
- */
- public String getValue(AttributeName name) {
- int index = getIndex(name);
- if (index == -1) {
- return null;
- } else {
- return getValueNoBoundsCheck(index);
- }
- }
-
- public int getLength() {
- return length;
- }
-
- /**
- * Variant of <code>getLocalName(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the local name at index
- */
- public @Local String getLocalNameNoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- return names[index].getLocal(mode);
- }
-
- /**
- * Variant of <code>getURI(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the namespace URI at index
- */
- public @NsUri String getURINoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- return names[index].getUri(mode);
- }
-
- /**
- * Variant of <code>getPrefix(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the namespace prefix at index
- */
- public @Prefix String getPrefixNoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- return names[index].getPrefix(mode);
- }
-
- /**
- * Variant of <code>getValue(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the attribute value at index
- */
- public String getValueNoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- return values[index];
- }
-
- /**
- * Variant of <code>getAttributeName(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the attribute name at index
- */
- public AttributeName getAttributeNameNoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- return names[index];
- }
-
- // CPPONLY: /**
- // CPPONLY: * Obtains a line number without bounds check.
- // CPPONLY: * @param index a valid attribute index
- // CPPONLY: * @return the line number at index or -1 if unknown
- // CPPONLY: */
- // CPPONLY: public int getLineNoBoundsCheck(int index) {
- // CPPONLY: assert index < length && index >= 0: "Index out of bounds";
- // CPPONLY: return lines[index];
- // CPPONLY: }
-
- // [NOCPP[
-
- /**
- * Variant of <code>getQName(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the QName at index
- */
- public @QName String getQNameNoBoundsCheck(int index) {
- return names[index].getQName(mode);
- }
-
- /**
- * Variant of <code>getType(int index)</code> without bounds check.
- * @param index a valid attribute index
- * @return the attribute type at index
- */
- public @IdType String getTypeNoBoundsCheck(int index) {
- return (names[index] == AttributeName.ID) ? "ID" : "CDATA";
- }
-
- public int getIndex(String qName) {
- for (int i = 0; i < length; i++) {
- if (names[i].getQName(mode).equals(qName)) {
- return i;
- }
- }
- return -1;
- }
-
- public int getIndex(String uri, String localName) {
- for (int i = 0; i < length; i++) {
- if (names[i].getLocal(mode).equals(localName)
- && names[i].getUri(mode).equals(uri)) {
- return i;
- }
- }
- return -1;
- }
-
- public @IdType String getType(String qName) {
- int index = getIndex(qName);
- if (index == -1) {
- return null;
- } else {
- return getType(index);
- }
- }
-
- public @IdType String getType(String uri, String localName) {
- int index = getIndex(uri, localName);
- if (index == -1) {
- return null;
- } else {
- return getType(index);
- }
- }
-
- public String getValue(String qName) {
- int index = getIndex(qName);
- if (index == -1) {
- return null;
- } else {
- return getValue(index);
- }
- }
-
- public String getValue(String uri, String localName) {
- int index = getIndex(uri, localName);
- if (index == -1) {
- return null;
- } else {
- return getValue(index);
- }
- }
-
- public @Local String getLocalName(int index) {
- if (index < length && index >= 0) {
- return names[index].getLocal(mode);
- } else {
- return null;
- }
- }
-
- public @QName String getQName(int index) {
- if (index < length && index >= 0) {
- return names[index].getQName(mode);
- } else {
- return null;
- }
- }
-
- public @IdType String getType(int index) {
- if (index < length && index >= 0) {
- return (names[index] == AttributeName.ID) ? "ID" : "CDATA";
- } else {
- return null;
- }
- }
-
- public AttributeName getAttributeName(int index) {
- if (index < length && index >= 0) {
- return names[index];
- } else {
- return null;
- }
- }
-
- public @NsUri String getURI(int index) {
- if (index < length && index >= 0) {
- return names[index].getUri(mode);
- } else {
- return null;
- }
- }
-
- public @Prefix String getPrefix(int index) {
- if (index < length && index >= 0) {
- return names[index].getPrefix(mode);
- } else {
- return null;
- }
- }
-
- public String getValue(int index) {
- if (index < length && index >= 0) {
- return values[index];
- } else {
- return null;
- }
- }
-
- public String getId() {
- return idValue;
- }
-
- public int getXmlnsLength() {
- return xmlnsLength;
- }
-
- public @Local String getXmlnsLocalName(int index) {
- if (index < xmlnsLength && index >= 0) {
- return xmlnsNames[index].getLocal(mode);
- } else {
- return null;
- }
- }
-
- public @NsUri String getXmlnsURI(int index) {
- if (index < xmlnsLength && index >= 0) {
- return xmlnsNames[index].getUri(mode);
- } else {
- return null;
- }
- }
-
- public String getXmlnsValue(int index) {
- if (index < xmlnsLength && index >= 0) {
- return xmlnsValues[index];
- } else {
- return null;
- }
- }
-
- public int getXmlnsIndex(AttributeName name) {
- for (int i = 0; i < xmlnsLength; i++) {
- if (xmlnsNames[i] == name) {
- return i;
- }
- }
- return -1;
- }
-
- public String getXmlnsValue(AttributeName name) {
- int index = getXmlnsIndex(name);
- if (index == -1) {
- return null;
- } else {
- return getXmlnsValue(index);
- }
- }
-
- public AttributeName getXmlnsAttributeName(int index) {
- if (index < xmlnsLength && index >= 0) {
- return xmlnsNames[index];
- } else {
- return null;
- }
- }
-
- // ]NOCPP]
-
- void addAttribute(AttributeName name, String value
- // [NOCPP[
- , XmlViolationPolicy xmlnsPolicy
- // ]NOCPP]
- // CPPONLY: , int line
- ) throws SAXException {
- // [NOCPP[
- if (name == AttributeName.ID) {
- idValue = value;
- }
-
- if (name.isXmlns()) {
- if (xmlnsNames.length == xmlnsLength) {
- int newLen = xmlnsLength == 0 ? 2 : xmlnsLength << 1;
- AttributeName[] newNames = new AttributeName[newLen];
- System.arraycopy(xmlnsNames, 0, newNames, 0, xmlnsNames.length);
- xmlnsNames = newNames;
- String[] newValues = new String[newLen];
- System.arraycopy(xmlnsValues, 0, newValues, 0, xmlnsValues.length);
- xmlnsValues = newValues;
- }
- xmlnsNames[xmlnsLength] = name;
- xmlnsValues[xmlnsLength] = value;
- xmlnsLength++;
- switch (xmlnsPolicy) {
- case FATAL:
- // this is ugly
- throw new SAXException("Saw an xmlns attribute.");
- case ALTER_INFOSET:
- return;
- case ALLOW:
- // fall through
- }
- }
-
- // ]NOCPP]
-
- if (names.length == length) {
- int newLen = length << 1; // The first growth covers virtually
- // 100% of elements according to
- // Hixie
- AttributeName[] newNames = new AttributeName[newLen];
- System.arraycopy(names, 0, newNames, 0, names.length);
- names = newNames;
- String[] newValues = new String[newLen];
- System.arraycopy(values, 0, newValues, 0, values.length);
- values = newValues;
- // CPPONLY: int[] newLines = new int[newLen];
- // CPPONLY: System.arraycopy(lines, 0, newLines, 0, lines.length);
- // CPPONLY: lines = newLines;
- }
- names[length] = name;
- values[length] = value;
- // CPPONLY: lines[length] = line;
- length++;
- }
-
- void clear(int m) {
- for (int i = 0; i < length; i++) {
- names[i].release();
- names[i] = null;
- Portability.releaseString(values[i]);
- values[i] = null;
- }
- length = 0;
- mode = m;
- // [NOCPP[
- idValue = null;
- for (int i = 0; i < xmlnsLength; i++) {
- xmlnsNames[i] = null;
- xmlnsValues[i] = null;
- }
- xmlnsLength = 0;
- // ]NOCPP]
- }
-
- /**
- * This is used in C++ to release special <code>isindex</code>
- * attribute values whose ownership is not transferred.
- */
- void releaseValue(int i) {
- Portability.releaseString(values[i]);
- }
-
- /**
- * This is only used for <code>AttributeName</code> ownership transfer
- * in the isindex case to avoid freeing custom names twice in C++.
- */
- void clearWithoutReleasingContents() {
- for (int i = 0; i < length; i++) {
- names[i] = null;
- values[i] = null;
- }
- length = 0;
- }
-
- boolean contains(AttributeName name) {
- for (int i = 0; i < length; i++) {
- if (name.equalsAnother(names[i])) {
- return true;
- }
- }
- // [NOCPP[
- for (int i = 0; i < xmlnsLength; i++) {
- if (name.equalsAnother(xmlnsNames[i])) {
- return true;
- }
- }
- // ]NOCPP]
- return false;
- }
-
- public void adjustForMath() {
- mode = AttributeName.MATHML;
- }
-
- public void adjustForSvg() {
- mode = AttributeName.SVG;
- }
-
- public HtmlAttributes cloneAttributes(Interner interner)
- throws SAXException {
- assert (length == 0
- // [NOCPP[
- && xmlnsLength == 0
- // ]NOCPP]
- )
- || mode == 0 || mode == 3;
- HtmlAttributes clone = new HtmlAttributes(0);
- for (int i = 0; i < length; i++) {
- clone.addAttribute(names[i].cloneAttributeName(interner),
- Portability.newStringFromString(values[i])
- // [NOCPP[
- , XmlViolationPolicy.ALLOW
- // ]NOCPP]
- // CPPONLY: , lines[i]
- );
- }
- // [NOCPP[
- for (int i = 0; i < xmlnsLength; i++) {
- clone.addAttribute(xmlnsNames[i], xmlnsValues[i],
- XmlViolationPolicy.ALLOW);
- }
- // ]NOCPP]
- return clone; // XXX!!!
- }
-
- public boolean equalsAnother(HtmlAttributes other) {
- assert mode == 0 || mode == 3 : "Trying to compare attributes in foreign content.";
- int otherLength = other.getLength();
- if (length != otherLength) {
- return false;
- }
- for (int i = 0; i < length; i++) {
- // Work around the limitations of C++
- boolean found = false;
- // The comparing just the local names is OK, since these attribute
- // holders are both supposed to belong to HTML formatting elements
- @Local String ownLocal = names[i].getLocal(AttributeName.HTML);
- for (int j = 0; j < otherLength; j++) {
- if (ownLocal == other.names[j].getLocal(AttributeName.HTML)) {
- found = true;
- if (!Portability.stringEqualsString(values[i], other.values[j])) {
- return false;
- }
- }
- }
- if (!found) {
- return false;
- }
- }
- return true;
- }
-
- // [NOCPP[
-
- void processNonNcNames(TreeBuilder<?> treeBuilder, XmlViolationPolicy namePolicy) throws SAXException {
- for (int i = 0; i < length; i++) {
- AttributeName attName = names[i];
- if (!attName.isNcName(mode)) {
- String name = attName.getLocal(mode);
- switch (namePolicy) {
- case ALTER_INFOSET:
- names[i] = AttributeName.create(NCName.escapeName(name));
- // fall through
- case ALLOW:
- if (attName != AttributeName.XML_LANG) {
- treeBuilder.warn("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
- }
- break;
- case FATAL:
- treeBuilder.fatal("Attribute \u201C" + name + "\u201D is not serializable as XML 1.0.");
- break;
- }
- }
- }
- }
-
- public void merge(HtmlAttributes attributes) throws SAXException {
- int len = attributes.getLength();
- for (int i = 0; i < len; i++) {
- AttributeName name = attributes.getAttributeNameNoBoundsCheck(i);
- if (!contains(name)) {
- addAttribute(name, attributes.getValueNoBoundsCheck(i), XmlViolationPolicy.ALLOW);
- }
- }
- }
-
-
- // ]NOCPP]
-
-}
diff --git a/parser/html/javasrc/MetaScanner.java b/parser/html/javasrc/MetaScanner.java
deleted file mode 100644
index be9aabfe3..000000000
--- a/parser/html/javasrc/MetaScanner.java
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * Copyright (c) 2007 Henri Sivonen
- * Copyright (c) 2008-2015 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import java.io.IOException;
-
-import nu.validator.htmlparser.annotation.Auto;
-import nu.validator.htmlparser.annotation.Inline;
-import nu.validator.htmlparser.common.ByteReadable;
-
-import org.xml.sax.SAXException;
-
-public abstract class MetaScanner {
-
- /**
- * Constant for "charset".
- */
- private static final char[] CHARSET = { 'h', 'a', 'r', 's', 'e', 't' };
-
- /**
- * Constant for "content".
- */
- private static final char[] CONTENT = { 'o', 'n', 't', 'e', 'n', 't' };
-
- /**
- * Constant for "http-equiv".
- */
- private static final char[] HTTP_EQUIV = { 't', 't', 'p', '-', 'e', 'q',
- 'u', 'i', 'v' };
-
- /**
- * Constant for "content-type".
- */
- private static final char[] CONTENT_TYPE = { 'c', 'o', 'n', 't', 'e', 'n',
- 't', '-', 't', 'y', 'p', 'e' };
-
- private static final int NO = 0;
-
- private static final int M = 1;
-
- private static final int E = 2;
-
- private static final int T = 3;
-
- private static final int A = 4;
-
- private static final int DATA = 0;
-
- private static final int TAG_OPEN = 1;
-
- private static final int SCAN_UNTIL_GT = 2;
-
- private static final int TAG_NAME = 3;
-
- private static final int BEFORE_ATTRIBUTE_NAME = 4;
-
- private static final int ATTRIBUTE_NAME = 5;
-
- private static final int AFTER_ATTRIBUTE_NAME = 6;
-
- private static final int BEFORE_ATTRIBUTE_VALUE = 7;
-
- private static final int ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
-
- private static final int ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
-
- private static final int ATTRIBUTE_VALUE_UNQUOTED = 10;
-
- private static final int AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
-
- private static final int MARKUP_DECLARATION_OPEN = 13;
-
- private static final int MARKUP_DECLARATION_HYPHEN = 14;
-
- private static final int COMMENT_START = 15;
-
- private static final int COMMENT_START_DASH = 16;
-
- private static final int COMMENT = 17;
-
- private static final int COMMENT_END_DASH = 18;
-
- private static final int COMMENT_END = 19;
-
- private static final int SELF_CLOSING_START_TAG = 20;
-
- private static final int HTTP_EQUIV_NOT_SEEN = 0;
-
- private static final int HTTP_EQUIV_CONTENT_TYPE = 1;
-
- private static final int HTTP_EQUIV_OTHER = 2;
-
- /**
- * The data source.
- */
- protected ByteReadable readable;
-
- /**
- * The state of the state machine that recognizes the tag name "meta".
- */
- private int metaState = NO;
-
- /**
- * The current position in recognizing the attribute name "content".
- */
- private int contentIndex = Integer.MAX_VALUE;
-
- /**
- * The current position in recognizing the attribute name "charset".
- */
- private int charsetIndex = Integer.MAX_VALUE;
-
- /**
- * The current position in recognizing the attribute name "http-equive".
- */
- private int httpEquivIndex = Integer.MAX_VALUE;
-
- /**
- * The current position in recognizing the attribute value "content-type".
- */
- private int contentTypeIndex = Integer.MAX_VALUE;
-
- /**
- * The tokenizer state.
- */
- protected int stateSave = DATA;
-
- /**
- * The currently filled length of strBuf.
- */
- private int strBufLen;
-
- /**
- * Accumulation buffer for attribute values.
- */
- private @Auto char[] strBuf;
-
- private String content;
-
- private String charset;
-
- private int httpEquivState;
-
- // CPPONLY: private TreeBuilder treeBuilder;
-
- public MetaScanner(
- // CPPONLY: TreeBuilder tb
- ) {
- this.readable = null;
- this.metaState = NO;
- this.contentIndex = Integer.MAX_VALUE;
- this.charsetIndex = Integer.MAX_VALUE;
- this.httpEquivIndex = Integer.MAX_VALUE;
- this.contentTypeIndex = Integer.MAX_VALUE;
- this.stateSave = DATA;
- this.strBufLen = 0;
- this.strBuf = new char[36];
- this.content = null;
- this.charset = null;
- this.httpEquivState = HTTP_EQUIV_NOT_SEEN;
- // CPPONLY: this.treeBuilder = tb;
- }
-
- @SuppressWarnings("unused") private void destructor() {
- Portability.releaseString(content);
- Portability.releaseString(charset);
- }
-
- // [NOCPP[
-
- /**
- * Reads a byte from the data source.
- *
- * -1 means end.
- * @return
- * @throws IOException
- */
- protected int read() throws IOException {
- return readable.readByte();
- }
-
- // ]NOCPP]
-
- // WARNING When editing this, makes sure the bytecode length shown by javap
- // stays under 8000 bytes!
- /**
- * The runs the meta scanning algorithm.
- */
- protected final void stateLoop(int state)
- throws SAXException, IOException {
- int c = -1;
- boolean reconsume = false;
- stateloop: for (;;) {
- switch (state) {
- case DATA:
- dataloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- switch (c) {
- case -1:
- break stateloop;
- case '<':
- state = MetaScanner.TAG_OPEN;
- break dataloop; // FALL THROUGH continue
- // stateloop;
- default:
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case TAG_OPEN:
- tagopenloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case 'm':
- case 'M':
- metaState = M;
- state = MetaScanner.TAG_NAME;
- break tagopenloop;
- // continue stateloop;
- case '!':
- state = MetaScanner.MARKUP_DECLARATION_OPEN;
- continue stateloop;
- case '?':
- case '/':
- state = MetaScanner.SCAN_UNTIL_GT;
- continue stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
- metaState = NO;
- state = MetaScanner.TAG_NAME;
- break tagopenloop;
- // continue stateloop;
- }
- state = MetaScanner.DATA;
- reconsume = true;
- continue stateloop;
- }
- }
- // FALL THROUGH DON'T REORDER
- case TAG_NAME:
- tagnameloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
- break tagnameloop;
- // continue stateloop;
- case '/':
- state = MetaScanner.SELF_CLOSING_START_TAG;
- continue stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- case 'e':
- case 'E':
- if (metaState == M) {
- metaState = E;
- } else {
- metaState = NO;
- }
- continue;
- case 't':
- case 'T':
- if (metaState == E) {
- metaState = T;
- } else {
- metaState = NO;
- }
- continue;
- case 'a':
- case 'A':
- if (metaState == T) {
- metaState = A;
- } else {
- metaState = NO;
- }
- continue;
- default:
- metaState = NO;
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_ATTRIBUTE_NAME:
- beforeattributenameloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- continue;
- case '/':
- state = MetaScanner.SELF_CLOSING_START_TAG;
- continue stateloop;
- case '>':
- if (handleTag()) {
- break stateloop;
- }
- state = DATA;
- continue stateloop;
- case 'c':
- case 'C':
- contentIndex = 0;
- charsetIndex = 0;
- httpEquivIndex = Integer.MAX_VALUE;
- contentTypeIndex = Integer.MAX_VALUE;
- state = MetaScanner.ATTRIBUTE_NAME;
- break beforeattributenameloop;
- case 'h':
- case 'H':
- contentIndex = Integer.MAX_VALUE;
- charsetIndex = Integer.MAX_VALUE;
- httpEquivIndex = 0;
- contentTypeIndex = Integer.MAX_VALUE;
- state = MetaScanner.ATTRIBUTE_NAME;
- break beforeattributenameloop;
- default:
- contentIndex = Integer.MAX_VALUE;
- charsetIndex = Integer.MAX_VALUE;
- httpEquivIndex = Integer.MAX_VALUE;
- contentTypeIndex = Integer.MAX_VALUE;
- state = MetaScanner.ATTRIBUTE_NAME;
- break beforeattributenameloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case ATTRIBUTE_NAME:
- attributenameloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- state = MetaScanner.AFTER_ATTRIBUTE_NAME;
- continue stateloop;
- case '/':
- state = MetaScanner.SELF_CLOSING_START_TAG;
- continue stateloop;
- case '=':
- strBufLen = 0;
- contentTypeIndex = 0;
- state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
- break attributenameloop;
- // continue stateloop;
- case '>':
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- if (metaState == A) {
- if (c >= 'A' && c <= 'Z') {
- c += 0x20;
- }
- if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
- ++contentIndex;
- } else {
- contentIndex = Integer.MAX_VALUE;
- }
- if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
- ++charsetIndex;
- } else {
- charsetIndex = Integer.MAX_VALUE;
- }
- if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
- ++httpEquivIndex;
- } else {
- httpEquivIndex = Integer.MAX_VALUE;
- }
- }
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_ATTRIBUTE_VALUE:
- beforeattributevalueloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- continue;
- case '"':
- state = MetaScanner.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
- break beforeattributevalueloop;
- // continue stateloop;
- case '\'':
- state = MetaScanner.ATTRIBUTE_VALUE_SINGLE_QUOTED;
- continue stateloop;
- case '>':
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- handleCharInAttributeValue(c);
- state = MetaScanner.ATTRIBUTE_VALUE_UNQUOTED;
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
- attributevaluedoublequotedloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- switch (c) {
- case -1:
- break stateloop;
- case '"':
- handleAttributeValue();
- state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
- break attributevaluedoublequotedloop;
- // continue stateloop;
- default:
- handleCharInAttributeValue(c);
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_ATTRIBUTE_VALUE_QUOTED:
- afterattributevaluequotedloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
- continue stateloop;
- case '/':
- state = MetaScanner.SELF_CLOSING_START_TAG;
- break afterattributevaluequotedloop;
- // continue stateloop;
- case '>':
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
- reconsume = true;
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case SELF_CLOSING_START_TAG:
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '>':
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
- reconsume = true;
- continue stateloop;
- }
- // XXX reorder point
- case ATTRIBUTE_VALUE_UNQUOTED:
- for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
-
- case '\u000C':
- handleAttributeValue();
- state = MetaScanner.BEFORE_ATTRIBUTE_NAME;
- continue stateloop;
- case '>':
- handleAttributeValue();
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- handleCharInAttributeValue(c);
- continue;
- }
- }
- // XXX reorder point
- case AFTER_ATTRIBUTE_NAME:
- for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case ' ':
- case '\t':
- case '\n':
- case '\u000C':
- continue;
- case '/':
- handleAttributeValue();
- state = MetaScanner.SELF_CLOSING_START_TAG;
- continue stateloop;
- case '=':
- strBufLen = 0;
- contentTypeIndex = 0;
- state = MetaScanner.BEFORE_ATTRIBUTE_VALUE;
- continue stateloop;
- case '>':
- handleAttributeValue();
- if (handleTag()) {
- break stateloop;
- }
- state = MetaScanner.DATA;
- continue stateloop;
- case 'c':
- case 'C':
- contentIndex = 0;
- charsetIndex = 0;
- state = MetaScanner.ATTRIBUTE_NAME;
- continue stateloop;
- default:
- contentIndex = Integer.MAX_VALUE;
- charsetIndex = Integer.MAX_VALUE;
- state = MetaScanner.ATTRIBUTE_NAME;
- continue stateloop;
- }
- }
- // XXX reorder point
- case MARKUP_DECLARATION_OPEN:
- markupdeclarationopenloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.MARKUP_DECLARATION_HYPHEN;
- break markupdeclarationopenloop;
- // continue stateloop;
- default:
- state = MetaScanner.SCAN_UNTIL_GT;
- reconsume = true;
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case MARKUP_DECLARATION_HYPHEN:
- markupdeclarationhyphenloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.COMMENT_START;
- break markupdeclarationhyphenloop;
- // continue stateloop;
- default:
- state = MetaScanner.SCAN_UNTIL_GT;
- reconsume = true;
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_START:
- commentstartloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.COMMENT_START_DASH;
- continue stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- state = MetaScanner.COMMENT;
- break commentstartloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT:
- commentloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.COMMENT_END_DASH;
- break commentloop;
- // continue stateloop;
- default:
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_END_DASH:
- commentenddashloop: for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.COMMENT_END;
- break commentenddashloop;
- // continue stateloop;
- default:
- state = MetaScanner.COMMENT;
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_END:
- for (;;) {
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- case '-':
- continue;
- default:
- state = MetaScanner.COMMENT;
- continue stateloop;
- }
- }
- // XXX reorder point
- case COMMENT_START_DASH:
- c = read();
- switch (c) {
- case -1:
- break stateloop;
- case '-':
- state = MetaScanner.COMMENT_END;
- continue stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- state = MetaScanner.COMMENT;
- continue stateloop;
- }
- // XXX reorder point
- case ATTRIBUTE_VALUE_SINGLE_QUOTED:
- for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- switch (c) {
- case -1:
- break stateloop;
- case '\'':
- handleAttributeValue();
- state = MetaScanner.AFTER_ATTRIBUTE_VALUE_QUOTED;
- continue stateloop;
- default:
- handleCharInAttributeValue(c);
- continue;
- }
- }
- // XXX reorder point
- case SCAN_UNTIL_GT:
- for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- c = read();
- }
- switch (c) {
- case -1:
- break stateloop;
- case '>':
- state = MetaScanner.DATA;
- continue stateloop;
- default:
- continue;
- }
- }
- }
- }
- stateSave = state;
- }
-
- private void handleCharInAttributeValue(int c) {
- if (metaState == A) {
- if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
- addToBuffer(c);
- } else if (httpEquivIndex == HTTP_EQUIV.length) {
- if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
- ++contentTypeIndex;
- } else {
- contentTypeIndex = Integer.MAX_VALUE;
- }
- }
- }
- }
-
- @Inline private int toAsciiLowerCase(int c) {
- if (c >= 'A' && c <= 'Z') {
- return c + 0x20;
- }
- return c;
- }
-
- /**
- * Adds a character to the accumulation buffer.
- * @param c the character to add
- */
- private void addToBuffer(int c) {
- if (strBufLen == strBuf.length) {
- char[] newBuf = new char[strBuf.length + (strBuf.length << 1)];
- System.arraycopy(strBuf, 0, newBuf, 0, strBuf.length);
- strBuf = newBuf;
- }
- strBuf[strBufLen++] = (char)c;
- }
-
- /**
- * Attempts to extract a charset name from the accumulation buffer.
- * @return <code>true</code> if successful
- * @throws SAXException
- */
- private void handleAttributeValue() throws SAXException {
- if (metaState != A) {
- return;
- }
- if (contentIndex == CONTENT.length && content == null) {
- content = Portability.newStringFromBuffer(strBuf, 0, strBufLen
- // CPPONLY: , treeBuilder
- );
- return;
- }
- if (charsetIndex == CHARSET.length && charset == null) {
- charset = Portability.newStringFromBuffer(strBuf, 0, strBufLen
- // CPPONLY: , treeBuilder
- );
- return;
- }
- if (httpEquivIndex == HTTP_EQUIV.length
- && httpEquivState == HTTP_EQUIV_NOT_SEEN) {
- httpEquivState = (contentTypeIndex == CONTENT_TYPE.length) ? HTTP_EQUIV_CONTENT_TYPE
- : HTTP_EQUIV_OTHER;
- return;
- }
- }
-
- private boolean handleTag() throws SAXException {
- boolean stop = handleTagInner();
- Portability.releaseString(content);
- content = null;
- Portability.releaseString(charset);
- charset = null;
- httpEquivState = HTTP_EQUIV_NOT_SEEN;
- return stop;
- }
-
- private boolean handleTagInner() throws SAXException {
- if (charset != null && tryCharset(charset)) {
- return true;
- }
- if (content != null && httpEquivState == HTTP_EQUIV_CONTENT_TYPE) {
- String extract = TreeBuilder.extractCharsetFromContent(content
- // CPPONLY: , treeBuilder
- );
- if (extract == null) {
- return false;
- }
- boolean success = tryCharset(extract);
- Portability.releaseString(extract);
- return success;
- }
- return false;
- }
-
- /**
- * Tries to switch to an encoding.
- *
- * @param encoding
- * @return <code>true</code> if successful
- * @throws SAXException
- */
- protected abstract boolean tryCharset(String encoding) throws SAXException;
-
-}
diff --git a/parser/html/javasrc/Portability.java b/parser/html/javasrc/Portability.java
deleted file mode 100644
index 485684ea1..000000000
--- a/parser/html/javasrc/Portability.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2008-2015 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import nu.validator.htmlparser.annotation.Literal;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NoLength;
-import nu.validator.htmlparser.common.Interner;
-
-public final class Portability {
-
- // Allocating methods
-
- /**
- * Allocates a new local name object. In C++, the refcount must be set up in such a way that
- * calling <code>releaseLocal</code> on the return value balances the refcount set by this method.
- */
- public static @Local String newLocalNameFromBuffer(@NoLength char[] buf, int offset, int length, Interner interner) {
- return new String(buf, offset, length).intern();
- }
-
- public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length
- // CPPONLY: , TreeBuilder treeBuilder
- ) {
- return new String(buf, offset, length);
- }
-
- public static String newEmptyString() {
- return "";
- }
-
- public static String newStringFromLiteral(@Literal String literal) {
- return literal;
- }
-
- public static String newStringFromString(String string) {
- return string;
- }
-
- // XXX get rid of this
- public static char[] newCharArrayFromLocal(@Local String local) {
- return local.toCharArray();
- }
-
- public static char[] newCharArrayFromString(String string) {
- return string.toCharArray();
- }
-
- public static @Local String newLocalFromLocal(@Local String local, Interner interner) {
- return local;
- }
-
- // Deallocation methods
-
- public static void releaseString(String str) {
- // No-op in Java
- }
-
- // Comparison methods
-
- public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int offset, int length) {
- if (local.length() != length) {
- return false;
- }
- for (int i = 0; i < length; i++) {
- if (local.charAt(i) != buf[offset + i]) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
- String string) {
- if (string == null) {
- return false;
- }
- if (lowerCaseLiteral.length() > string.length()) {
- return false;
- }
- for (int i = 0; i < lowerCaseLiteral.length(); i++) {
- char c0 = lowerCaseLiteral.charAt(i);
- char c1 = string.charAt(i);
- if (c1 >= 'A' && c1 <= 'Z') {
- c1 += 0x20;
- }
- if (c0 != c1) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean lowerCaseLiteralEqualsIgnoreAsciiCaseString(@Literal String lowerCaseLiteral,
- String string) {
- if (string == null) {
- return false;
- }
- if (lowerCaseLiteral.length() != string.length()) {
- return false;
- }
- for (int i = 0; i < lowerCaseLiteral.length(); i++) {
- char c0 = lowerCaseLiteral.charAt(i);
- char c1 = string.charAt(i);
- if (c1 >= 'A' && c1 <= 'Z') {
- c1 += 0x20;
- }
- if (c0 != c1) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean literalEqualsString(@Literal String literal, String string) {
- return literal.equals(string);
- }
-
- public static boolean stringEqualsString(String one, String other) {
- return one.equals(other);
- }
-
- public static void delete(Object o) {
-
- }
-
- public static void deleteArray(Object o) {
-
- }
-}
diff --git a/parser/html/javasrc/README.txt b/parser/html/javasrc/README.txt
deleted file mode 100644
index 4555969ca..000000000
--- a/parser/html/javasrc/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-The .java files in this directory were placed here by the Java-to-C++
-translator that lives in parser/html/java/translator. Together they represent
-a snapshot of the Java code that was translated to produce the corresponding
-.h and .cpp files in the parent directory. Changing these .java files is not
-worthwhile, as they will just be overwritten by the next translation. See
-parser/html/java/README.txt for information about performing the translation.
diff --git a/parser/html/javasrc/StackNode.java b/parser/html/javasrc/StackNode.java
deleted file mode 100644
index 9aeaba0be..000000000
--- a/parser/html/javasrc/StackNode.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2007 Henri Sivonen
- * Copyright (c) 2007-2011 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import nu.validator.htmlparser.annotation.Inline;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NsUri;
-
-final class StackNode<T> {
- final int flags;
-
- final @Local String name;
-
- final @Local String popName;
-
- final @NsUri String ns;
-
- final T node;
-
- // Only used on the list of formatting elements
- HtmlAttributes attributes;
-
- private int refcount = 1;
-
- // [NOCPP[
-
- private final TaintableLocatorImpl locator;
-
- public TaintableLocatorImpl getLocator() {
- return locator;
- }
-
- // ]NOCPP]
-
- @Inline public int getFlags() {
- return flags;
- }
-
- public int getGroup() {
- return flags & ElementName.GROUP_MASK;
- }
-
- public boolean isScoping() {
- return (flags & ElementName.SCOPING) != 0;
- }
-
- public boolean isSpecial() {
- return (flags & ElementName.SPECIAL) != 0;
- }
-
- public boolean isFosterParenting() {
- return (flags & ElementName.FOSTER_PARENTING) != 0;
- }
-
- public boolean isHtmlIntegrationPoint() {
- return (flags & ElementName.HTML_INTEGRATION_POINT) != 0;
- }
-
- // [NOCPP[
-
- public boolean isOptionalEndTag() {
- return (flags & ElementName.OPTIONAL_END_TAG) != 0;
- }
-
- // ]NOCPP]
-
- /**
- * Constructor for copying. This doesn't take another <code>StackNode</code>
- * because in C++ the caller is reponsible for reobtaining the local names
- * from another interner.
- *
- * @param flags
- * @param ns
- * @param name
- * @param node
- * @param popName
- * @param attributes
- */
- StackNode(int flags, @NsUri String ns, @Local String name, T node,
- @Local String popName, HtmlAttributes attributes
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = flags;
- this.name = name;
- this.popName = popName;
- this.ns = ns;
- this.node = node;
- this.attributes = attributes;
- this.refcount = 1;
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- /**
- * Short hand for well-known HTML elements.
- *
- * @param elementName
- * @param node
- */
- StackNode(ElementName elementName, T node
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = elementName.getFlags();
- this.name = elementName.name;
- this.popName = elementName.name;
- this.ns = "http://www.w3.org/1999/xhtml";
- this.node = node;
- this.attributes = null;
- this.refcount = 1;
- assert !elementName.isCustom() : "Don't use this constructor for custom elements.";
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- /**
- * Constructor for HTML formatting elements.
- *
- * @param elementName
- * @param node
- * @param attributes
- */
- StackNode(ElementName elementName, T node, HtmlAttributes attributes
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = elementName.getFlags();
- this.name = elementName.name;
- this.popName = elementName.name;
- this.ns = "http://www.w3.org/1999/xhtml";
- this.node = node;
- this.attributes = attributes;
- this.refcount = 1;
- assert !elementName.isCustom() : "Don't use this constructor for custom elements.";
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- /**
- * The common-case HTML constructor.
- *
- * @param elementName
- * @param node
- * @param popName
- */
- StackNode(ElementName elementName, T node, @Local String popName
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = elementName.getFlags();
- this.name = elementName.name;
- this.popName = popName;
- this.ns = "http://www.w3.org/1999/xhtml";
- this.node = node;
- this.attributes = null;
- this.refcount = 1;
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- /**
- * Constructor for SVG elements. Note that the order of the arguments is
- * what distinguishes this from the HTML constructor. This is ugly, but
- * AFAICT the least disruptive way to make this work with Java's generics
- * and without unnecessary branches. :-(
- *
- * @param elementName
- * @param popName
- * @param node
- */
- StackNode(ElementName elementName, @Local String popName, T node
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = prepareSvgFlags(elementName.getFlags());
- this.name = elementName.name;
- this.popName = popName;
- this.ns = "http://www.w3.org/2000/svg";
- this.node = node;
- this.attributes = null;
- this.refcount = 1;
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- /**
- * Constructor for MathML.
- *
- * @param elementName
- * @param node
- * @param popName
- * @param markAsIntegrationPoint
- */
- StackNode(ElementName elementName, T node, @Local String popName,
- boolean markAsIntegrationPoint
- // [NOCPP[
- , TaintableLocatorImpl locator
- // ]NOCPP]
- ) {
- this.flags = prepareMathFlags(elementName.getFlags(),
- markAsIntegrationPoint);
- this.name = elementName.name;
- this.popName = popName;
- this.ns = "http://www.w3.org/1998/Math/MathML";
- this.node = node;
- this.attributes = null;
- this.refcount = 1;
- // [NOCPP[
- this.locator = locator;
- // ]NOCPP]
- }
-
- private static int prepareSvgFlags(int flags) {
- flags &= ~(ElementName.FOSTER_PARENTING | ElementName.SCOPING
- | ElementName.SPECIAL | ElementName.OPTIONAL_END_TAG);
- if ((flags & ElementName.SCOPING_AS_SVG) != 0) {
- flags |= (ElementName.SCOPING | ElementName.SPECIAL | ElementName.HTML_INTEGRATION_POINT);
- }
- return flags;
- }
-
- private static int prepareMathFlags(int flags,
- boolean markAsIntegrationPoint) {
- flags &= ~(ElementName.FOSTER_PARENTING | ElementName.SCOPING
- | ElementName.SPECIAL | ElementName.OPTIONAL_END_TAG);
- if ((flags & ElementName.SCOPING_AS_MATHML) != 0) {
- flags |= (ElementName.SCOPING | ElementName.SPECIAL);
- }
- if (markAsIntegrationPoint) {
- flags |= ElementName.HTML_INTEGRATION_POINT;
- }
- return flags;
- }
-
- @SuppressWarnings("unused") private void destructor() {
- Portability.delete(attributes);
- }
-
- public void dropAttributes() {
- attributes = null;
- }
-
- // [NOCPP[
- /**
- * @see java.lang.Object#toString()
- */
- @Override public @Local String toString() {
- return name;
- }
-
- // ]NOCPP]
-
- public void retain() {
- refcount++;
- }
-
- public void release() {
- refcount--;
- if (refcount == 0) {
- Portability.delete(this);
- }
- }
-}
diff --git a/parser/html/javasrc/StateSnapshot.java b/parser/html/javasrc/StateSnapshot.java
deleted file mode 100644
index ff89e0443..000000000
--- a/parser/html/javasrc/StateSnapshot.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2009-2010 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import nu.validator.htmlparser.annotation.Auto;
-
-
-public class StateSnapshot<T> implements TreeBuilderState<T> {
-
- private final @Auto StackNode<T>[] stack;
-
- private final @Auto StackNode<T>[] listOfActiveFormattingElements;
-
- private final @Auto int[] templateModeStack;
-
- private final T formPointer;
-
- private final T headPointer;
-
- private final T deepTreeSurrogateParent;
-
- private final int mode;
-
- private final int originalMode;
-
- private final boolean framesetOk;
-
- private final boolean needToDropLF;
-
- private final boolean quirks;
-
- /**
- * @param stack
- * @param listOfActiveFormattingElements
- * @param templateModeStack
- * @param formPointer
- * @param headPointer
- * @param deepTreeSurrogateParent
- * @param mode
- * @param originalMode
- * @param framesetOk
- * @param needToDropLF
- * @param quirks
- */
- StateSnapshot(StackNode<T>[] stack,
- StackNode<T>[] listOfActiveFormattingElements, int[] templateModeStack, T formPointer,
- T headPointer, T deepTreeSurrogateParent, int mode, int originalMode,
- boolean framesetOk, boolean needToDropLF, boolean quirks) {
- this.stack = stack;
- this.listOfActiveFormattingElements = listOfActiveFormattingElements;
- this.templateModeStack = templateModeStack;
- this.formPointer = formPointer;
- this.headPointer = headPointer;
- this.deepTreeSurrogateParent = deepTreeSurrogateParent;
- this.mode = mode;
- this.originalMode = originalMode;
- this.framesetOk = framesetOk;
- this.needToDropLF = needToDropLF;
- this.quirks = quirks;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
- */
- public StackNode<T>[] getStack() {
- return stack;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
- */
- public int[] getTemplateModeStack() {
- return templateModeStack;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
- */
- public StackNode<T>[] getListOfActiveFormattingElements() {
- return listOfActiveFormattingElements;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
- */
- public T getFormPointer() {
- return formPointer;
- }
-
- /**
- * Returns the headPointer.
- *
- * @return the headPointer
- */
- public T getHeadPointer() {
- return headPointer;
- }
-
- /**
- * Returns the deepTreeSurrogateParent.
- *
- * @return the deepTreeSurrogateParent
- */
- public T getDeepTreeSurrogateParent() {
- return deepTreeSurrogateParent;
- }
-
- /**
- * Returns the mode.
- *
- * @return the mode
- */
- public int getMode() {
- return mode;
- }
-
- /**
- * Returns the originalMode.
- *
- * @return the originalMode
- */
- public int getOriginalMode() {
- return originalMode;
- }
-
- /**
- * Returns the framesetOk.
- *
- * @return the framesetOk
- */
- public boolean isFramesetOk() {
- return framesetOk;
- }
-
- /**
- * Returns the needToDropLF.
- *
- * @return the needToDropLF
- */
- public boolean isNeedToDropLF() {
- return needToDropLF;
- }
-
- /**
- * Returns the quirks.
- *
- * @return the quirks
- */
- public boolean isQuirks() {
- return quirks;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
- */
- public int getListOfActiveFormattingElementsLength() {
- return listOfActiveFormattingElements.length;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
- */
- public int getStackLength() {
- return stack.length;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
- */
- public int getTemplateModeStackLength() {
- return templateModeStack.length;
- }
-
- @SuppressWarnings("unused") private void destructor() {
- for (int i = 0; i < stack.length; i++) {
- stack[i].release();
- }
- for (int i = 0; i < listOfActiveFormattingElements.length; i++) {
- if (listOfActiveFormattingElements[i] != null) {
- listOfActiveFormattingElements[i].release();
- }
- }
- }
-}
diff --git a/parser/html/javasrc/Tokenizer.java b/parser/html/javasrc/Tokenizer.java
deleted file mode 100644
index f141d94d7..000000000
--- a/parser/html/javasrc/Tokenizer.java
+++ /dev/null
@@ -1,7089 +0,0 @@
-/*
- * Copyright (c) 2005-2007 Henri Sivonen
- * Copyright (c) 2007-2015 Mozilla Foundation
- * Copyright (c) 2019 Moonchild Productions
- * Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla
- * Foundation, and Opera Software ASA.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The comments following this one that use the same comment syntax as this
- * comment are quotes from the WHATWG HTML 5 spec as of 2 June 2007
- * amended as of June 18 2008 and May 31 2010.
- * That document came with this statement:
- * "© Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce and
- * create derivative works of this document."
- */
-
-package nu.validator.htmlparser.impl;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import nu.validator.htmlparser.annotation.Auto;
-import nu.validator.htmlparser.annotation.CharacterName;
-import nu.validator.htmlparser.annotation.Const;
-import nu.validator.htmlparser.annotation.Inline;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NoLength;
-import nu.validator.htmlparser.common.EncodingDeclarationHandler;
-import nu.validator.htmlparser.common.Interner;
-import nu.validator.htmlparser.common.TokenHandler;
-import nu.validator.htmlparser.common.XmlViolationPolicy;
-
-/**
- * An implementation of
- * https://html.spec.whatwg.org/multipage/syntax.html#tokenization
- *
- * This class implements the <code>Locator</code> interface. This is not an
- * incidental implementation detail: Users of this class are encouraged to make
- * use of the <code>Locator</code> nature.
- *
- * By default, the tokenizer may report data that XML 1.0 bans. The tokenizer
- * can be configured to treat these conditions as fatal or to coerce the infoset
- * to something that XML 1.0 allows.
- *
- * @version $Id$
- * @author hsivonen
- */
-public class Tokenizer implements Locator {
-
- private static final int DATA_AND_RCDATA_MASK = ~1;
-
- public static final int DATA = 0;
-
- public static final int RCDATA = 1;
-
- public static final int SCRIPT_DATA = 2;
-
- public static final int RAWTEXT = 3;
-
- public static final int SCRIPT_DATA_ESCAPED = 4;
-
- public static final int ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
-
- public static final int ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
-
- public static final int ATTRIBUTE_VALUE_UNQUOTED = 7;
-
- public static final int PLAINTEXT = 8;
-
- public static final int TAG_OPEN = 9;
-
- public static final int CLOSE_TAG_OPEN = 10;
-
- public static final int TAG_NAME = 11;
-
- public static final int BEFORE_ATTRIBUTE_NAME = 12;
-
- public static final int ATTRIBUTE_NAME = 13;
-
- public static final int AFTER_ATTRIBUTE_NAME = 14;
-
- public static final int BEFORE_ATTRIBUTE_VALUE = 15;
-
- public static final int AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
-
- public static final int BOGUS_COMMENT = 17;
-
- public static final int MARKUP_DECLARATION_OPEN = 18;
-
- public static final int DOCTYPE = 19;
-
- public static final int BEFORE_DOCTYPE_NAME = 20;
-
- public static final int DOCTYPE_NAME = 21;
-
- public static final int AFTER_DOCTYPE_NAME = 22;
-
- public static final int BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
-
- public static final int DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
-
- public static final int DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
-
- public static final int AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
-
- public static final int BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
-
- public static final int DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
-
- public static final int DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
-
- public static final int AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
-
- public static final int BOGUS_DOCTYPE = 31;
-
- public static final int COMMENT_START = 32;
-
- public static final int COMMENT_START_DASH = 33;
-
- public static final int COMMENT = 34;
-
- public static final int COMMENT_END_DASH = 35;
-
- public static final int COMMENT_END = 36;
-
- public static final int COMMENT_END_BANG = 37;
-
- public static final int NON_DATA_END_TAG_NAME = 38;
-
- public static final int MARKUP_DECLARATION_HYPHEN = 39;
-
- public static final int MARKUP_DECLARATION_OCTYPE = 40;
-
- public static final int DOCTYPE_UBLIC = 41;
-
- public static final int DOCTYPE_YSTEM = 42;
-
- public static final int AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
-
- public static final int BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
-
- public static final int AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
-
- public static final int CONSUME_CHARACTER_REFERENCE = 46;
-
- public static final int CONSUME_NCR = 47;
-
- public static final int CHARACTER_REFERENCE_TAIL = 48;
-
- public static final int HEX_NCR_LOOP = 49;
-
- public static final int DECIMAL_NRC_LOOP = 50;
-
- public static final int HANDLE_NCR_VALUE = 51;
-
- public static final int HANDLE_NCR_VALUE_RECONSUME = 52;
-
- public static final int CHARACTER_REFERENCE_HILO_LOOKUP = 53;
-
- public static final int SELF_CLOSING_START_TAG = 54;
-
- public static final int CDATA_START = 55;
-
- public static final int CDATA_SECTION = 56;
-
- public static final int CDATA_RSQB = 57;
-
- public static final int CDATA_RSQB_RSQB = 58;
-
- public static final int SCRIPT_DATA_LESS_THAN_SIGN = 59;
-
- public static final int SCRIPT_DATA_ESCAPE_START = 60;
-
- public static final int SCRIPT_DATA_ESCAPE_START_DASH = 61;
-
- public static final int SCRIPT_DATA_ESCAPED_DASH = 62;
-
- public static final int SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
-
- public static final int BOGUS_COMMENT_HYPHEN = 64;
-
- public static final int RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
-
- public static final int SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPED = 68;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
-
- public static final int SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
-
- public static final int PROCESSING_INSTRUCTION = 73;
-
- public static final int PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
-
- /**
- * Magic value for UTF-16 operations.
- */
- private static final int LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
-
- /**
- * UTF-16 code unit array containing less than and greater than for emitting
- * those characters on certain parse errors.
- */
- private static final @NoLength char[] LT_GT = { '<', '>' };
-
- /**
- * UTF-16 code unit array containing less than and solidus for emitting
- * those characters on certain parse errors.
- */
- private static final @NoLength char[] LT_SOLIDUS = { '<', '/' };
-
- /**
- * UTF-16 code unit array containing ]] for emitting those characters on
- * state transitions.
- */
- private static final @NoLength char[] RSQB_RSQB = { ']', ']' };
-
- /**
- * Array version of U+FFFD.
- */
- private static final @NoLength char[] REPLACEMENT_CHARACTER = { '\uFFFD' };
-
- // [NOCPP[
-
- /**
- * Array version of space.
- */
- private static final @NoLength char[] SPACE = { ' ' };
-
- // ]NOCPP]
-
- /**
- * Array version of line feed.
- */
- private static final @NoLength char[] LF = { '\n' };
-
- /**
- * "CDATA[" as <code>char[]</code>
- */
- private static final @NoLength char[] CDATA_LSQB = { 'C', 'D', 'A', 'T',
- 'A', '[' };
-
- /**
- * "octype" as <code>char[]</code>
- */
- private static final @NoLength char[] OCTYPE = { 'o', 'c', 't', 'y', 'p',
- 'e' };
-
- /**
- * "ublic" as <code>char[]</code>
- */
- private static final @NoLength char[] UBLIC = { 'u', 'b', 'l', 'i', 'c' };
-
- /**
- * "ystem" as <code>char[]</code>
- */
- private static final @NoLength char[] YSTEM = { 'y', 's', 't', 'e', 'm' };
-
- private static final char[] TITLE_ARR = { 't', 'i', 't', 'l', 'e' };
-
- private static final char[] SCRIPT_ARR = { 's', 'c', 'r', 'i', 'p', 't' };
-
- private static final char[] STYLE_ARR = { 's', 't', 'y', 'l', 'e' };
-
- private static final char[] PLAINTEXT_ARR = { 'p', 'l', 'a', 'i', 'n', 't',
- 'e', 'x', 't' };
-
- private static final char[] XMP_ARR = { 'x', 'm', 'p' };
-
- private static final char[] TEXTAREA_ARR = { 't', 'e', 'x', 't', 'a', 'r',
- 'e', 'a' };
-
- private static final char[] IFRAME_ARR = { 'i', 'f', 'r', 'a', 'm', 'e' };
-
- private static final char[] NOEMBED_ARR = { 'n', 'o', 'e', 'm', 'b', 'e',
- 'd' };
-
- private static final char[] NOSCRIPT_ARR = { 'n', 'o', 's', 'c', 'r', 'i',
- 'p', 't' };
-
- private static final char[] NOFRAMES_ARR = { 'n', 'o', 'f', 'r', 'a', 'm',
- 'e', 's' };
-
- /**
- * The token handler.
- */
- protected final TokenHandler tokenHandler;
-
- protected EncodingDeclarationHandler encodingDeclarationHandler;
-
- // [NOCPP[
-
- /**
- * The error handler.
- */
- protected ErrorHandler errorHandler;
-
- // ]NOCPP]
-
- /**
- * Whether the previous char read was CR.
- */
- protected boolean lastCR;
-
- protected int stateSave;
-
- private int returnStateSave;
-
- protected int index;
-
- private boolean forceQuirks;
-
- private char additional;
-
- private int entCol;
-
- private int firstCharKey;
-
- private int lo;
-
- private int hi;
-
- private int candidate;
-
- private int charRefBufMark;
-
- protected int value;
-
- private boolean seenDigits;
-
- protected int cstart;
-
- /**
- * The SAX public id for the resource being tokenized. (Only passed to back
- * as part of locator data.)
- */
- private String publicId;
-
- /**
- * The SAX system id for the resource being tokenized. (Only passed to back
- * as part of locator data.)
- */
- private String systemId;
-
- /**
- * Buffer for bufferable things other than those that fit the description
- * of <code>charRefBuf</code>.
- */
- private @Auto char[] strBuf;
-
- /**
- * Number of significant <code>char</code>s in <code>strBuf</code>.
- */
- private int strBufLen;
-
- /**
- * Buffer for characters that might form a character reference but may
- * end up not forming one.
- */
- private final @Auto char[] charRefBuf;
-
- /**
- * Number of significant <code>char</code>s in <code>charRefBuf</code>.
- */
- private int charRefBufLen;
-
- /**
- * Buffer for expanding NCRs falling into the Basic Multilingual Plane.
- */
- private final @Auto char[] bmpChar;
-
- /**
- * Buffer for expanding astral NCRs.
- */
- private final @Auto char[] astralChar;
-
- /**
- * The element whose end tag closes the current CDATA or RCDATA element.
- */
- protected ElementName endTagExpectation = null;
-
- private char[] endTagExpectationAsArray; // not @Auto!
-
- /**
- * <code>true</code> if tokenizing an end tag
- */
- protected boolean endTag;
-
- /**
- * The current tag token name.
- */
- private ElementName tagName = null;
-
- /**
- * The current attribute name.
- */
- protected AttributeName attributeName = null;
-
- // [NOCPP[
-
- /**
- * Whether comment tokens are emitted.
- */
- private boolean wantsComments = false;
-
- /**
- * <code>true</code> when HTML4-specific additional errors are requested.
- */
- protected boolean html4;
-
- /**
- * Whether the stream is past the first 1024 bytes.
- */
- private boolean metaBoundaryPassed;
-
- // ]NOCPP]
-
- /**
- * The name of the current doctype token.
- */
- private @Local String doctypeName;
-
- /**
- * The public id of the current doctype token.
- */
- private String publicIdentifier;
-
- /**
- * The system id of the current doctype token.
- */
- private String systemIdentifier;
-
- /**
- * The attribute holder.
- */
- private HtmlAttributes attributes;
-
- // [NOCPP[
-
- /**
- * The policy for vertical tab and form feed.
- */
- private XmlViolationPolicy contentSpacePolicy = XmlViolationPolicy.ALTER_INFOSET;
-
- /**
- * The policy for comments.
- */
- private XmlViolationPolicy commentPolicy = XmlViolationPolicy.ALTER_INFOSET;
-
- private XmlViolationPolicy xmlnsPolicy = XmlViolationPolicy.ALTER_INFOSET;
-
- private XmlViolationPolicy namePolicy = XmlViolationPolicy.ALTER_INFOSET;
-
- private boolean html4ModeCompatibleWithXhtml1Schemata;
-
- private int mappingLangToXmlLang;
-
- // ]NOCPP]
-
- private final boolean newAttributesEachTime;
-
- private boolean shouldSuspend;
-
- protected boolean confident;
-
- private int line;
-
- /*
- * The line number of the current attribute. First set to the line of the
- * attribute name and if there is a value, set to the line the value
- * started on.
- */
- // CPPONLY: private int attributeLine;
-
- private Interner interner;
-
- // CPPONLY: private boolean viewingXmlSource;
-
- // [NOCPP[
-
- protected LocatorImpl ampersandLocation;
-
- public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
- this.tokenHandler = tokenHandler;
- this.encodingDeclarationHandler = null;
- this.newAttributesEachTime = newAttributesEachTime;
- // &CounterClockwiseContourIntegral; is the longest valid char ref and
- // the semicolon never gets appended to the buffer.
- this.charRefBuf = new char[32];
- this.bmpChar = new char[1];
- this.astralChar = new char[2];
- this.tagName = null;
- this.attributeName = null;
- this.doctypeName = null;
- this.publicIdentifier = null;
- this.systemIdentifier = null;
- this.attributes = null;
- }
-
- // ]NOCPP]
-
- /**
- * The constructor.
- *
- * @param tokenHandler
- * the handler for receiving tokens
- */
- public Tokenizer(TokenHandler tokenHandler
- // CPPONLY: , boolean viewingXmlSource
- ) {
- this.tokenHandler = tokenHandler;
- this.encodingDeclarationHandler = null;
- // [NOCPP[
- this.newAttributesEachTime = false;
- // ]NOCPP]
- // &CounterClockwiseContourIntegral; is the longest valid char ref and
- // the semicolon never gets appended to the buffer.
- this.charRefBuf = new char[32];
- this.bmpChar = new char[1];
- this.astralChar = new char[2];
- this.tagName = null;
- this.attributeName = null;
- this.doctypeName = null;
- this.publicIdentifier = null;
- this.systemIdentifier = null;
- // [NOCPP[
- this.attributes = null;
- // ]NOCPP]
- // CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null;
- // CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder();
- // CPPONLY: this.viewingXmlSource = viewingXmlSource;
- }
-
- public void setInterner(Interner interner) {
- this.interner = interner;
- }
-
- public void initLocation(String newPublicId, String newSystemId) {
- this.systemId = newSystemId;
- this.publicId = newPublicId;
-
- }
-
- // CPPONLY: boolean isViewingXmlSource() {
- // CPPONLY: return viewingXmlSource;
- // CPPONLY: }
-
- // [NOCPP[
-
- /**
- * Returns the mappingLangToXmlLang.
- *
- * @return the mappingLangToXmlLang
- */
- public boolean isMappingLangToXmlLang() {
- return mappingLangToXmlLang == AttributeName.HTML_LANG;
- }
-
- /**
- * Sets the mappingLangToXmlLang.
- *
- * @param mappingLangToXmlLang
- * the mappingLangToXmlLang to set
- */
- public void setMappingLangToXmlLang(boolean mappingLangToXmlLang) {
- this.mappingLangToXmlLang = mappingLangToXmlLang ? AttributeName.HTML_LANG
- : AttributeName.HTML;
- }
-
- /**
- * Sets the error handler.
- *
- * @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)
- */
- public void setErrorHandler(ErrorHandler eh) {
- this.errorHandler = eh;
- }
-
- public ErrorHandler getErrorHandler() {
- return this.errorHandler;
- }
-
- /**
- * Sets the commentPolicy.
- *
- * @param commentPolicy
- * the commentPolicy to set
- */
- public void setCommentPolicy(XmlViolationPolicy commentPolicy) {
- this.commentPolicy = commentPolicy;
- }
-
- /**
- * Sets the contentNonXmlCharPolicy.
- *
- * @param contentNonXmlCharPolicy
- * the contentNonXmlCharPolicy to set
- */
- public void setContentNonXmlCharPolicy(
- XmlViolationPolicy contentNonXmlCharPolicy) {
- if (contentNonXmlCharPolicy != XmlViolationPolicy.ALLOW) {
- throw new IllegalArgumentException(
- "Must use ErrorReportingTokenizer to set contentNonXmlCharPolicy to non-ALLOW.");
- }
- }
-
- /**
- * Sets the contentSpacePolicy.
- *
- * @param contentSpacePolicy
- * the contentSpacePolicy to set
- */
- public void setContentSpacePolicy(XmlViolationPolicy contentSpacePolicy) {
- this.contentSpacePolicy = contentSpacePolicy;
- }
-
- /**
- * Sets the xmlnsPolicy.
- *
- * @param xmlnsPolicy
- * the xmlnsPolicy to set
- */
- public void setXmlnsPolicy(XmlViolationPolicy xmlnsPolicy) {
- if (xmlnsPolicy == XmlViolationPolicy.FATAL) {
- throw new IllegalArgumentException("Can't use FATAL here.");
- }
- this.xmlnsPolicy = xmlnsPolicy;
- }
-
- public void setNamePolicy(XmlViolationPolicy namePolicy) {
- this.namePolicy = namePolicy;
- }
-
- /**
- * Sets the html4ModeCompatibleWithXhtml1Schemata.
- *
- * @param html4ModeCompatibleWithXhtml1Schemata
- * the html4ModeCompatibleWithXhtml1Schemata to set
- */
- public void setHtml4ModeCompatibleWithXhtml1Schemata(
- boolean html4ModeCompatibleWithXhtml1Schemata) {
- this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;
- }
-
- // ]NOCPP]
-
- // For the token handler to call
- /**
- * Sets the tokenizer state and the associated element name. This should
- * only ever used to put the tokenizer into one of the states that have
- * a special end tag expectation.
- *
- * @param specialTokenizerState
- * the tokenizer state to set
- */
- public void setState(int specialTokenizerState) {
- this.stateSave = specialTokenizerState;
- this.endTagExpectation = null;
- this.endTagExpectationAsArray = null;
- }
-
- // [NOCPP[
-
- /**
- * Sets the tokenizer state and the associated element name. This should
- * only ever used to put the tokenizer into one of the states that have
- * a special end tag expectation. For use from the tokenizer test harness.
- *
- * @param specialTokenizerState
- * the tokenizer state to set
- * @param endTagExpectation
- * the expected end tag for transitioning back to normal
- */
- public void setStateAndEndTagExpectation(int specialTokenizerState,
- @Local String endTagExpectation) {
- this.stateSave = specialTokenizerState;
- if (specialTokenizerState == Tokenizer.DATA) {
- return;
- }
- @Auto char[] asArray = Portability.newCharArrayFromLocal(endTagExpectation);
- this.endTagExpectation = ElementName.elementNameByBuffer(asArray, 0,
- asArray.length, interner);
- endTagExpectationToArray();
- }
-
- // ]NOCPP]
-
- /**
- * Sets the tokenizer state and the associated element name. This should
- * only ever used to put the tokenizer into one of the states that have
- * a special end tag expectation.
- *
- * @param specialTokenizerState
- * the tokenizer state to set
- * @param endTagExpectation
- * the expected end tag for transitioning back to normal
- */
- public void setStateAndEndTagExpectation(int specialTokenizerState,
- ElementName endTagExpectation) {
- this.stateSave = specialTokenizerState;
- this.endTagExpectation = endTagExpectation;
- endTagExpectationToArray();
- }
-
- private void endTagExpectationToArray() {
- switch (endTagExpectation.getGroup()) {
- case TreeBuilder.TITLE:
- endTagExpectationAsArray = TITLE_ARR;
- return;
- case TreeBuilder.SCRIPT:
- endTagExpectationAsArray = SCRIPT_ARR;
- return;
- case TreeBuilder.STYLE:
- endTagExpectationAsArray = STYLE_ARR;
- return;
- case TreeBuilder.PLAINTEXT:
- endTagExpectationAsArray = PLAINTEXT_ARR;
- return;
- case TreeBuilder.XMP:
- endTagExpectationAsArray = XMP_ARR;
- return;
- case TreeBuilder.TEXTAREA:
- endTagExpectationAsArray = TEXTAREA_ARR;
- return;
- case TreeBuilder.IFRAME:
- endTagExpectationAsArray = IFRAME_ARR;
- return;
- case TreeBuilder.NOEMBED:
- endTagExpectationAsArray = NOEMBED_ARR;
- return;
- case TreeBuilder.NOSCRIPT:
- endTagExpectationAsArray = NOSCRIPT_ARR;
- return;
- case TreeBuilder.NOFRAMES:
- endTagExpectationAsArray = NOFRAMES_ARR;
- return;
- default:
- assert false: "Bad end tag expectation.";
- return;
- }
- }
-
- /**
- * For C++ use only.
- */
- public void setLineNumber(int line) {
- // CPPONLY: this.attributeLine = line; // XXX is this needed?
- this.line = line;
- }
-
- // start Locator impl
-
- /**
- * @see org.xml.sax.Locator#getLineNumber()
- */
- @Inline public int getLineNumber() {
- return line;
- }
-
- // [NOCPP[
-
- /**
- * @see org.xml.sax.Locator#getColumnNumber()
- */
- @Inline public int getColumnNumber() {
- return -1;
- }
-
- /**
- * @see org.xml.sax.Locator#getPublicId()
- */
- public String getPublicId() {
- return publicId;
- }
-
- /**
- * @see org.xml.sax.Locator#getSystemId()
- */
- public String getSystemId() {
- return systemId;
- }
-
- // end Locator impl
-
- // end public API
-
- public void notifyAboutMetaBoundary() {
- metaBoundaryPassed = true;
- }
-
- void turnOnAdditionalHtml4Errors() {
- html4 = true;
- }
-
- // ]NOCPP]
-
- HtmlAttributes emptyAttributes() {
- // [NOCPP[
- if (newAttributesEachTime) {
- return new HtmlAttributes(mappingLangToXmlLang);
- } else {
- // ]NOCPP]
- return HtmlAttributes.EMPTY_ATTRIBUTES;
- // [NOCPP[
- }
- // ]NOCPP]
- }
-
- @Inline private void appendCharRefBuf(char c) {
- // CPPONLY: assert charRefBufLen < charRefBuf.length:
- // CPPONLY: "RELEASE: Attempted to overrun charRefBuf!";
- charRefBuf[charRefBufLen++] = c;
- }
-
- private void emitOrAppendCharRefBuf(int returnState) throws SAXException {
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- appendCharRefBufToStrBuf();
- } else {
- if (charRefBufLen > 0) {
- tokenHandler.characters(charRefBuf, 0, charRefBufLen);
- charRefBufLen = 0;
- }
- }
- }
-
- @Inline private void clearStrBufAfterUse() {
- strBufLen = 0;
- }
-
- @Inline private void clearStrBufBeforeUse() {
- assert strBufLen == 0: "strBufLen not reset after previous use!";
- strBufLen = 0; // no-op in the absence of bugs
- }
-
- @Inline private void clearStrBufAfterOneHyphen() {
- assert strBufLen == 1: "strBufLen length not one!";
- assert strBuf[0] == '-': "strBuf does not start with a hyphen!";
- strBufLen = 0;
- }
-
- /**
- * Appends to the buffer.
- *
- * @param c
- * the UTF-16 code unit to append
- */
- @Inline private void appendStrBuf(char c) {
- // CPPONLY: assert strBufLen < strBuf.length: "Previous buffer length insufficient.";
- // CPPONLY: if (strBufLen == strBuf.length) {
- // CPPONLY: if (!EnsureBufferSpace(1)) {
- // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
- // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
- // CPPONLY: }
- strBuf[strBufLen++] = c;
- }
-
- /**
- * The buffer as a String. Currently only used for error reporting.
- *
- * <p>
- * C++ memory note: The return value must be released.
- *
- * @return the buffer as a string
- */
- protected String strBufToString() {
- String str = Portability.newStringFromBuffer(strBuf, 0, strBufLen
- // CPPONLY: , tokenHandler
- );
- clearStrBufAfterUse();
- return str;
- }
-
- /**
- * Returns the buffer as a local name. The return value is released in
- * emitDoctypeToken().
- *
- * @return the buffer as local name
- */
- private void strBufToDoctypeName() {
- doctypeName = Portability.newLocalNameFromBuffer(strBuf, 0, strBufLen,
- interner);
- clearStrBufAfterUse();
- }
-
- /**
- * Emits the buffer as character tokens.
- *
- * @throws SAXException
- * if the token handler threw
- */
- private void emitStrBuf() throws SAXException {
- if (strBufLen > 0) {
- tokenHandler.characters(strBuf, 0, strBufLen);
- clearStrBufAfterUse();
- }
- }
-
- @Inline private void appendSecondHyphenToBogusComment() throws SAXException {
- // [NOCPP[
- switch (commentPolicy) {
- case ALTER_INFOSET:
- appendStrBuf(' ');
- // FALLTHROUGH
- case ALLOW:
- warn("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
- // ]NOCPP]
- appendStrBuf('-');
- // [NOCPP[
- break;
- case FATAL:
- fatal("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
- break;
- }
- // ]NOCPP]
- }
-
- // [NOCPP[
- private void maybeAppendSpaceToBogusComment() throws SAXException {
- switch (commentPolicy) {
- case ALTER_INFOSET:
- appendStrBuf(' ');
- // FALLTHROUGH
- case ALLOW:
- warn("The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.");
- break;
- case FATAL:
- fatal("The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.");
- break;
- }
- }
-
- // ]NOCPP]
-
- @Inline private void adjustDoubleHyphenAndAppendToStrBufAndErr(char c)
- throws SAXException {
- errConsecutiveHyphens();
- // [NOCPP[
- switch (commentPolicy) {
- case ALTER_INFOSET:
- strBufLen--;
- // WARNING!!! This expands the worst case of the buffer length
- // given the length of input!
- appendStrBuf(' ');
- appendStrBuf('-');
- // FALLTHROUGH
- case ALLOW:
- warn("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
- // ]NOCPP]
- appendStrBuf(c);
- // [NOCPP[
- break;
- case FATAL:
- fatal("The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment.");
- break;
- }
- // ]NOCPP]
- }
-
- private void appendStrBuf(@NoLength char[] buffer, int offset, int length) {
- int newLen = strBufLen + length;
- // CPPONLY: assert newLen <= strBuf.length: "Previous buffer length insufficient.";
- // CPPONLY: if (strBuf.length < newLen) {
- // CPPONLY: if (!EnsureBufferSpace(length)) {
- // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
- // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
- // CPPONLY: }
- System.arraycopy(buffer, offset, strBuf, strBufLen, length);
- strBufLen = newLen;
- }
-
- /**
- * Append the contents of the char reference buffer to the main one.
- */
- @Inline private void appendCharRefBufToStrBuf() {
- appendStrBuf(charRefBuf, 0, charRefBufLen);
- charRefBufLen = 0;
- }
-
- /**
- * Emits the current comment token.
- *
- * @param pos
- * TODO
- *
- * @throws SAXException
- */
- private void emitComment(int provisionalHyphens, int pos)
- throws SAXException {
- // [NOCPP[
- if (wantsComments) {
- // ]NOCPP]
- tokenHandler.comment(strBuf, 0, strBufLen
- - provisionalHyphens);
- // [NOCPP[
- }
- // ]NOCPP]
- clearStrBufAfterUse();
- cstart = pos + 1;
- }
-
- /**
- * Flushes coalesced character tokens.
- *
- * @param buf
- * TODO
- * @param pos
- * TODO
- *
- * @throws SAXException
- */
- protected void flushChars(@NoLength char[] buf, int pos)
- throws SAXException {
- if (pos > cstart) {
- tokenHandler.characters(buf, cstart, pos - cstart);
- }
- cstart = Integer.MAX_VALUE;
- }
-
- /**
- * Reports an condition that would make the infoset incompatible with XML
- * 1.0 as fatal.
- *
- * @param message
- * the message
- * @throws SAXException
- * @throws SAXParseException
- */
- public void fatal(String message) throws SAXException {
- SAXParseException spe = new SAXParseException(message, this);
- if (errorHandler != null) {
- errorHandler.fatalError(spe);
- }
- throw spe;
- }
-
- /**
- * Reports a Parse Error.
- *
- * @param message
- * the message
- * @throws SAXException
- */
- public void err(String message) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- SAXParseException spe = new SAXParseException(message, this);
- errorHandler.error(spe);
- }
-
- public void errTreeBuilder(String message) throws SAXException {
- ErrorHandler eh = null;
- if (tokenHandler instanceof TreeBuilder<?>) {
- TreeBuilder<?> treeBuilder = (TreeBuilder<?>) tokenHandler;
- eh = treeBuilder.getErrorHandler();
- }
- if (eh == null) {
- eh = errorHandler;
- }
- if (eh == null) {
- return;
- }
- SAXParseException spe = new SAXParseException(message, this);
- eh.error(spe);
- }
-
- /**
- * Reports a warning
- *
- * @param message
- * the message
- * @throws SAXException
- */
- public void warn(String message) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- SAXParseException spe = new SAXParseException(message, this);
- errorHandler.warning(spe);
- }
-
- private void strBufToElementNameString() {
- tagName = ElementName.elementNameByBuffer(strBuf, 0, strBufLen,
- interner);
- clearStrBufAfterUse();
- }
-
- private int emitCurrentTagToken(boolean selfClosing, int pos)
- throws SAXException {
- cstart = pos + 1;
- maybeErrSlashInEndTag(selfClosing);
- stateSave = Tokenizer.DATA;
- HtmlAttributes attrs = (attributes == null ? HtmlAttributes.EMPTY_ATTRIBUTES
- : attributes);
- if (endTag) {
- /*
- * When an end tag token is emitted, the content model flag must be
- * switched to the PCDATA state.
- */
- maybeErrAttributesOnEndTag(attrs);
- // CPPONLY: if (!viewingXmlSource) {
- tokenHandler.endTag(tagName);
- // CPPONLY: }
- // CPPONLY: if (newAttributesEachTime) {
- // CPPONLY: Portability.delete(attributes);
- // CPPONLY: attributes = null;
- // CPPONLY: }
- } else {
- // CPPONLY: if (viewingXmlSource) {
- // CPPONLY: assert newAttributesEachTime;
- // CPPONLY: Portability.delete(attributes);
- // CPPONLY: attributes = null;
- // CPPONLY: } else {
- tokenHandler.startTag(tagName, attrs, selfClosing);
- // CPPONLY: }
- }
- tagName.release();
- tagName = null;
- if (newAttributesEachTime) {
- attributes = null;
- } else {
- attributes.clear(mappingLangToXmlLang);
- }
- /*
- * The token handler may have called setStateAndEndTagExpectation
- * and changed stateSave since the start of this method.
- */
- return stateSave;
- }
-
- private void attributeNameComplete() throws SAXException {
- attributeName = AttributeName.nameByBuffer(strBuf, 0, strBufLen
- // [NOCPP[
- , namePolicy != XmlViolationPolicy.ALLOW
- // ]NOCPP]
- , interner);
- clearStrBufAfterUse();
-
- if (attributes == null) {
- attributes = new HtmlAttributes(mappingLangToXmlLang);
- }
-
- /*
- * When the user agent leaves the attribute name state (and before
- * emitting the tag token, if appropriate), the complete attribute's
- * name must be compared to the other attributes on the same token; if
- * there is already an attribute on the token with the exact same name,
- * then this is a parse error and the new attribute must be dropped,
- * along with the value that gets associated with it (if any).
- */
- if (attributes.contains(attributeName)) {
- errDuplicateAttribute();
- attributeName.release();
- attributeName = null;
- }
- }
-
- private void addAttributeWithoutValue() throws SAXException {
- noteAttributeWithoutValue();
-
- // [NOCPP[
- if (metaBoundaryPassed && AttributeName.CHARSET == attributeName
- && ElementName.META == tagName) {
- err("A \u201Ccharset\u201D attribute on a \u201Cmeta\u201D element found after the first 512 bytes.");
- }
- // ]NOCPP]
- if (attributeName != null) {
- // [NOCPP[
- if (html4) {
- if (attributeName.isBoolean()) {
- if (html4ModeCompatibleWithXhtml1Schemata) {
- attributes.addAttribute(attributeName,
- attributeName.getLocal(AttributeName.HTML),
- xmlnsPolicy);
- } else {
- attributes.addAttribute(attributeName, "", xmlnsPolicy);
- }
- } else {
- if (AttributeName.BORDER != attributeName) {
- err("Attribute value omitted for a non-boolean attribute. (HTML4-only error.)");
- attributes.addAttribute(attributeName, "", xmlnsPolicy);
- }
- }
- } else {
- if (AttributeName.SRC == attributeName
- || AttributeName.HREF == attributeName) {
- warn("Attribute \u201C"
- + attributeName.getLocal(AttributeName.HTML)
- + "\u201D without an explicit value seen. The attribute may be dropped by IE7.");
- }
- // ]NOCPP]
- attributes.addAttribute(attributeName,
- Portability.newEmptyString()
- // [NOCPP[
- , xmlnsPolicy
- // ]NOCPP]
- // CPPONLY: , attributeLine
- );
- // [NOCPP[
- }
- // ]NOCPP]
- attributeName = null; // attributeName has been adopted by the
- // |attributes| object
- } else {
- clearStrBufAfterUse();
- }
- }
-
- private void addAttributeWithValue() throws SAXException {
- // [NOCPP[
- if (metaBoundaryPassed && ElementName.META == tagName
- && AttributeName.CHARSET == attributeName) {
- err("A \u201Ccharset\u201D attribute on a \u201Cmeta\u201D element found after the first 512 bytes.");
- }
- // ]NOCPP]
- if (attributeName != null) {
- String val = strBufToString(); // Ownership transferred to
- // HtmlAttributes
- // CPPONLY: if (mViewSource) {
- // CPPONLY: mViewSource.MaybeLinkifyAttributeValue(attributeName, val);
- // CPPONLY: }
- // [NOCPP[
- if (!endTag && html4 && html4ModeCompatibleWithXhtml1Schemata
- && attributeName.isCaseFolded()) {
- val = newAsciiLowerCaseStringFromString(val);
- }
- // ]NOCPP]
- attributes.addAttribute(attributeName, val
- // [NOCPP[
- , xmlnsPolicy
- // ]NOCPP]
- // CPPONLY: , attributeLine
- );
- attributeName = null; // attributeName has been adopted by the
- // |attributes| object
- } else {
- // We have a duplicate attribute. Explicitly discard its value.
- clearStrBufAfterUse();
- }
- }
-
- // [NOCPP[
-
- private static String newAsciiLowerCaseStringFromString(String str) {
- if (str == null) {
- return null;
- }
- char[] buf = new char[str.length()];
- for (int i = 0; i < str.length(); i++) {
- char c = str.charAt(i);
- if (c >= 'A' && c <= 'Z') {
- c += 0x20;
- }
- buf[i] = c;
- }
- return new String(buf);
- }
-
- protected void startErrorReporting() throws SAXException {
-
- }
-
- // ]NOCPP]
-
- public void start() throws SAXException {
- initializeWithoutStarting();
- tokenHandler.startTokenization(this);
- // [NOCPP[
- startErrorReporting();
- // ]NOCPP]
- }
-
- public boolean tokenizeBuffer(UTF16Buffer buffer) throws SAXException {
- int state = stateSave;
- int returnState = returnStateSave;
- char c = '\u0000';
- shouldSuspend = false;
- lastCR = false;
-
- int start = buffer.getStart();
- int end = buffer.getEnd();
-
- // In C++, the caller of tokenizeBuffer needs to do this explicitly.
- // [NOCPP[
- ensureBufferSpace(end - start);
- // ]NOCPP]
-
- /**
- * The index of the last <code>char</code> read from <code>buf</code>.
- */
- int pos = start - 1;
-
- /**
- * The index of the first <code>char</code> in <code>buf</code> that is
- * part of a coalesced run of character tokens or
- * <code>Integer.MAX_VALUE</code> if there is not a current run being
- * coalesced.
- */
- switch (state) {
- case DATA:
- case RCDATA:
- case SCRIPT_DATA:
- case PLAINTEXT:
- case RAWTEXT:
- case CDATA_SECTION:
- case SCRIPT_DATA_ESCAPED:
- case SCRIPT_DATA_ESCAPE_START:
- case SCRIPT_DATA_ESCAPE_START_DASH:
- case SCRIPT_DATA_ESCAPED_DASH:
- case SCRIPT_DATA_ESCAPED_DASH_DASH:
- case SCRIPT_DATA_DOUBLE_ESCAPE_START:
- case SCRIPT_DATA_DOUBLE_ESCAPED:
- case SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
- case SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
- case SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
- case SCRIPT_DATA_DOUBLE_ESCAPE_END:
- cstart = start;
- break;
- default:
- cstart = Integer.MAX_VALUE;
- break;
- }
-
- /**
- * The number of <code>char</code>s in <code>buf</code> that have
- * meaning. (The rest of the array is garbage and should not be
- * examined.)
- */
- // CPPONLY: if (mViewSource) {
- // CPPONLY: mViewSource.SetBuffer(buffer);
- // CPPONLY: pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState, buffer.getEnd());
- // CPPONLY: mViewSource.DropBuffer((pos == buffer.getEnd()) ? pos : pos + 1);
- // CPPONLY: } else {
- // CPPONLY: pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState, buffer.getEnd());
- // CPPONLY: }
- // [NOCPP[
- pos = stateLoop(state, c, pos, buffer.getBuffer(), false, returnState,
- end);
- // ]NOCPP]
- if (pos == end) {
- // exiting due to end of buffer
- buffer.setStart(pos);
- } else {
- buffer.setStart(pos + 1);
- }
- return lastCR;
- }
-
- // [NOCPP[
- private void ensureBufferSpace(int inputLength) throws SAXException {
- // Add 2 to account for emissions of LT_GT, LT_SOLIDUS and RSQB_RSQB.
- // Adding to the general worst case instead of only the
- // TreeBuilder-exposed worst case to avoid re-introducing a bug when
- // unifying the tokenizer and tree builder buffers in the future.
- int worstCase = strBufLen + inputLength + charRefBufLen + 2;
- tokenHandler.ensureBufferSpace(worstCase);
- if (commentPolicy == XmlViolationPolicy.ALTER_INFOSET) {
- // When altering infoset, if the comment contents are consecutive
- // hyphens, each hyphen generates a space, too. These buffer
- // contents never get emitted as characters() to the tokenHandler,
- // which is why this calculation happens after the call to
- // ensureBufferSpace on tokenHandler.
- worstCase *= 2;
- }
- if (strBuf == null) {
- // Add an arbitrary small value to avoid immediate reallocation
- // once there are a few characters in the buffer.
- strBuf = new char[worstCase + 128];
- } else if (worstCase > strBuf.length) {
- // HotSpot reportedly allocates memory with 8-byte accuracy, so
- // there's no point in trying to do math here to avoid slop.
- // Maybe we should add some small constant to worstCase here
- // but not doing that without profiling. In C++ with jemalloc,
- // the corresponding method should do math to round up here
- // to avoid slop.
- char[] newBuf = new char[worstCase];
- System.arraycopy(strBuf, 0, newBuf, 0, strBufLen);
- strBuf = newBuf;
- }
- }
- // ]NOCPP]
-
- @SuppressWarnings("unused") private int stateLoop(int state, char c,
- int pos, @NoLength char[] buf, boolean reconsume, int returnState,
- int endPos) throws SAXException {
- /*
- * Idioms used in this code:
- *
- *
- * Consuming the next input character
- *
- * To consume the next input character, the code does this: if (++pos ==
- * endPos) { break stateloop; } c = checkChar(buf, pos);
- *
- *
- * Staying in a state
- *
- * When there's a state that the tokenizer may stay in over multiple
- * input characters, the state has a wrapper |for(;;)| loop and staying
- * in the state continues the loop.
- *
- *
- * Switching to another state
- *
- * To switch to another state, the code sets the state variable to the
- * magic number of the new state. Then it either continues stateloop or
- * breaks out of the state's own wrapper loop if the target state is
- * right after the current state in source order. (This is a partial
- * workaround for Java's lack of goto.)
- *
- *
- * Reconsume support
- *
- * The spec sometimes says that an input character is reconsumed in
- * another state. If a state can ever be entered so that an input
- * character can be reconsumed in it, the state's code starts with an
- * |if (reconsume)| that sets reconsume to false and skips over the
- * normal code for consuming a new character.
- *
- * To reconsume the current character in another state, the code sets
- * |reconsume| to true and then switches to the other state.
- *
- *
- * Emitting character tokens
- *
- * This method emits character tokens lazily. Whenever a new range of
- * character tokens starts, the field cstart must be set to the start
- * index of the range. The flushChars() method must be called at the end
- * of a range to flush it.
- *
- *
- * U+0000 handling
- *
- * The various states have to handle the replacement of U+0000 with
- * U+FFFD. However, if U+0000 would be reconsumed in another state, the
- * replacement doesn't need to happen, because it's handled by the
- * reconsuming state.
- *
- *
- * LF handling
- *
- * Every state needs to increment the line number upon LF unless the LF
- * gets reconsumed by another state which increments the line number.
- *
- *
- * CR handling
- *
- * Every state needs to handle CR unless the CR gets reconsumed and is
- * handled by the reconsuming state. The CR needs to be handled as if it
- * were and LF, the lastCR field must be set to true and then this
- * method must return. The IO driver will then swallow the next
- * character if it is an LF to coalesce CRLF.
- */
- stateloop: for (;;) {
- switch (state) {
- case DATA:
- dataloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the character
- * reference in data state.
- */
- flushChars(buf, pos);
- assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
- appendCharRefBuf(c);
- setAdditionalAndRememberAmpersandLocation('\u0000');
- returnState = state;
- state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
- continue stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the tag
- * open state.
- */
- flushChars(buf, pos);
-
- state = transition(state, Tokenizer.TAG_OPEN, reconsume, pos);
- break dataloop; // FALL THROUGH continue
- // stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the input character as a
- * character token.
- *
- * Stay in the data state.
- */
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case TAG_OPEN:
- tagopenloop: for (;;) {
- /*
- * The behavior of this state depends on the content
- * model flag.
- */
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * If the content model flag is set to the PCDATA state
- * Consume the next input character:
- */
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to U+005A
- * LATIN CAPITAL LETTER Z Create a new start tag
- * token,
- */
- endTag = false;
- /*
- * set its tag name to the lowercase version of the
- * input character (add 0x0020 to the character's
- * code point),
- */
- clearStrBufBeforeUse();
- appendStrBuf((char) (c + 0x20));
- /* then switch to the tag name state. */
- state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
- /*
- * (Don't emit the token yet; further details will
- * be filled in before it is emitted.)
- */
- break tagopenloop;
- // continue stateloop;
- } else if (c >= 'a' && c <= 'z') {
- /*
- * U+0061 LATIN SMALL LETTER A through to U+007A
- * LATIN SMALL LETTER Z Create a new start tag
- * token,
- */
- endTag = false;
- /*
- * set its tag name to the input character,
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /* then switch to the tag name state. */
- state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
- /*
- * (Don't emit the token yet; further details will
- * be filled in before it is emitted.)
- */
- break tagopenloop;
- // continue stateloop;
- }
- switch (c) {
- case '!':
- /*
- * U+0021 EXCLAMATION MARK (!) Switch to the
- * markup declaration open state.
- */
- state = transition(state, Tokenizer.MARKUP_DECLARATION_OPEN, reconsume, pos);
- continue stateloop;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the close tag
- * open state.
- */
- state = transition(state, Tokenizer.CLOSE_TAG_OPEN, reconsume, pos);
- continue stateloop;
- case '?':
- // CPPONLY: if (viewingXmlSource) {
- // CPPONLY: state = transition(state,
- // CPPONLY: Tokenizer.PROCESSING_INSTRUCTION,
- // CPPONLY: reconsume,
- // CPPONLY: pos);
- // CPPONLY: continue stateloop;
- // CPPONLY: }
- /*
- * U+003F QUESTION MARK (?) Parse error.
- */
- errProcessingInstruction();
- /*
- * Switch to the bogus comment state.
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errLtGt();
- /*
- * Emit a U+003C LESS-THAN SIGN character token
- * and a U+003E GREATER-THAN SIGN character
- * token.
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 2);
- /* Switch to the data state. */
- cstart = pos + 1;
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- /*
- * Anything else Parse error.
- */
- errBadCharAfterLt(c);
- /*
- * Emit a U+003C LESS-THAN SIGN character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in
- * the data state.
- */
- cstart = pos;
- reconsume = true;
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- }
- }
- // FALL THROUGH DON'T REORDER
- case TAG_NAME:
- tagnameloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- strBufToElementNameString();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before attribute name state.
- */
- strBufToElementNameString();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- break tagnameloop;
- // continue stateloop;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the self-closing
- * start tag state.
- */
- strBufToElementNameString();
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- strBufToElementNameString();
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Append the
- * lowercase version of the current input
- * character (add 0x0020 to the character's
- * code point) to the current tag token's
- * tag name.
- */
- c += 0x20;
- }
- /*
- * Anything else Append the current input
- * character to the current tag token's tag
- * name.
- */
- appendStrBuf(c);
- /*
- * Stay in the tag name state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_ATTRIBUTE_NAME:
- beforeattributenameloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the before attribute name state.
- */
- continue;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the self-closing
- * start tag state.
- */
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- case '\"':
- case '\'':
- case '<':
- case '=':
- /*
- * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
- * (') U+003C LESS-THAN SIGN (<) U+003D EQUALS
- * SIGN (=) Parse error.
- */
- errBadCharBeforeAttributeNameOrNull(c);
- /*
- * Treat it as per the "anything else" entry
- * below.
- */
- default:
- /*
- * Anything else Start a new attribute in the
- * current tag token.
- */
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Set that
- * attribute's name to the lowercase version
- * of the current input character (add
- * 0x0020 to the character's code point)
- */
- c += 0x20;
- }
- // CPPONLY: attributeLine = line;
- /*
- * Set that attribute's name to the current
- * input character,
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /*
- * and its value to the empty string.
- */
- // Will do later.
- /*
- * Switch to the attribute name state.
- */
- state = transition(state, Tokenizer.ATTRIBUTE_NAME, reconsume, pos);
- break beforeattributenameloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case ATTRIBUTE_NAME:
- attributenameloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- attributeNameComplete();
- state = transition(state, Tokenizer.AFTER_ATTRIBUTE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the after attribute name state.
- */
- attributeNameComplete();
- state = transition(state, Tokenizer.AFTER_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the self-closing
- * start tag state.
- */
- attributeNameComplete();
- addAttributeWithoutValue();
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- continue stateloop;
- case '=':
- /*
- * U+003D EQUALS SIGN (=) Switch to the before
- * attribute value state.
- */
- attributeNameComplete();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_VALUE, reconsume, pos);
- break attributenameloop;
- // continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- attributeNameComplete();
- addAttributeWithoutValue();
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- case '\"':
- case '\'':
- case '<':
- /*
- * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
- * (') U+003C LESS-THAN SIGN (<) Parse error.
- */
- errQuoteOrLtInAttributeNameOrNull(c);
- /*
- * Treat it as per the "anything else" entry
- * below.
- */
- default:
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Append the
- * lowercase version of the current input
- * character (add 0x0020 to the character's
- * code point) to the current attribute's
- * name.
- */
- c += 0x20;
- }
- /*
- * Anything else Append the current input
- * character to the current attribute's name.
- */
- appendStrBuf(c);
- /*
- * Stay in the attribute name state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_ATTRIBUTE_VALUE:
- beforeattributevalueloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the before attribute value state.
- */
- continue;
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Switch to the
- * attribute value (double-quoted) state.
- */
- // CPPONLY: attributeLine = line;
- clearStrBufBeforeUse();
- state = transition(state, Tokenizer.ATTRIBUTE_VALUE_DOUBLE_QUOTED, reconsume, pos);
- break beforeattributevalueloop;
- // continue stateloop;
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the attribute
- * value (unquoted) state and reconsume this
- * input character.
- */
- // CPPONLY: attributeLine = line;
- clearStrBufBeforeUse();
- reconsume = true;
- state = transition(state, Tokenizer.ATTRIBUTE_VALUE_UNQUOTED, reconsume, pos);
- noteUnquotedAttributeValue();
- continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Switch to the attribute
- * value (single-quoted) state.
- */
- // CPPONLY: attributeLine = line;
- clearStrBufBeforeUse();
- state = transition(state, Tokenizer.ATTRIBUTE_VALUE_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errAttributeValueMissing();
- /*
- * Emit the current tag token.
- */
- addAttributeWithoutValue();
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- case '<':
- case '=':
- case '`':
- /*
- * U+003C LESS-THAN SIGN (<) U+003D EQUALS SIGN
- * (=) U+0060 GRAVE ACCENT (`)
- */
- errLtOrEqualsOrGraveInUnquotedAttributeOrNull(c);
- /*
- * Treat it as per the "anything else" entry
- * below.
- */
- default:
- // [NOCPP[
- errHtml4NonNameInUnquotedAttribute(c);
- // ]NOCPP]
- /*
- * Anything else Append the current input
- * character to the current attribute's value.
- */
- // CPPONLY: attributeLine = line;
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /*
- * Switch to the attribute value (unquoted)
- * state.
- */
-
- state = transition(state, Tokenizer.ATTRIBUTE_VALUE_UNQUOTED, reconsume, pos);
- noteUnquotedAttributeValue();
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
- attributevaluedoublequotedloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Switch to the after
- * attribute value (quoted) state.
- */
- addAttributeWithValue();
-
- state = transition(state, Tokenizer.AFTER_ATTRIBUTE_VALUE_QUOTED, reconsume, pos);
- break attributevaluedoublequotedloop;
- // continue stateloop;
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the character
- * reference in attribute value state, with the
- * additional allowed character being U+0022
- * QUOTATION MARK (").
- */
- assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
- appendCharRefBuf(c);
- setAdditionalAndRememberAmpersandLocation('\"');
- returnState = state;
- state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current attribute's value.
- */
- appendStrBuf(c);
- /*
- * Stay in the attribute value (double-quoted)
- * state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_ATTRIBUTE_VALUE_QUOTED:
- afterattributevaluequotedloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before attribute name state.
- */
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the self-closing
- * start tag state.
- */
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- break afterattributevaluequotedloop;
- // continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- default:
- /*
- * Anything else Parse error.
- */
- errNoSpaceBetweenAttributes();
- /*
- * Reconsume the character in the before
- * attribute name state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case SELF_CLOSING_START_TAG:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Set the self-closing
- * flag of the current tag token. Emit the current
- * tag token.
- */
- // [NOCPP[
- errHtml4XmlVoidSyntax();
- // ]NOCPP]
- state = transition(state, emitCurrentTagToken(true, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- default:
- /* Anything else Parse error. */
- errSlashNotFollowedByGt();
- /*
- * Reconsume the character in the before attribute
- * name state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- }
- // XXX reorder point
- case ATTRIBUTE_VALUE_UNQUOTED:
- for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- addAttributeWithValue();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before attribute name state.
- */
- addAttributeWithValue();
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the character
- * reference in attribute value state, with the
- * additional allowed character being U+003E
- * GREATER-THAN SIGN (>)
- */
- assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
- appendCharRefBuf(c);
- setAdditionalAndRememberAmpersandLocation('>');
- returnState = state;
- state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- addAttributeWithValue();
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- case '<':
- case '\"':
- case '\'':
- case '=':
- case '`':
- /*
- * U+0022 QUOTATION MARK (") U+0027 APOSTROPHE
- * (') U+003C LESS-THAN SIGN (<) U+003D EQUALS
- * SIGN (=) U+0060 GRAVE ACCENT (`) Parse error.
- */
- errUnquotedAttributeValOrNull(c);
- /*
- * Treat it as per the "anything else" entry
- * below.
- */
- // fall through
- default:
- // [NOCPP]
- errHtml4NonNameInUnquotedAttribute(c);
- // ]NOCPP]
- /*
- * Anything else Append the current input
- * character to the current attribute's value.
- */
- appendStrBuf(c);
- /*
- * Stay in the attribute value (unquoted) state.
- */
- continue;
- }
- }
- // XXX reorder point
- case AFTER_ATTRIBUTE_NAME:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the after attribute name state.
- */
- continue;
- case '/':
- /*
- * U+002F SOLIDUS (/) Switch to the self-closing
- * start tag state.
- */
- addAttributeWithoutValue();
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- continue stateloop;
- case '=':
- /*
- * U+003D EQUALS SIGN (=) Switch to the before
- * attribute value state.
- */
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_VALUE, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * tag token.
- */
- addAttributeWithoutValue();
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- /*
- * Switch to the data state.
- */
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- case '\"':
- case '\'':
- case '<':
- errQuoteOrLtInAttributeNameOrNull(c);
- /*
- * Treat it as per the "anything else" entry
- * below.
- */
- default:
- addAttributeWithoutValue();
- /*
- * Anything else Start a new attribute in the
- * current tag token.
- */
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Set that
- * attribute's name to the lowercase version
- * of the current input character (add
- * 0x0020 to the character's code point)
- */
- c += 0x20;
- }
- /*
- * Set that attribute's name to the current
- * input character,
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /*
- * and its value to the empty string.
- */
- // Will do later.
- /*
- * Switch to the attribute name state.
- */
- state = transition(state, Tokenizer.ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case MARKUP_DECLARATION_OPEN:
- markupdeclarationopenloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * If the next two characters are both U+002D
- * HYPHEN-MINUS characters (-), consume those two
- * characters, create a comment token whose data is the
- * empty string, and switch to the comment start state.
- *
- * Otherwise, if the next seven characters are an ASCII
- * case-insensitive match for the word "DOCTYPE", then
- * consume those characters and switch to the DOCTYPE
- * state.
- *
- * Otherwise, if the insertion mode is
- * "in foreign content" and the current node is not an
- * element in the HTML namespace and the next seven
- * characters are an case-sensitive match for the string
- * "[CDATA[" (the five uppercase letters "CDATA" with a
- * U+005B LEFT SQUARE BRACKET character before and
- * after), then consume those characters and switch to
- * the CDATA section state.
- *
- * Otherwise, is is a parse error. Switch to the bogus
- * comment state. The next character that is consumed,
- * if any, is the first character that will be in the
- * comment.
- */
- switch (c) {
- case '-':
- clearStrBufBeforeUse();
- appendStrBuf(c);
- state = transition(state, Tokenizer.MARKUP_DECLARATION_HYPHEN, reconsume, pos);
- break markupdeclarationopenloop;
- // continue stateloop;
- case 'd':
- case 'D':
- clearStrBufBeforeUse();
- appendStrBuf(c);
- index = 0;
- state = transition(state, Tokenizer.MARKUP_DECLARATION_OCTYPE, reconsume, pos);
- continue stateloop;
- case '[':
- if (tokenHandler.cdataSectionAllowed()) {
- clearStrBufBeforeUse();
- appendStrBuf(c);
- index = 0;
- state = transition(state, Tokenizer.CDATA_START, reconsume, pos);
- continue stateloop;
- }
- // else fall through
- default:
- errBogusComment();
- clearStrBufBeforeUse();
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case MARKUP_DECLARATION_HYPHEN:
- markupdeclarationhyphenloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '\u0000':
- break stateloop;
- case '-':
- clearStrBufAfterOneHyphen();
- state = transition(state, Tokenizer.COMMENT_START, reconsume, pos);
- break markupdeclarationhyphenloop;
- // continue stateloop;
- default:
- errBogusComment();
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_START:
- commentstartloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment start state
- *
- *
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Switch to the comment
- * start dash state.
- */
- appendStrBuf(c);
- state = transition(state, Tokenizer.COMMENT_START_DASH, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errPrematureEndOfComment();
- /* Emit the comment token. */
- emitComment(0, pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break commentstartloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the input character to
- * the comment token's data.
- */
- appendStrBuf(c);
- /*
- * Switch to the comment state.
- */
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break commentstartloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT:
- commentloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment state Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Switch to the comment
- * end dash state
- */
- appendStrBuf(c);
- state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
- break commentloop;
- // continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the input character to
- * the comment token's data.
- */
- appendStrBuf(c);
- /*
- * Stay in the comment state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_END_DASH:
- commentenddashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment end dash state Consume the next input
- * character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Switch to the comment
- * end state
- */
- appendStrBuf(c);
- state = transition(state, Tokenizer.COMMENT_END, reconsume, pos);
- break commentenddashloop;
- // continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append a U+002D HYPHEN-MINUS
- * (-) character and the input character to the
- * comment token's data.
- */
- appendStrBuf(c);
- /*
- * Switch to the comment state.
- */
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case COMMENT_END:
- commentendloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment end dash state Consume the next input
- * character:
- */
- switch (c) {
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the comment
- * token.
- */
- emitComment(2, pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '-':
- /* U+002D HYPHEN-MINUS (-) Parse error. */
- /*
- * Append a U+002D HYPHEN-MINUS (-) character to
- * the comment token's data.
- */
- adjustDoubleHyphenAndAppendToStrBufAndErr(c);
- /*
- * Stay in the comment end state.
- */
- continue;
- case '\r':
- adjustDoubleHyphenAndAppendToStrBufCarriageReturn();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- adjustDoubleHyphenAndAppendToStrBufLineFeed();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- case '!':
- errHyphenHyphenBang();
- appendStrBuf(c);
- state = transition(state, Tokenizer.COMMENT_END_BANG, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Append two U+002D HYPHEN-MINUS (-) characters
- * and the input character to the comment
- * token's data.
- */
- adjustDoubleHyphenAndAppendToStrBufAndErr(c);
- /*
- * Switch to the comment state.
- */
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case COMMENT_END_BANG:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment end bang state
- *
- * Consume the next input character:
- */
- switch (c) {
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the comment
- * token.
- */
- emitComment(3, pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '-':
- /*
- * Append two U+002D HYPHEN-MINUS (-) characters
- * and a U+0021 EXCLAMATION MARK (!) character
- * to the comment token's data.
- */
- appendStrBuf(c);
- /*
- * Switch to the comment end dash state.
- */
- state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append two U+002D HYPHEN-MINUS
- * (-) characters, a U+0021 EXCLAMATION MARK (!)
- * character, and the input character to the
- * comment token's data. Switch to the comment
- * state.
- */
- appendStrBuf(c);
- /*
- * Switch to the comment state.
- */
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case COMMENT_START_DASH:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Comment start dash state
- *
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Switch to the comment end
- * state
- */
- appendStrBuf(c);
- state = transition(state, Tokenizer.COMMENT_END, reconsume, pos);
- continue stateloop;
- case '>':
- errPrematureEndOfComment();
- /* Emit the comment token. */
- emitComment(1, pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Append a U+002D HYPHEN-MINUS character (-) and
- * the current input character to the comment
- * token's data.
- */
- appendStrBuf(c);
- /*
- * Switch to the comment state.
- */
- state = transition(state, Tokenizer.COMMENT, reconsume, pos);
- continue stateloop;
- }
- // XXX reorder point
- case CDATA_START:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (index < 6) { // CDATA_LSQB.length
- if (c == Tokenizer.CDATA_LSQB[index]) {
- appendStrBuf(c);
- } else {
- errBogusComment();
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue;
- } else {
- clearStrBufAfterUse();
- cstart = pos; // start coalescing
- reconsume = true;
- state = transition(state, Tokenizer.CDATA_SECTION, reconsume, pos);
- break; // FALL THROUGH continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case CDATA_SECTION:
- cdatasectionloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case ']':
- flushChars(buf, pos);
- state = transition(state, Tokenizer.CDATA_RSQB, reconsume, pos);
- break cdatasectionloop; // FALL THROUGH
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- default:
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case CDATA_RSQB:
- cdatarsqb: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case ']':
- state = transition(state, Tokenizer.CDATA_RSQB_RSQB, reconsume, pos);
- break cdatarsqb;
- default:
- tokenHandler.characters(Tokenizer.RSQB_RSQB, 0,
- 1);
- cstart = pos;
- reconsume = true;
- state = transition(state, Tokenizer.CDATA_SECTION, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case CDATA_RSQB_RSQB:
- cdatarsqbrsqb: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case ']':
- // Saw a third ]. Emit one ] (logically the
- // first one) and stay in this state to
- // remember that the last two characters seen
- // have been ]].
- tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
- continue;
- case '>':
- cstart = pos + 1;
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 2);
- cstart = pos;
- reconsume = true;
- state = transition(state, Tokenizer.CDATA_SECTION, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case ATTRIBUTE_VALUE_SINGLE_QUOTED:
- attributevaluesinglequotedloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Switch to the after
- * attribute value (quoted) state.
- */
- addAttributeWithValue();
-
- state = transition(state, Tokenizer.AFTER_ATTRIBUTE_VALUE_QUOTED, reconsume, pos);
- continue stateloop;
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the character
- * reference in attribute value state, with the
- * + additional allowed character being U+0027
- * APOSTROPHE (').
- */
- assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
- appendCharRefBuf(c);
- setAdditionalAndRememberAmpersandLocation('\'');
- returnState = state;
- state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
- break attributevaluesinglequotedloop;
- // continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current attribute's value.
- */
- appendStrBuf(c);
- /*
- * Stay in the attribute value (double-quoted)
- * state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case CONSUME_CHARACTER_REFERENCE:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (c == '\u0000') {
- break stateloop;
- }
- /*
- * Unlike the definition is the spec, this state does not
- * return a value and never requires the caller to
- * backtrack. This state takes care of emitting characters
- * or appending to the current attribute value. It also
- * takes care of that in the case when consuming the
- * character reference fails.
- */
- /*
- * This section defines how to consume a character
- * reference. This definition is used when parsing character
- * references in text and in attributes.
- *
- * The behavior depends on the identity of the next
- * character (the one immediately after the U+0026 AMPERSAND
- * character):
- */
- switch (c) {
- case ' ':
- case '\t':
- case '\n':
- case '\r': // we'll reconsume!
- case '\u000C':
- case '<':
- case '&':
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- case '#':
- /*
- * U+0023 NUMBER SIGN (#) Consume the U+0023 NUMBER
- * SIGN.
- */
- appendCharRefBuf('#');
- state = transition(state, Tokenizer.CONSUME_NCR, reconsume, pos);
- continue stateloop;
- default:
- if (c == additional) {
- emitOrAppendCharRefBuf(returnState);
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- if (c >= 'a' && c <= 'z') {
- firstCharKey = c - 'a' + 26;
- } else if (c >= 'A' && c <= 'Z') {
- firstCharKey = c - 'A';
- } else {
- // No match
- /*
- * If no match can be made, then this is a parse
- * error.
- */
- errNoNamedCharacterMatch();
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- // Didn't fail yet
- appendCharRefBuf(c);
- state = transition(state, Tokenizer.CHARACTER_REFERENCE_HILO_LOOKUP, reconsume, pos);
- // FALL THROUGH continue stateloop;
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case CHARACTER_REFERENCE_HILO_LOOKUP:
- {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (c == '\u0000') {
- break stateloop;
- }
- /*
- * The data structure is as follows:
- *
- * HILO_ACCEL is a two-dimensional int array whose major
- * index corresponds to the second character of the
- * character reference (code point as index) and the
- * minor index corresponds to the first character of the
- * character reference (packed so that A-Z runs from 0
- * to 25 and a-z runs from 26 to 51). This layout makes
- * it easier to use the sparseness of the data structure
- * to omit parts of it: The second dimension of the
- * table is null when no character reference starts with
- * the character corresponding to that row.
- *
- * The int value HILO_ACCEL (by these indeces) is zero
- * if there exists no character reference starting with
- * that two-letter prefix. Otherwise, the value is an
- * int that packs two shorts so that the higher short is
- * the index of the highest character reference name
- * with that prefix in NAMES and the lower short
- * corresponds to the index of the lowest character
- * reference name with that prefix. (It happens that the
- * first two character reference names share their
- * prefix so the packed int cannot be 0 by packing the
- * two shorts.)
- *
- * NAMES is an array of byte arrays where each byte
- * array encodes the name of a character references as
- * ASCII. The names omit the first two letters of the
- * name. (Since storing the first two letters would be
- * redundant with the data contained in HILO_ACCEL.) The
- * entries are lexically sorted.
- *
- * For a given index in NAMES, the same index in VALUES
- * contains the corresponding expansion as an array of
- * two UTF-16 code units (either the character and
- * U+0000 or a suggogate pair).
- */
- int hilo = 0;
- if (c <= 'z') {
- @Const @NoLength int[] row = NamedCharactersAccel.HILO_ACCEL[c];
- if (row != null) {
- hilo = row[firstCharKey];
- }
- }
- if (hilo == 0) {
- /*
- * If no match can be made, then this is a parse
- * error.
- */
- errNoNamedCharacterMatch();
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- // Didn't fail yet
- appendCharRefBuf(c);
- lo = hilo & 0xFFFF;
- hi = hilo >> 16;
- entCol = -1;
- candidate = -1;
- charRefBufMark = 0;
- state = transition(state, Tokenizer.CHARACTER_REFERENCE_TAIL, reconsume, pos);
- // FALL THROUGH continue stateloop;
- }
- case CHARACTER_REFERENCE_TAIL:
- outer: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (c == '\u0000') {
- break stateloop;
- }
- entCol++;
- /*
- * Consume the maximum number of characters possible,
- * with the consumed characters matching one of the
- * identifiers in the first column of the named
- * character references table (in a case-sensitive
- * manner).
- */
- loloop: for (;;) {
- if (hi < lo) {
- break outer;
- }
- if (entCol == NamedCharacters.NAMES[lo].length()) {
- candidate = lo;
- charRefBufMark = charRefBufLen;
- lo++;
- } else if (entCol > NamedCharacters.NAMES[lo].length()) {
- break outer;
- } else if (c > NamedCharacters.NAMES[lo].charAt(entCol)) {
- lo++;
- } else {
- break loloop;
- }
- }
-
- hiloop: for (;;) {
- if (hi < lo) {
- break outer;
- }
- if (entCol == NamedCharacters.NAMES[hi].length()) {
- break hiloop;
- }
- if (entCol > NamedCharacters.NAMES[hi].length()) {
- break outer;
- } else if (c < NamedCharacters.NAMES[hi].charAt(entCol)) {
- hi--;
- } else {
- break hiloop;
- }
- }
-
- if (c == ';') {
- // If we see a semicolon, there cannot be a
- // longer match. Break the loop. However, before
- // breaking, take the longest match so far as the
- // candidate, if we are just about to complete a
- // match.
- if (entCol + 1 == NamedCharacters.NAMES[lo].length()) {
- candidate = lo;
- charRefBufMark = charRefBufLen;
- }
- break outer;
- }
-
- if (hi < lo) {
- break outer;
- }
- appendCharRefBuf(c);
- continue;
- }
-
- if (candidate == -1) {
- // reconsume deals with CR, LF or nul
- /*
- * If no match can be made, then this is a parse error.
- */
- errNoNamedCharacterMatch();
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- } else {
- // c can't be CR, LF or nul if we got here
- @Const @CharacterName String candidateName = NamedCharacters.NAMES[candidate];
- if (candidateName.length() == 0
- || candidateName.charAt(candidateName.length() - 1) != ';') {
- /*
- * If the last character matched is not a U+003B
- * SEMICOLON (;), there is a parse error.
- */
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- /*
- * If the entity is being consumed as part of an
- * attribute, and the last character matched is
- * not a U+003B SEMICOLON (;),
- */
- char ch;
- if (charRefBufMark == charRefBufLen) {
- ch = c;
- } else {
- ch = charRefBuf[charRefBufMark];
- }
- if (ch == '=' || (ch >= '0' && ch <= '9')
- || (ch >= 'A' && ch <= 'Z')
- || (ch >= 'a' && ch <= 'z')) {
- /*
- * and the next character is either a U+003D
- * EQUALS SIGN character (=) or in the range
- * U+0030 DIGIT ZERO to U+0039 DIGIT NINE,
- * U+0041 LATIN CAPITAL LETTER A to U+005A
- * LATIN CAPITAL LETTER Z, or U+0061 LATIN
- * SMALL LETTER A to U+007A LATIN SMALL
- * LETTER Z, then, for historical reasons,
- * all the characters that were matched
- * after the U+0026 AMPERSAND (&) must be
- * unconsumed, and nothing is returned.
- */
- errNoNamedCharacterMatch();
- appendCharRefBufToStrBuf();
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- }
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- errUnescapedAmpersandInterpretedAsCharacterReference();
- } else {
- errNotSemicolonTerminated();
- }
- }
-
- /*
- * Otherwise, return a character token for the character
- * corresponding to the entity name (as given by the
- * second column of the named character references
- * table).
- */
- // CPPONLY: completedNamedCharacterReference();
- @Const @NoLength char[] val = NamedCharacters.VALUES[candidate];
- if (
- // [NOCPP[
- val.length == 1
- // ]NOCPP]
- // CPPONLY: val[1] == 0
- ) {
- emitOrAppendOne(val, returnState);
- } else {
- emitOrAppendTwo(val, returnState);
- }
- // this is so complicated!
- if (charRefBufMark < charRefBufLen) {
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- appendStrBuf(charRefBuf, charRefBufMark,
- charRefBufLen - charRefBufMark);
- } else {
- tokenHandler.characters(charRefBuf, charRefBufMark,
- charRefBufLen - charRefBufMark);
- }
- }
- // charRefBufLen will be zeroed below!
-
- // Check if we broke out early with c being the last
- // character that matched as opposed to being the
- // first one that didn't match. In the case of an
- // early break, the next run on text should start
- // *after* the current character and the current
- // character shouldn't be reconsumed.
- boolean earlyBreak = (c == ';' && charRefBufMark == charRefBufLen);
- charRefBufLen = 0;
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = earlyBreak ? pos + 1 : pos;
- }
- reconsume = !earlyBreak;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- /*
- * If the markup contains I'm &notit; I tell you, the
- * entity is parsed as "not", as in, I'm ¬it; I tell
- * you. But if the markup was I'm &notin; I tell you,
- * the entity would be parsed as "notin;", resulting in
- * I'm ∉ I tell you.
- */
- }
- // XXX reorder point
- case CONSUME_NCR:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- value = 0;
- seenDigits = false;
- /*
- * The behavior further depends on the character after the
- * U+0023 NUMBER SIGN:
- */
- switch (c) {
- case 'x':
- case 'X':
-
- /*
- * U+0078 LATIN SMALL LETTER X U+0058 LATIN CAPITAL
- * LETTER X Consume the X.
- *
- * Follow the steps below, but using the range of
- * characters U+0030 DIGIT ZERO through to U+0039
- * DIGIT NINE, U+0061 LATIN SMALL LETTER A through
- * to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
- * CAPITAL LETTER A, through to U+0046 LATIN CAPITAL
- * LETTER F (in other words, 0-9, A-F, a-f).
- *
- * When it comes to interpreting the number,
- * interpret it as a hexadecimal number.
- */
- appendCharRefBuf(c);
- state = transition(state, Tokenizer.HEX_NCR_LOOP, reconsume, pos);
- continue stateloop;
- default:
- /*
- * Anything else Follow the steps below, but using
- * the range of characters U+0030 DIGIT ZERO through
- * to U+0039 DIGIT NINE (i.e. just 0-9).
- *
- * When it comes to interpreting the number,
- * interpret it as a decimal number.
- */
- reconsume = true;
- state = transition(state, Tokenizer.DECIMAL_NRC_LOOP, reconsume, pos);
- // FALL THROUGH continue stateloop;
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case DECIMAL_NRC_LOOP:
- decimalloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume as many characters as match the range of
- * characters given above.
- */
- assert value >= 0: "value must not become negative.";
- if (c >= '0' && c <= '9') {
- seenDigits = true;
- // Avoid overflow
- if (value <= 0x10FFFF) {
- value *= 10;
- value += c - '0';
- }
- continue;
- } else if (c == ';') {
- if (seenDigits) {
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos + 1;
- }
- state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
- // FALL THROUGH continue stateloop;
- break decimalloop;
- } else {
- errNoDigitsInNCR();
- appendCharRefBuf(';');
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos + 1;
- }
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- } else {
- /*
- * If no characters match the range, then don't
- * consume any characters (and unconsume the U+0023
- * NUMBER SIGN character and, if appropriate, the X
- * character). This is a parse error; nothing is
- * returned.
- *
- * Otherwise, if the next character is a U+003B
- * SEMICOLON, consume that too. If it isn't, there
- * is a parse error.
- */
- if (!seenDigits) {
- errNoDigitsInNCR();
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- } else {
- errCharRefLacksSemicolon();
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
- // FALL THROUGH continue stateloop;
- break decimalloop;
- }
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case HANDLE_NCR_VALUE:
- // WARNING previous state sets reconsume
- // We are not going to emit the contents of charRefBuf.
- charRefBufLen = 0;
- // XXX inline this case if the method size can take it
- handleNcrValue(returnState);
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- // XXX reorder point
- case HEX_NCR_LOOP:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume as many characters as match the range of
- * characters given above.
- */
- assert value >= 0: "value must not become negative.";
- if (c >= '0' && c <= '9') {
- seenDigits = true;
- // Avoid overflow
- if (value <= 0x10FFFF) {
- value *= 16;
- value += c - '0';
- }
- continue;
- } else if (c >= 'A' && c <= 'F') {
- seenDigits = true;
- // Avoid overflow
- if (value <= 0x10FFFF) {
- value *= 16;
- value += c - 'A' + 10;
- }
- continue;
- } else if (c >= 'a' && c <= 'f') {
- seenDigits = true;
- // Avoid overflow
- if (value <= 0x10FFFF) {
- value *= 16;
- value += c - 'a' + 10;
- }
- continue;
- } else if (c == ';') {
- if (seenDigits) {
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos + 1;
- }
- state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
- continue stateloop;
- } else {
- errNoDigitsInNCR();
- appendCharRefBuf(';');
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos + 1;
- }
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- } else {
- /*
- * If no characters match the range, then don't
- * consume any characters (and unconsume the U+0023
- * NUMBER SIGN character and, if appropriate, the X
- * character). This is a parse error; nothing is
- * returned.
- *
- * Otherwise, if the next character is a U+003B
- * SEMICOLON, consume that too. If it isn't, there
- * is a parse error.
- */
- if (!seenDigits) {
- errNoDigitsInNCR();
- emitOrAppendCharRefBuf(returnState);
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- } else {
- errCharRefLacksSemicolon();
- if ((returnState & DATA_AND_RCDATA_MASK) == 0) {
- cstart = pos;
- }
- reconsume = true;
- state = transition(state, Tokenizer.HANDLE_NCR_VALUE, reconsume, pos);
- continue stateloop;
- }
- }
- }
- // XXX reorder point
- case PLAINTEXT:
- plaintextloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case '\u0000':
- emitPlaintextReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Stay in the
- * RAWTEXT state.
- */
- continue;
- }
- }
- // XXX reorder point
- case CLOSE_TAG_OPEN:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Otherwise, if the content model flag is set to the PCDATA
- * state, or if the next few characters do match that tag
- * name, consume the next input character:
- */
- switch (c) {
- case '>':
- /* U+003E GREATER-THAN SIGN (>) Parse error. */
- errLtSlashGt();
- /*
- * Switch to the data state.
- */
- cstart = pos + 1;
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- silentCarriageReturn();
- /* Anything else Parse error. */
- errGarbageAfterLtSlash();
- /*
- * Switch to the bogus comment state.
- */
- clearStrBufBeforeUse();
- appendStrBuf('\n');
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- /* Anything else Parse error. */
- errGarbageAfterLtSlash();
- /*
- * Switch to the bogus comment state.
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- if (c >= 'A' && c <= 'Z') {
- c += 0x20;
- }
- if (c >= 'a' && c <= 'z') {
- /*
- * U+0061 LATIN SMALL LETTER A through to U+007A
- * LATIN SMALL LETTER Z Create a new end tag
- * token,
- */
- endTag = true;
- /*
- * set its tag name to the input character,
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /*
- * then switch to the tag name state. (Don't
- * emit the token yet; further details will be
- * filled in before it is emitted.)
- */
- state = transition(state, Tokenizer.TAG_NAME, reconsume, pos);
- continue stateloop;
- } else {
- /* Anything else Parse error. */
- errGarbageAfterLtSlash();
- /*
- * Switch to the bogus comment state.
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case RCDATA:
- rcdataloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case '&':
- /*
- * U+0026 AMPERSAND (&) Switch to the character
- * reference in RCDATA state.
- */
- flushChars(buf, pos);
- assert charRefBufLen == 0: "charRefBufLen not reset after previous use!";
- appendCharRefBuf(c);
- setAdditionalAndRememberAmpersandLocation('\u0000');
- returnState = state;
- state = transition(state, Tokenizer.CONSUME_CHARACTER_REFERENCE, reconsume, pos);
- continue stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * RCDATA less-than sign state.
- */
- flushChars(buf, pos);
-
- returnState = state;
- state = transition(state, Tokenizer.RAWTEXT_RCDATA_LESS_THAN_SIGN, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Emit the current input character as a
- * character token. Stay in the RCDATA state.
- */
- continue;
- }
- }
- // XXX reorder point
- case RAWTEXT:
- rawtextloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * RAWTEXT less-than sign state.
- */
- flushChars(buf, pos);
-
- returnState = state;
- state = transition(state, Tokenizer.RAWTEXT_RCDATA_LESS_THAN_SIGN, reconsume, pos);
- break rawtextloop;
- // FALL THRU continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Emit the current input character as a
- * character token. Stay in the RAWTEXT state.
- */
- continue;
- }
- }
- // XXX fallthru don't reorder
- case RAWTEXT_RCDATA_LESS_THAN_SIGN:
- rawtextrcdatalessthansignloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '/':
- /*
- * U+002F SOLIDUS (/) Set the temporary buffer
- * to the empty string. Switch to the script
- * data end tag open state.
- */
- index = 0;
- clearStrBufBeforeUse();
- state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
- break rawtextrcdatalessthansignloop;
- // FALL THRU continue stateloop;
- default:
- /*
- * Otherwise, emit a U+003C LESS-THAN SIGN
- * character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in
- * the data state.
- */
- cstart = pos;
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX fall thru. don't reorder.
- case NON_DATA_END_TAG_NAME:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * ASSERT! when entering this state, set index to 0 and
- * call clearStrBufBeforeUse(); Let's implement the above
- * without lookahead. strBuf is the 'temporary buffer'.
- */
- if (endTagExpectationAsArray == null) {
- tokenHandler.characters(Tokenizer.LT_SOLIDUS,
- 0, 2);
- cstart = pos;
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- } else if (index < endTagExpectationAsArray.length) {
- char e = endTagExpectationAsArray[index];
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded != e) {
- // [NOCPP[
- errHtml4LtSlashInRcdata(folded);
- // ]NOCPP]
- tokenHandler.characters(Tokenizer.LT_SOLIDUS,
- 0, 2);
- emitStrBuf();
- cstart = pos;
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- appendStrBuf(c);
- index++;
- continue;
- } else {
- endTag = true;
- // XXX replace contentModelElement with different
- // type
- tagName = endTagExpectation;
- switch (c) {
- case '\r':
- silentCarriageReturn();
- clearStrBufAfterUse(); // strBuf not used
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE
- * FEED (LF) U+000C FORM FEED (FF) U+0020
- * SPACE If the current end tag token is an
- * appropriate end tag token, then switch to
- * the before attribute name state.
- */
- clearStrBufAfterUse(); // strBuf not used
- state = transition(state, Tokenizer.BEFORE_ATTRIBUTE_NAME, reconsume, pos);
- continue stateloop;
- case '/':
- /*
- * U+002F SOLIDUS (/) If the current end tag
- * token is an appropriate end tag token,
- * then switch to the self-closing start tag
- * state.
- */
- clearStrBufAfterUse(); // strBuf not used
- state = transition(state, Tokenizer.SELF_CLOSING_START_TAG, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) If the
- * current end tag token is an appropriate
- * end tag token, then emit the current tag
- * token and switch to the data state.
- */
- clearStrBufAfterUse(); // strBuf not used
- state = transition(state, emitCurrentTagToken(false, pos), reconsume, pos);
- if (shouldSuspend) {
- break stateloop;
- }
- continue stateloop;
- default:
- /*
- * Emit a U+003C LESS-THAN SIGN character
- * token, a U+002F SOLIDUS character token,
- * a character token for each of the
- * characters in the temporary buffer (in
- * the order they were added to the buffer),
- * and reconsume the current input character
- * in the RAWTEXT state.
- */
- // [NOCPP[
- errWarnLtSlashInRcdata();
- // ]NOCPP]
- tokenHandler.characters(
- Tokenizer.LT_SOLIDUS, 0, 2);
- emitStrBuf();
- cstart = pos; // don't drop the
- // character
- reconsume = true;
- state = transition(state, returnState, reconsume, pos);
- continue stateloop;
- }
- }
- }
- // XXX reorder point
- // BEGIN HOTSPOT WORKAROUND
- case BOGUS_COMMENT:
- boguscommentloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume every character up to and including the first
- * U+003E GREATER-THAN SIGN character (>) or the end of
- * the file (EOF), whichever comes first. Emit a comment
- * token whose data is the concatenation of all the
- * characters starting from and including the character
- * that caused the state machine to switch into the
- * bogus comment state, up to and including the
- * character immediately before the last consumed
- * character (i.e. up to the character just before the
- * U+003E or EOF character). (If the comment was started
- * by the end of the file (EOF), the token is empty.)
- *
- * Switch to the data state.
- *
- * If the end of the file was reached, reconsume the EOF
- * character.
- */
- switch (c) {
- case '>':
- emitComment(0, pos);
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '-':
- appendStrBuf(c);
- state = transition(state, Tokenizer.BOGUS_COMMENT_HYPHEN, reconsume, pos);
- break boguscommentloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- appendStrBuf(c);
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case BOGUS_COMMENT_HYPHEN:
- boguscommenthyphenloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '>':
- // [NOCPP[
- maybeAppendSpaceToBogusComment();
- // ]NOCPP]
- emitComment(0, pos);
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '-':
- appendSecondHyphenToBogusComment();
- continue boguscommenthyphenloop;
- case '\r':
- appendStrBufCarriageReturn();
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- appendStrBuf(c);
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case SCRIPT_DATA:
- scriptdataloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- switch (c) {
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * script data less-than sign state.
- */
- flushChars(buf, pos);
- returnState = state;
- state = transition(state, Tokenizer.SCRIPT_DATA_LESS_THAN_SIGN, reconsume, pos);
- break scriptdataloop; // FALL THRU continue
- // stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Stay in the
- * script data state.
- */
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_LESS_THAN_SIGN:
- scriptdatalessthansignloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '/':
- /*
- * U+002F SOLIDUS (/) Set the temporary buffer
- * to the empty string. Switch to the script
- * data end tag open state.
- */
- index = 0;
- clearStrBufBeforeUse();
- state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
- continue stateloop;
- case '!':
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- cstart = pos;
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPE_START, reconsume, pos);
- break scriptdatalessthansignloop; // FALL THRU
- // continue
- // stateloop;
- default:
- /*
- * Otherwise, emit a U+003C LESS-THAN SIGN
- * character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in
- * the data state.
- */
- cstart = pos;
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPE_START:
- scriptdataescapestartloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data escape start dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPE_START_DASH, reconsume, pos);
- break scriptdataescapestartloop; // FALL THRU
- // continue
- // stateloop;
- default:
- /*
- * Anything else Reconsume the current input
- * character in the script data state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPE_START_DASH:
- scriptdataescapestartdashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data escaped dash dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH_DASH, reconsume, pos);
- break scriptdataescapestartdashloop;
- // continue stateloop;
- default:
- /*
- * Anything else Reconsume the current input
- * character in the script data state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPED_DASH_DASH:
- scriptdataescapeddashdashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Stay in the
- * script data escaped dash dash state.
- */
- continue;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * script data escaped less-than sign state.
- */
- flushChars(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit a U+003E
- * GREATER-THAN SIGN character token. Switch to
- * the script data state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- break scriptdataescapeddashdashloop;
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Switch to the
- * script data escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- break scriptdataescapeddashdashloop;
- // continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPED:
- scriptdataescapedloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data escaped dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH, reconsume, pos);
- break scriptdataescapedloop; // FALL THRU
- // continue
- // stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * script data escaped less-than sign state.
- */
- flushChars(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Stay in the
- * script data escaped state.
- */
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPED_DASH:
- scriptdataescapeddashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data escaped dash dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_DASH_DASH, reconsume, pos);
- continue stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Switch to the
- * script data escaped less-than sign state.
- */
- flushChars(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- break scriptdataescapeddashloop;
- // continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Switch to the
- * script data escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
- scriptdataescapedlessthanloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '/':
- /*
- * U+002F SOLIDUS (/) Set the temporary buffer
- * to the empty string. Switch to the script
- * data escaped end tag open state.
- */
- index = 0;
- clearStrBufBeforeUse();
- returnState = Tokenizer.SCRIPT_DATA_ESCAPED;
- state = transition(state, Tokenizer.NON_DATA_END_TAG_NAME, reconsume, pos);
- continue stateloop;
- case 'S':
- case 's':
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Emit a U+003C
- * LESS-THAN SIGN character token and the
- * current input character as a character token.
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- cstart = pos;
- index = 1;
- /*
- * Set the temporary buffer to the empty string.
- * Append the lowercase version of the current
- * input character (add 0x0020 to the
- * character's code point) to the temporary
- * buffer. Switch to the script data double
- * escape start state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPE_START, reconsume, pos);
- break scriptdataescapedlessthanloop;
- // continue stateloop;
- default:
- /*
- * Anything else Emit a U+003C LESS-THAN SIGN
- * character token and reconsume the current
- * input character in the script data escaped
- * state.
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- cstart = pos;
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPE_START:
- scriptdatadoubleescapestartloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- assert index > 0;
- if (index < 6) { // SCRIPT_ARR.length
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded != Tokenizer.SCRIPT_ARR[index]) {
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue;
- }
- switch (c) {
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- case ' ':
- case '\t':
- case '\u000C':
- case '/':
- case '>':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * U+002F SOLIDUS (/) U+003E GREATER-THAN SIGN
- * (>) Emit the current input character as a
- * character token. If the temporary buffer is
- * the string "script", then switch to the
- * script data double escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- break scriptdatadoubleescapestartloop;
- // continue stateloop;
- default:
- /*
- * Anything else Reconsume the current input
- * character in the script data escaped state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPED:
- scriptdatadoubleescapedloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data double escaped dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_DASH, reconsume, pos);
- break scriptdatadoubleescapedloop; // FALL THRU
- // continue
- // stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Emit a U+003C
- * LESS-THAN SIGN character token. Switch to the
- * script data double escaped less-than sign
- * state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- continue;
- case '\r':
- emitCarriageReturn(buf, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Stay in the
- * script data double escaped state.
- */
- continue;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
- scriptdatadoubleescapeddashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Switch to the
- * script data double escaped dash dash state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH, reconsume, pos);
- break scriptdatadoubleescapeddashloop;
- // continue stateloop;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Emit a U+003C
- * LESS-THAN SIGN character token. Switch to the
- * script data double escaped less-than sign
- * state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Switch to the
- * script data double escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
- scriptdatadoubleescapeddashdashloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '-':
- /*
- * U+002D HYPHEN-MINUS (-) Emit a U+002D
- * HYPHEN-MINUS character token. Stay in the
- * script data double escaped dash dash state.
- */
- continue;
- case '<':
- /*
- * U+003C LESS-THAN SIGN (<) Emit a U+003C
- * LESS-THAN SIGN character token. Switch to the
- * script data double escaped less-than sign
- * state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN, reconsume, pos);
- break scriptdatadoubleescapeddashdashloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit a U+003E
- * GREATER-THAN SIGN character token. Switch to
- * the script data state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA, reconsume, pos);
- continue stateloop;
- case '\u0000':
- emitReplacementCharacter(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- default:
- /*
- * Anything else Emit the current input
- * character as a character token. Switch to the
- * script data double escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
- scriptdatadoubleescapedlessthanloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '/':
- /*
- * U+002F SOLIDUS (/) Emit a U+002F SOLIDUS
- * character token. Set the temporary buffer to
- * the empty string. Switch to the script data
- * double escape end state.
- */
- index = 0;
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPE_END, reconsume, pos);
- break scriptdatadoubleescapedlessthanloop;
- default:
- /*
- * Anything else Reconsume the current input
- * character in the script data double escaped
- * state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
- case SCRIPT_DATA_DOUBLE_ESCAPE_END:
- scriptdatadoubleescapeendloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (index < 6) { // SCRIPT_ARR.length
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded != Tokenizer.SCRIPT_ARR[index]) {
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue;
- }
- switch (c) {
- case '\r':
- emitCarriageReturn(buf, pos);
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- case ' ':
- case '\t':
- case '\u000C':
- case '/':
- case '>':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * U+002F SOLIDUS (/) U+003E GREATER-THAN SIGN
- * (>) Emit the current input character as a
- * character token. If the temporary buffer is
- * the string "script", then switch to the
- * script data escaped state.
- */
- state = transition(state, Tokenizer.SCRIPT_DATA_ESCAPED, reconsume, pos);
- continue stateloop;
- default:
- /*
- * Reconsume the current input character in the
- * script data double escaped state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.SCRIPT_DATA_DOUBLE_ESCAPED, reconsume, pos);
- continue stateloop;
- }
- }
- // XXX reorder point
- case MARKUP_DECLARATION_OCTYPE:
- markupdeclarationdoctypeloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- if (index < 6) { // OCTYPE.length
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded == Tokenizer.OCTYPE[index]) {
- appendStrBuf(c);
- } else {
- errBogusComment();
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_COMMENT, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue;
- } else {
- reconsume = true;
- state = transition(state, Tokenizer.DOCTYPE, reconsume, pos);
- break markupdeclarationdoctypeloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE:
- doctypeloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- initDoctypeFields();
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before DOCTYPE name state.
- */
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
- break doctypeloop;
- // continue stateloop;
- default:
- /*
- * Anything else Parse error.
- */
- errMissingSpaceBeforeDoctypeName();
- /*
- * Reconsume the current character in the before
- * DOCTYPE name state.
- */
- reconsume = true;
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_NAME, reconsume, pos);
- break doctypeloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_DOCTYPE_NAME:
- beforedoctypenameloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the before DOCTYPE name state.
- */
- continue;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errNamelessDoctype();
- /*
- * Create a new DOCTYPE token. Set its
- * force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit the token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- if (c >= 'A' && c <= 'Z') {
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Create a
- * new DOCTYPE token. Set the token's name
- * to the lowercase version of the input
- * character (add 0x0020 to the character's
- * code point).
- */
- c += 0x20;
- }
- /* Anything else Create a new DOCTYPE token. */
- /*
- * Set the token's name name to the current
- * input character.
- */
- clearStrBufBeforeUse();
- appendStrBuf(c);
- /*
- * Switch to the DOCTYPE name state.
- */
- state = transition(state, Tokenizer.DOCTYPE_NAME, reconsume, pos);
- break beforedoctypenameloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE_NAME:
- doctypenameloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- strBufToDoctypeName();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_NAME, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the after DOCTYPE name state.
- */
- strBufToDoctypeName();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_NAME, reconsume, pos);
- break doctypenameloop;
- // continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * DOCTYPE token.
- */
- strBufToDoctypeName();
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * U+0041 LATIN CAPITAL LETTER A through to
- * U+005A LATIN CAPITAL LETTER Z Append the
- * lowercase version of the input character (add
- * 0x0020 to the character's code point) to the
- * current DOCTYPE token's name.
- */
- if (c >= 'A' && c <= 'Z') {
- c += 0x0020;
- }
- /*
- * Anything else Append the current input
- * character to the current DOCTYPE token's
- * name.
- */
- appendStrBuf(c);
- /*
- * Stay in the DOCTYPE name state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_DOCTYPE_NAME:
- afterdoctypenameloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the after DOCTYPE name state.
- */
- continue;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case 'p':
- case 'P':
- index = 0;
- state = transition(state, Tokenizer.DOCTYPE_UBLIC, reconsume, pos);
- break afterdoctypenameloop;
- // continue stateloop;
- case 's':
- case 'S':
- index = 0;
- state = transition(state, Tokenizer.DOCTYPE_YSTEM, reconsume, pos);
- continue stateloop;
- default:
- /*
- * Otherwise, this is the parse error.
- */
- bogusDoctype();
-
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE_UBLIC:
- doctypeublicloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * If the six characters starting from the current input
- * character are an ASCII case-insensitive match for the
- * word "PUBLIC", then consume those characters and
- * switch to the before DOCTYPE public identifier state.
- */
- if (index < 5) { // UBLIC.length
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded != Tokenizer.UBLIC[index]) {
- bogusDoctype();
- // forceQuirks = true;
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue;
- } else {
- reconsume = true;
- state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_KEYWORD, reconsume, pos);
- break doctypeublicloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_DOCTYPE_PUBLIC_KEYWORD:
- afterdoctypepublickeywordloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before DOCTYPE public
- * identifier state.
- */
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
- break afterdoctypepublickeywordloop;
- // FALL THROUGH continue stateloop
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Parse Error.
- */
- errNoSpaceBetweenDoctypePublicKeywordAndQuote();
- /*
- * Set the DOCTYPE token's public identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Parse Error.
- */
- errNoSpaceBetweenDoctypePublicKeywordAndQuote();
- /*
- * Set the DOCTYPE token's public identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '>':
- /* U+003E GREATER-THAN SIGN (>) Parse error. */
- errExpectedPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
- beforedoctypepublicidentifierloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the before DOCTYPE public identifier
- * state.
- */
- continue;
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Set the DOCTYPE
- * token's public identifier to the empty string
- * (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- break beforedoctypepublicidentifierloop;
- // continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Set the DOCTYPE token's
- * public identifier to the empty string (not
- * missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '>':
- /* U+003E GREATER-THAN SIGN (>) Parse error. */
- errExpectedPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
- doctypepublicidentifierdoublequotedloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Switch to the after
- * DOCTYPE public identifier state.
- */
- publicIdentifier = strBufToString();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
- break doctypepublicidentifierdoublequotedloop;
- // continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errGtInPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- publicIdentifier = strBufToString();
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current DOCTYPE token's
- * public identifier.
- */
- appendStrBuf(c);
- /*
- * Stay in the DOCTYPE public identifier
- * (double-quoted) state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
- afterdoctypepublicidentifierloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- state = transition(state, Tokenizer.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the between DOCTYPE public and
- * system identifiers state.
- */
- state = transition(state, Tokenizer.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS, reconsume, pos);
- break afterdoctypepublicidentifierloop;
- // continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Parse error.
- */
- errNoSpaceBetweenPublicAndSystemIds();
- /*
- * Set the DOCTYPE token's system identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Parse error.
- */
- errNoSpaceBetweenPublicAndSystemIds();
- /*
- * Set the DOCTYPE token's system identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
- betweendoctypepublicandsystemidentifiersloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the between DOCTYPE public and system
- * identifiers state.
- */
- continue;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Set the DOCTYPE
- * token's system identifier to the empty string
- * (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- break betweendoctypepublicandsystemidentifiersloop;
- // continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Set the DOCTYPE token's
- * system identifier to the empty string (not
- * missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
- doctypesystemidentifierdoublequotedloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Switch to the after
- * DOCTYPE system identifier state.
- */
- systemIdentifier = strBufToString();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
- continue stateloop;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Parse error.
- */
- errGtInSystemId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- systemIdentifier = strBufToString();
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current DOCTYPE token's
- * system identifier.
- */
- appendStrBuf(c);
- /*
- * Stay in the DOCTYPE system identifier
- * (double-quoted) state.
- */
- continue;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
- afterdoctypesystemidentifierloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the after DOCTYPE system identifier state.
- */
- continue;
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit the current
- * DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- /*
- * Switch to the bogus DOCTYPE state. (This does
- * not set the DOCTYPE token's force-quirks flag
- * to on.)
- */
- bogusDoctypeWithoutQuirks();
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- break afterdoctypesystemidentifierloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case BOGUS_DOCTYPE:
- for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '>':
- /*
- * U+003E GREATER-THAN SIGN (>) Emit that
- * DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- default:
- /*
- * Anything else Stay in the bogus DOCTYPE
- * state.
- */
- continue;
- }
- }
- // XXX reorder point
- case DOCTYPE_YSTEM:
- doctypeystemloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Otherwise, if the six characters starting from the
- * current input character are an ASCII case-insensitive
- * match for the word "SYSTEM", then consume those
- * characters and switch to the before DOCTYPE system
- * identifier state.
- */
- if (index < 5) { // YSTEM.length
- char folded = c;
- if (c >= 'A' && c <= 'Z') {
- folded += 0x20;
- }
- if (folded != Tokenizer.YSTEM[index]) {
- bogusDoctype();
- reconsume = true;
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- index++;
- continue stateloop;
- } else {
- reconsume = true;
- state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_KEYWORD, reconsume, pos);
- break doctypeystemloop;
- // continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case AFTER_DOCTYPE_SYSTEM_KEYWORD:
- afterdoctypesystemkeywordloop: for (;;) {
- if (reconsume) {
- reconsume = false;
- } else {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- }
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE
- * Switch to the before DOCTYPE public
- * identifier state.
- */
- state = transition(state, Tokenizer.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
- break afterdoctypesystemkeywordloop;
- // FALL THROUGH continue stateloop
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Parse Error.
- */
- errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
- /*
- * Set the DOCTYPE token's system identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Parse Error.
- */
- errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
- /*
- * Set the DOCTYPE token's public identifier to
- * the empty string (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE public identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '>':
- /* U+003E GREATER-THAN SIGN (>) Parse error. */
- errExpectedPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
- beforedoctypesystemidentifierloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\r':
- silentCarriageReturn();
- break stateloop;
- case '\n':
- silentLineFeed();
- // fall thru
- case ' ':
- case '\t':
- case '\u000C':
- /*
- * U+0009 CHARACTER TABULATION U+000A LINE FEED
- * (LF) U+000C FORM FEED (FF) U+0020 SPACE Stay
- * in the before DOCTYPE system identifier
- * state.
- */
- continue;
- case '"':
- /*
- * U+0022 QUOTATION MARK (") Set the DOCTYPE
- * token's system identifier to the empty string
- * (not missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (double-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED, reconsume, pos);
- continue stateloop;
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Set the DOCTYPE token's
- * system identifier to the empty string (not
- * missing),
- */
- clearStrBufBeforeUse();
- /*
- * then switch to the DOCTYPE system identifier
- * (single-quoted) state.
- */
- state = transition(state, Tokenizer.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED, reconsume, pos);
- break beforedoctypesystemidentifierloop;
- // continue stateloop;
- case '>':
- /* U+003E GREATER-THAN SIGN (>) Parse error. */
- errExpectedSystemId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- default:
- bogusDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- // done by bogusDoctype();
- /*
- * Switch to the bogus DOCTYPE state.
- */
- state = transition(state, Tokenizer.BOGUS_DOCTYPE, reconsume, pos);
- continue stateloop;
- }
- }
- // FALLTHRU DON'T REORDER
- case DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Switch to the after
- * DOCTYPE system identifier state.
- */
- systemIdentifier = strBufToString();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_SYSTEM_IDENTIFIER, reconsume, pos);
- continue stateloop;
- case '>':
- errGtInSystemId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- systemIdentifier = strBufToString();
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current DOCTYPE token's
- * system identifier.
- */
- appendStrBuf(c);
- /*
- * Stay in the DOCTYPE system identifier
- * (double-quoted) state.
- */
- continue;
- }
- }
- // XXX reorder point
- case DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
- for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- /*
- * Consume the next input character:
- */
- switch (c) {
- case '\'':
- /*
- * U+0027 APOSTROPHE (') Switch to the after
- * DOCTYPE public identifier state.
- */
- publicIdentifier = strBufToString();
- state = transition(state, Tokenizer.AFTER_DOCTYPE_PUBLIC_IDENTIFIER, reconsume, pos);
- continue stateloop;
- case '>':
- errGtInPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- publicIdentifier = strBufToString();
- emitDoctypeToken(pos);
- /*
- * Switch to the data state.
- */
- state = transition(state, Tokenizer.DATA, reconsume, pos);
- continue stateloop;
- case '\r':
- appendStrBufCarriageReturn();
- break stateloop;
- case '\n':
- appendStrBufLineFeed();
- continue;
- case '\u0000':
- c = '\uFFFD';
- // fall thru
- default:
- /*
- * Anything else Append the current input
- * character to the current DOCTYPE token's
- * public identifier.
- */
- appendStrBuf(c);
- /*
- * Stay in the DOCTYPE public identifier
- * (single-quoted) state.
- */
- continue;
- }
- }
- // XXX reorder point
- case PROCESSING_INSTRUCTION:
- processinginstructionloop: for (;;) {
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '?':
- state = transition(
- state,
- Tokenizer.PROCESSING_INSTRUCTION_QUESTION_MARK,
- reconsume, pos);
- break processinginstructionloop;
- // continue stateloop;
- default:
- continue;
- }
- }
- case PROCESSING_INSTRUCTION_QUESTION_MARK:
- if (++pos == endPos) {
- break stateloop;
- }
- c = checkChar(buf, pos);
- switch (c) {
- case '>':
- state = transition(state, Tokenizer.DATA,
- reconsume, pos);
- continue stateloop;
- default:
- state = transition(state,
- Tokenizer.PROCESSING_INSTRUCTION,
- reconsume, pos);
- continue stateloop;
- }
- // END HOTSPOT WORKAROUND
- }
- }
- flushChars(buf, pos);
- /*
- * if (prevCR && pos != endPos) { // why is this needed? pos--; col--; }
- */
- // Save locals
- stateSave = state;
- returnStateSave = returnState;
- return pos;
- }
-
- // HOTSPOT WORKAROUND INSERTION POINT
-
- // [NOCPP[
-
- protected int transition(int from, int to, boolean reconsume, int pos) throws SAXException {
- return to;
- }
-
- // ]NOCPP]
-
- private void initDoctypeFields() {
- // Discard the characters "DOCTYPE" accumulated as a potential bogus
- // comment into strBuf.
- clearStrBufAfterUse();
- doctypeName = "";
- if (systemIdentifier != null) {
- Portability.releaseString(systemIdentifier);
- systemIdentifier = null;
- }
- if (publicIdentifier != null) {
- Portability.releaseString(publicIdentifier);
- publicIdentifier = null;
- }
- forceQuirks = false;
- }
-
- @Inline private void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
- throws SAXException {
- silentCarriageReturn();
- adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
- }
-
- @Inline private void adjustDoubleHyphenAndAppendToStrBufLineFeed()
- throws SAXException {
- silentLineFeed();
- adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
- }
-
- @Inline private void appendStrBufLineFeed() {
- silentLineFeed();
- appendStrBuf('\n');
- }
-
- @Inline private void appendStrBufCarriageReturn() {
- silentCarriageReturn();
- appendStrBuf('\n');
- }
-
- @Inline protected void silentCarriageReturn() {
- ++line;
- lastCR = true;
- }
-
- @Inline protected void silentLineFeed() {
- ++line;
- }
-
- private void emitCarriageReturn(@NoLength char[] buf, int pos)
- throws SAXException {
- silentCarriageReturn();
- flushChars(buf, pos);
- tokenHandler.characters(Tokenizer.LF, 0, 1);
- cstart = Integer.MAX_VALUE;
- }
-
- private void emitReplacementCharacter(@NoLength char[] buf, int pos)
- throws SAXException {
- flushChars(buf, pos);
- tokenHandler.zeroOriginatingReplacementCharacter();
- cstart = pos + 1;
- }
-
- private void emitPlaintextReplacementCharacter(@NoLength char[] buf, int pos)
- throws SAXException {
- flushChars(buf, pos);
- tokenHandler.characters(REPLACEMENT_CHARACTER, 0, 1);
- cstart = pos + 1;
- }
-
- private void setAdditionalAndRememberAmpersandLocation(char add) {
- additional = add;
- // [NOCPP[
- ampersandLocation = new LocatorImpl(this);
- // ]NOCPP]
- }
-
- private void bogusDoctype() throws SAXException {
- errBogusDoctype();
- forceQuirks = true;
- }
-
- private void bogusDoctypeWithoutQuirks() throws SAXException {
- errBogusDoctype();
- forceQuirks = false;
- }
-
- private void handleNcrValue(int returnState) throws SAXException {
- /*
- * If one or more characters match the range, then take them all and
- * interpret the string of characters as a number (either hexadecimal or
- * decimal as appropriate).
- */
- if (value <= 0xFFFF) {
- if (value >= 0x80 && value <= 0x9f) {
- /*
- * If that number is one of the numbers in the first column of
- * the following table, then this is a parse error.
- */
- errNcrInC1Range();
- /*
- * Find the row with that number in the first column, and return
- * a character token for the Unicode character given in the
- * second column of that row.
- */
- @NoLength char[] val = NamedCharacters.WINDOWS_1252[value - 0x80];
- emitOrAppendOne(val, returnState);
- // [NOCPP[
- } else if (value == 0xC
- && contentSpacePolicy != XmlViolationPolicy.ALLOW) {
- if (contentSpacePolicy == XmlViolationPolicy.ALTER_INFOSET) {
- emitOrAppendOne(Tokenizer.SPACE, returnState);
- } else if (contentSpacePolicy == XmlViolationPolicy.FATAL) {
- fatal("A character reference expanded to a form feed which is not legal XML 1.0 white space.");
- }
- // ]NOCPP]
- } else if (value == 0x0) {
- errNcrZero();
- emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
- } else if ((value & 0xF800) == 0xD800) {
- errNcrSurrogate();
- emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
- } else {
- /*
- * Otherwise, return a character token for the Unicode character
- * whose code point is that number.
- */
- char ch = (char) value;
- // [NOCPP[
- if (value == 0x0D) {
- errNcrCr();
- } else if ((value <= 0x0008) || (value == 0x000B)
- || (value >= 0x000E && value <= 0x001F)) {
- ch = errNcrControlChar(ch);
- } else if (value >= 0xFDD0 && value <= 0xFDEF) {
- errNcrUnassigned();
- } else if ((value & 0xFFFE) == 0xFFFE) {
- ch = errNcrNonCharacter(ch);
- } else if (value >= 0x007F && value <= 0x009F) {
- errNcrControlChar();
- } else {
- maybeWarnPrivateUse(ch);
- }
- // ]NOCPP]
- bmpChar[0] = ch;
- emitOrAppendOne(bmpChar, returnState);
- }
- } else if (value <= 0x10FFFF) {
- // [NOCPP[
- maybeWarnPrivateUseAstral();
- if ((value & 0xFFFE) == 0xFFFE) {
- errAstralNonCharacter(value);
- }
- // ]NOCPP]
- astralChar[0] = (char) (Tokenizer.LEAD_OFFSET + (value >> 10));
- astralChar[1] = (char) (0xDC00 + (value & 0x3FF));
- emitOrAppendTwo(astralChar, returnState);
- } else {
- errNcrOutOfRange();
- emitOrAppendOne(Tokenizer.REPLACEMENT_CHARACTER, returnState);
- }
- }
-
- public void eof() throws SAXException {
- int state = stateSave;
- int returnState = returnStateSave;
-
- eofloop: for (;;) {
- switch (state) {
- case SCRIPT_DATA_LESS_THAN_SIGN:
- case SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:
- /*
- * Otherwise, emit a U+003C LESS-THAN SIGN character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in the data
- * state.
- */
- break eofloop;
- case TAG_OPEN:
- /*
- * The behavior of this state depends on the content model
- * flag.
- */
- /*
- * Anything else Parse error.
- */
- errEofAfterLt();
- /*
- * Emit a U+003C LESS-THAN SIGN character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in the data
- * state.
- */
- break eofloop;
- case RAWTEXT_RCDATA_LESS_THAN_SIGN:
- /*
- * Emit a U+003C LESS-THAN SIGN character token
- */
- tokenHandler.characters(Tokenizer.LT_GT, 0, 1);
- /*
- * and reconsume the current input character in the RCDATA
- * state.
- */
- break eofloop;
- case NON_DATA_END_TAG_NAME:
- /*
- * Emit a U+003C LESS-THAN SIGN character token, a U+002F
- * SOLIDUS character token,
- */
- tokenHandler.characters(Tokenizer.LT_SOLIDUS, 0, 2);
- /*
- * a character token for each of the characters in the
- * temporary buffer (in the order they were added to the
- * buffer),
- */
- emitStrBuf();
- /*
- * and reconsume the current input character in the RCDATA
- * state.
- */
- break eofloop;
- case CLOSE_TAG_OPEN:
- /* EOF Parse error. */
- errEofAfterLt();
- /*
- * Emit a U+003C LESS-THAN SIGN character token and a U+002F
- * SOLIDUS character token.
- */
- tokenHandler.characters(Tokenizer.LT_SOLIDUS, 0, 2);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case TAG_NAME:
- /*
- * EOF Parse error.
- */
- errEofInTagName();
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case BEFORE_ATTRIBUTE_NAME:
- case AFTER_ATTRIBUTE_VALUE_QUOTED:
- case SELF_CLOSING_START_TAG:
- /* EOF Parse error. */
- errEofWithoutGt();
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case ATTRIBUTE_NAME:
- /*
- * EOF Parse error.
- */
- errEofInAttributeName();
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case AFTER_ATTRIBUTE_NAME:
- case BEFORE_ATTRIBUTE_VALUE:
- /* EOF Parse error. */
- errEofWithoutGt();
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
- case ATTRIBUTE_VALUE_SINGLE_QUOTED:
- case ATTRIBUTE_VALUE_UNQUOTED:
- /* EOF Parse error. */
- errEofInAttributeValue();
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case BOGUS_COMMENT:
- emitComment(0, 0);
- break eofloop;
- case BOGUS_COMMENT_HYPHEN:
- // [NOCPP[
- maybeAppendSpaceToBogusComment();
- // ]NOCPP]
- emitComment(0, 0);
- break eofloop;
- case MARKUP_DECLARATION_OPEN:
- errBogusComment();
- emitComment(0, 0);
- break eofloop;
- case MARKUP_DECLARATION_HYPHEN:
- errBogusComment();
- emitComment(0, 0);
- break eofloop;
- case MARKUP_DECLARATION_OCTYPE:
- if (index < 6) {
- errBogusComment();
- emitComment(0, 0);
- } else {
- /* EOF Parse error. */
- errEofInDoctype();
- /*
- * Create a new DOCTYPE token. Set its force-quirks flag
- * to on.
- */
- doctypeName = "";
- if (systemIdentifier != null) {
- Portability.releaseString(systemIdentifier);
- systemIdentifier = null;
- }
- if (publicIdentifier != null) {
- Portability.releaseString(publicIdentifier);
- publicIdentifier = null;
- }
- forceQuirks = true;
- /*
- * Emit the token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- }
- break eofloop;
- case COMMENT_START:
- case COMMENT:
- /*
- * EOF Parse error.
- */
- errEofInComment();
- /* Emit the comment token. */
- emitComment(0, 0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case COMMENT_END:
- errEofInComment();
- /* Emit the comment token. */
- emitComment(2, 0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case COMMENT_END_DASH:
- case COMMENT_START_DASH:
- errEofInComment();
- /* Emit the comment token. */
- emitComment(1, 0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case COMMENT_END_BANG:
- errEofInComment();
- /* Emit the comment token. */
- emitComment(3, 0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case DOCTYPE:
- case BEFORE_DOCTYPE_NAME:
- errEofInDoctype();
- /*
- * Create a new DOCTYPE token. Set its force-quirks flag to
- * on.
- */
- forceQuirks = true;
- /*
- * Emit the token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case DOCTYPE_NAME:
- errEofInDoctype();
- strBufToDoctypeName();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case DOCTYPE_UBLIC:
- case DOCTYPE_YSTEM:
- case AFTER_DOCTYPE_NAME:
- case AFTER_DOCTYPE_PUBLIC_KEYWORD:
- case AFTER_DOCTYPE_SYSTEM_KEYWORD:
- case BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:
- errEofInDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:
- case DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:
- /* EOF Parse error. */
- errEofInPublicId();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- publicIdentifier = strBufToString();
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case AFTER_DOCTYPE_PUBLIC_IDENTIFIER:
- case BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:
- case BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:
- errEofInDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:
- case DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:
- /* EOF Parse error. */
- errEofInSystemId();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- systemIdentifier = strBufToString();
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case AFTER_DOCTYPE_SYSTEM_IDENTIFIER:
- errEofInDoctype();
- /*
- * Set the DOCTYPE token's force-quirks flag to on.
- */
- forceQuirks = true;
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case BOGUS_DOCTYPE:
- /*
- * Emit that DOCTYPE token.
- */
- emitDoctypeToken(0);
- /*
- * Reconsume the EOF character in the data state.
- */
- break eofloop;
- case CONSUME_CHARACTER_REFERENCE:
- /*
- * Unlike the definition is the spec, this state does not
- * return a value and never requires the caller to
- * backtrack. This state takes care of emitting characters
- * or appending to the current attribute value. It also
- * takes care of that in the case when consuming the entity
- * fails.
- */
- /*
- * This section defines how to consume an entity. This
- * definition is used when parsing entities in text and in
- * attributes.
- *
- * The behavior depends on the identity of the next
- * character (the one immediately after the U+0026 AMPERSAND
- * character):
- */
-
- emitOrAppendCharRefBuf(returnState);
- state = returnState;
- continue;
- case CHARACTER_REFERENCE_HILO_LOOKUP:
- errNoNamedCharacterMatch();
- emitOrAppendCharRefBuf(returnState);
- state = returnState;
- continue;
- case CHARACTER_REFERENCE_TAIL:
- outer: for (;;) {
- char c = '\u0000';
- entCol++;
- /*
- * Consume the maximum number of characters possible,
- * with the consumed characters matching one of the
- * identifiers in the first column of the named
- * character references table (in a case-sensitive
- * manner).
- */
- hiloop: for (;;) {
- if (hi == -1) {
- break hiloop;
- }
- if (entCol == NamedCharacters.NAMES[hi].length()) {
- break hiloop;
- }
- if (entCol > NamedCharacters.NAMES[hi].length()) {
- break outer;
- } else if (c < NamedCharacters.NAMES[hi].charAt(entCol)) {
- hi--;
- } else {
- break hiloop;
- }
- }
-
- loloop: for (;;) {
- if (hi < lo) {
- break outer;
- }
- if (entCol == NamedCharacters.NAMES[lo].length()) {
- candidate = lo;
- charRefBufMark = charRefBufLen;
- lo++;
- } else if (entCol > NamedCharacters.NAMES[lo].length()) {
- break outer;
- } else if (c > NamedCharacters.NAMES[lo].charAt(entCol)) {
- lo++;
- } else {
- break loloop;
- }
- }
- if (hi < lo) {
- break outer;
- }
- continue;
- }
-
- if (candidate == -1) {
- /*
- * If no match can be made, then this is a parse error.
- */
- errNoNamedCharacterMatch();
- emitOrAppendCharRefBuf(returnState);
- state = returnState;
- continue eofloop;
- } else {
- @Const @CharacterName String candidateName = NamedCharacters.NAMES[candidate];
- if (candidateName.length() == 0
- || candidateName.charAt(candidateName.length() - 1) != ';') {
- /*
- * If the last character matched is not a U+003B
- * SEMICOLON (;), there is a parse error.
- */
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- /*
- * If the entity is being consumed as part of an
- * attribute, and the last character matched is
- * not a U+003B SEMICOLON (;),
- */
- char ch;
- if (charRefBufMark == charRefBufLen) {
- ch = '\u0000';
- } else {
- ch = charRefBuf[charRefBufMark];
- }
- if ((ch >= '0' && ch <= '9')
- || (ch >= 'A' && ch <= 'Z')
- || (ch >= 'a' && ch <= 'z')) {
- /*
- * and the next character is in the range
- * U+0030 DIGIT ZERO to U+0039 DIGIT NINE,
- * U+0041 LATIN CAPITAL LETTER A to U+005A
- * LATIN CAPITAL LETTER Z, or U+0061 LATIN
- * SMALL LETTER A to U+007A LATIN SMALL
- * LETTER Z, then, for historical reasons,
- * all the characters that were matched
- * after the U+0026 AMPERSAND (&) must be
- * unconsumed, and nothing is returned.
- */
- errNoNamedCharacterMatch();
- appendCharRefBufToStrBuf();
- state = returnState;
- continue eofloop;
- }
- }
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- errUnescapedAmpersandInterpretedAsCharacterReference();
- } else {
- errNotSemicolonTerminated();
- }
- }
-
- /*
- * Otherwise, return a character token for the character
- * corresponding to the entity name (as given by the
- * second column of the named character references
- * table).
- */
- @Const @NoLength char[] val = NamedCharacters.VALUES[candidate];
- if (
- // [NOCPP[
- val.length == 1
- // ]NOCPP]
- // CPPONLY: val[1] == 0
- ) {
- emitOrAppendOne(val, returnState);
- } else {
- emitOrAppendTwo(val, returnState);
- }
- // this is so complicated!
- if (charRefBufMark < charRefBufLen) {
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- appendStrBuf(charRefBuf, charRefBufMark,
- charRefBufLen - charRefBufMark);
- } else {
- tokenHandler.characters(charRefBuf, charRefBufMark,
- charRefBufLen - charRefBufMark);
- }
- }
- charRefBufLen = 0;
- state = returnState;
- continue eofloop;
- /*
- * If the markup contains I'm &notit; I tell you, the
- * entity is parsed as "not", as in, I'm ¬it; I tell
- * you. But if the markup was I'm &notin; I tell you,
- * the entity would be parsed as "notin;", resulting in
- * I'm ∉ I tell you.
- */
- }
- case CONSUME_NCR:
- case DECIMAL_NRC_LOOP:
- case HEX_NCR_LOOP:
- /*
- * If no characters match the range, then don't consume any
- * characters (and unconsume the U+0023 NUMBER SIGN
- * character and, if appropriate, the X character). This is
- * a parse error; nothing is returned.
- *
- * Otherwise, if the next character is a U+003B SEMICOLON,
- * consume that too. If it isn't, there is a parse error.
- */
- if (!seenDigits) {
- errNoDigitsInNCR();
- emitOrAppendCharRefBuf(returnState);
- state = returnState;
- continue;
- } else {
- errCharRefLacksSemicolon();
- }
- // WARNING previous state sets reconsume
- handleNcrValue(returnState);
- state = returnState;
- continue;
- case CDATA_RSQB:
- tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
- break eofloop;
- case CDATA_RSQB_RSQB:
- tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 2);
- break eofloop;
- case DATA:
- default:
- break eofloop;
- }
- }
- // case DATA:
- /*
- * EOF Emit an end-of-file token.
- */
- tokenHandler.eof();
- return;
- }
-
- private void emitDoctypeToken(int pos) throws SAXException {
- cstart = pos + 1;
- tokenHandler.doctype(doctypeName, publicIdentifier, systemIdentifier,
- forceQuirks);
- // It is OK and sufficient to release these here, since
- // there's no way out of the doctype states than through paths
- // that call this method.
- doctypeName = null;
- Portability.releaseString(publicIdentifier);
- publicIdentifier = null;
- Portability.releaseString(systemIdentifier);
- systemIdentifier = null;
- }
-
- @Inline protected char checkChar(@NoLength char[] buf, int pos)
- throws SAXException {
- return buf[pos];
- }
-
- public boolean internalEncodingDeclaration(String internalCharset)
- throws SAXException {
- if (encodingDeclarationHandler != null) {
- return encodingDeclarationHandler.internalEncodingDeclaration(internalCharset);
- }
- return false;
- }
-
- /**
- * @param val
- * @throws SAXException
- */
- private void emitOrAppendTwo(@Const @NoLength char[] val, int returnState)
- throws SAXException {
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- appendStrBuf(val[0]);
- appendStrBuf(val[1]);
- } else {
- tokenHandler.characters(val, 0, 2);
- }
- }
-
- private void emitOrAppendOne(@Const @NoLength char[] val, int returnState)
- throws SAXException {
- if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
- appendStrBuf(val[0]);
- } else {
- tokenHandler.characters(val, 0, 1);
- }
- }
-
- public void end() throws SAXException {
- strBuf = null;
- doctypeName = null;
- if (systemIdentifier != null) {
- Portability.releaseString(systemIdentifier);
- systemIdentifier = null;
- }
- if (publicIdentifier != null) {
- Portability.releaseString(publicIdentifier);
- publicIdentifier = null;
- }
- if (tagName != null) {
- tagName.release();
- tagName = null;
- }
- if (attributeName != null) {
- attributeName.release();
- attributeName = null;
- }
- tokenHandler.endTokenization();
- if (attributes != null) {
- // [NOCPP[
- attributes = null;
- // ]NOCPP]
- // CPPONLY: attributes.clear(mappingLangToXmlLang);
- }
- }
-
- public void requestSuspension() {
- shouldSuspend = true;
- }
-
- // [NOCPP[
-
- public void becomeConfident() {
- confident = true;
- }
-
- /**
- * Returns the nextCharOnNewLine.
- *
- * @return the nextCharOnNewLine
- */
- public boolean isNextCharOnNewLine() {
- return false;
- }
-
- public boolean isPrevCR() {
- return lastCR;
- }
-
- /**
- * Returns the line.
- *
- * @return the line
- */
- public int getLine() {
- return -1;
- }
-
- /**
- * Returns the col.
- *
- * @return the col
- */
- public int getCol() {
- return -1;
- }
-
- // ]NOCPP]
-
- public boolean isInDataState() {
- return (stateSave == DATA);
- }
-
- public void resetToDataState() {
- clearStrBufAfterUse();
- charRefBufLen = 0;
- stateSave = Tokenizer.DATA;
- // line = 1; XXX line numbers
- lastCR = false;
- index = 0;
- forceQuirks = false;
- additional = '\u0000';
- entCol = -1;
- firstCharKey = -1;
- lo = 0;
- hi = 0; // will always be overwritten before use anyway
- candidate = -1;
- charRefBufMark = 0;
- value = 0;
- seenDigits = false;
- endTag = false;
- shouldSuspend = false;
- initDoctypeFields();
- if (tagName != null) {
- tagName.release();
- tagName = null;
- }
- if (attributeName != null) {
- attributeName.release();
- attributeName = null;
- }
- if (newAttributesEachTime) {
- if (attributes != null) {
- Portability.delete(attributes);
- attributes = null;
- }
- }
- }
-
- public void loadState(Tokenizer other) throws SAXException {
- strBufLen = other.strBufLen;
- if (strBufLen > strBuf.length) {
- strBuf = new char[strBufLen];
- }
- System.arraycopy(other.strBuf, 0, strBuf, 0, strBufLen);
-
- charRefBufLen = other.charRefBufLen;
- System.arraycopy(other.charRefBuf, 0, charRefBuf, 0, charRefBufLen);
-
- stateSave = other.stateSave;
- returnStateSave = other.returnStateSave;
- endTagExpectation = other.endTagExpectation;
- endTagExpectationAsArray = other.endTagExpectationAsArray;
- // line = 1; XXX line numbers
- lastCR = other.lastCR;
- index = other.index;
- forceQuirks = other.forceQuirks;
- additional = other.additional;
- entCol = other.entCol;
- firstCharKey = other.firstCharKey;
- lo = other.lo;
- hi = other.hi;
- candidate = other.candidate;
- charRefBufMark = other.charRefBufMark;
- value = other.value;
- seenDigits = other.seenDigits;
- endTag = other.endTag;
- shouldSuspend = false;
-
- if (other.doctypeName == null) {
- doctypeName = null;
- } else {
- doctypeName = Portability.newLocalFromLocal(other.doctypeName,
- interner);
- }
-
- Portability.releaseString(systemIdentifier);
- if (other.systemIdentifier == null) {
- systemIdentifier = null;
- } else {
- systemIdentifier = Portability.newStringFromString(other.systemIdentifier);
- }
-
- Portability.releaseString(publicIdentifier);
- if (other.publicIdentifier == null) {
- publicIdentifier = null;
- } else {
- publicIdentifier = Portability.newStringFromString(other.publicIdentifier);
- }
-
- if (tagName != null) {
- tagName.release();
- }
- if (other.tagName == null) {
- tagName = null;
- } else {
- tagName = other.tagName.cloneElementName(interner);
- }
-
- if (attributeName != null) {
- attributeName.release();
- }
- if (other.attributeName == null) {
- attributeName = null;
- } else {
- attributeName = other.attributeName.cloneAttributeName(interner);
- }
-
- Portability.delete(attributes);
- if (other.attributes == null) {
- attributes = null;
- } else {
- attributes = other.attributes.cloneAttributes(interner);
- }
- }
-
- public void initializeWithoutStarting() throws SAXException {
- confident = false;
- strBuf = null;
- line = 1;
- // CPPONLY: attributeLine = 1;
- // [NOCPP[
- html4 = false;
- metaBoundaryPassed = false;
- wantsComments = tokenHandler.wantsComments();
- if (!newAttributesEachTime) {
- attributes = new HtmlAttributes(mappingLangToXmlLang);
- }
- // ]NOCPP]
- resetToDataState();
- }
-
- protected void errGarbageAfterLtSlash() throws SAXException {
- }
-
- protected void errLtSlashGt() throws SAXException {
- }
-
- protected void errWarnLtSlashInRcdata() throws SAXException {
- }
-
- protected void errHtml4LtSlashInRcdata(char folded) throws SAXException {
- }
-
- protected void errCharRefLacksSemicolon() throws SAXException {
- }
-
- protected void errNoDigitsInNCR() throws SAXException {
- }
-
- protected void errGtInSystemId() throws SAXException {
- }
-
- protected void errGtInPublicId() throws SAXException {
- }
-
- protected void errNamelessDoctype() throws SAXException {
- }
-
- protected void errConsecutiveHyphens() throws SAXException {
- }
-
- protected void errPrematureEndOfComment() throws SAXException {
- }
-
- protected void errBogusComment() throws SAXException {
- }
-
- protected void errUnquotedAttributeValOrNull(char c) throws SAXException {
- }
-
- protected void errSlashNotFollowedByGt() throws SAXException {
- }
-
- protected void errHtml4XmlVoidSyntax() throws SAXException {
- }
-
- protected void errNoSpaceBetweenAttributes() throws SAXException {
- }
-
- protected void errHtml4NonNameInUnquotedAttribute(char c)
- throws SAXException {
- }
-
- protected void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char c)
- throws SAXException {
- }
-
- protected void errAttributeValueMissing() throws SAXException {
- }
-
- protected void errBadCharBeforeAttributeNameOrNull(char c)
- throws SAXException {
- }
-
- protected void errEqualsSignBeforeAttributeName() throws SAXException {
- }
-
- protected void errBadCharAfterLt(char c) throws SAXException {
- }
-
- protected void errLtGt() throws SAXException {
- }
-
- protected void errProcessingInstruction() throws SAXException {
- }
-
- protected void errUnescapedAmpersandInterpretedAsCharacterReference()
- throws SAXException {
- }
-
- protected void errNotSemicolonTerminated() throws SAXException {
- }
-
- protected void errNoNamedCharacterMatch() throws SAXException {
- }
-
- protected void errQuoteBeforeAttributeName(char c) throws SAXException {
- }
-
- protected void errQuoteOrLtInAttributeNameOrNull(char c)
- throws SAXException {
- }
-
- protected void errExpectedPublicId() throws SAXException {
- }
-
- protected void errBogusDoctype() throws SAXException {
- }
-
- protected void maybeWarnPrivateUseAstral() throws SAXException {
- }
-
- protected void maybeWarnPrivateUse(char ch) throws SAXException {
- }
-
- protected void maybeErrAttributesOnEndTag(HtmlAttributes attrs)
- throws SAXException {
- }
-
- protected void maybeErrSlashInEndTag(boolean selfClosing)
- throws SAXException {
- }
-
- protected char errNcrNonCharacter(char ch) throws SAXException {
- return ch;
- }
-
- protected void errAstralNonCharacter(int ch) throws SAXException {
- }
-
- protected void errNcrSurrogate() throws SAXException {
- }
-
- protected char errNcrControlChar(char ch) throws SAXException {
- return ch;
- }
-
- protected void errNcrCr() throws SAXException {
- }
-
- protected void errNcrInC1Range() throws SAXException {
- }
-
- protected void errEofInPublicId() throws SAXException {
- }
-
- protected void errEofInComment() throws SAXException {
- }
-
- protected void errEofInDoctype() throws SAXException {
- }
-
- protected void errEofInAttributeValue() throws SAXException {
- }
-
- protected void errEofInAttributeName() throws SAXException {
- }
-
- protected void errEofWithoutGt() throws SAXException {
- }
-
- protected void errEofInTagName() throws SAXException {
- }
-
- protected void errEofInEndTag() throws SAXException {
- }
-
- protected void errEofAfterLt() throws SAXException {
- }
-
- protected void errNcrOutOfRange() throws SAXException {
- }
-
- protected void errNcrUnassigned() throws SAXException {
- }
-
- protected void errDuplicateAttribute() throws SAXException {
- }
-
- protected void errEofInSystemId() throws SAXException {
- }
-
- protected void errExpectedSystemId() throws SAXException {
- }
-
- protected void errMissingSpaceBeforeDoctypeName() throws SAXException {
- }
-
- protected void errHyphenHyphenBang() throws SAXException {
- }
-
- protected void errNcrControlChar() throws SAXException {
- }
-
- protected void errNcrZero() throws SAXException {
- }
-
- protected void errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
- throws SAXException {
- }
-
- protected void errNoSpaceBetweenPublicAndSystemIds() throws SAXException {
- }
-
- protected void errNoSpaceBetweenDoctypePublicKeywordAndQuote()
- throws SAXException {
- }
-
- protected void noteAttributeWithoutValue() throws SAXException {
- }
-
- protected void noteUnquotedAttributeValue() throws SAXException {
- }
-
- /**
- * Sets the encodingDeclarationHandler.
- *
- * @param encodingDeclarationHandler
- * the encodingDeclarationHandler to set
- */
- public void setEncodingDeclarationHandler(
- EncodingDeclarationHandler encodingDeclarationHandler) {
- this.encodingDeclarationHandler = encodingDeclarationHandler;
- }
-
- void destructor() {
- // The translator will write refcount tracing stuff here
- Portability.delete(attributes);
- attributes = null;
- }
-
- // [NOCPP[
-
- /**
- * Sets an offset to be added to the position reported to
- * <code>TransitionHandler</code>.
- *
- * @param offset the offset
- */
- public void setTransitionBaseOffset(int offset) {
-
- }
-
- // ]NOCPP]
-
-}
diff --git a/parser/html/javasrc/TreeBuilder.java b/parser/html/javasrc/TreeBuilder.java
deleted file mode 100644
index 58074086d..000000000
--- a/parser/html/javasrc/TreeBuilder.java
+++ /dev/null
@@ -1,6552 +0,0 @@
-/*
- * Copyright (c) 2007 Henri Sivonen
- * Copyright (c) 2007-2015 Mozilla Foundation
- * Copyright (c) 2018-2019 Moonchild Productions
- * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
- * Foundation, and Opera Software ASA.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The comments following this one that use the same comment syntax as this
- * comment are quotes from the WHATWG HTML 5 spec as of 27 June 2007
- * amended as of June 28 2007.
- * That document came with this statement:
- * "© Copyright 2004-2007 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce and
- * create derivative works of this document."
- */
-
-package nu.validator.htmlparser.impl;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import nu.validator.htmlparser.annotation.Auto;
-import nu.validator.htmlparser.annotation.Const;
-import nu.validator.htmlparser.annotation.IdType;
-import nu.validator.htmlparser.annotation.Inline;
-import nu.validator.htmlparser.annotation.Literal;
-import nu.validator.htmlparser.annotation.Local;
-import nu.validator.htmlparser.annotation.NoLength;
-import nu.validator.htmlparser.annotation.NsUri;
-import nu.validator.htmlparser.common.DoctypeExpectation;
-import nu.validator.htmlparser.common.DocumentMode;
-import nu.validator.htmlparser.common.DocumentModeHandler;
-import nu.validator.htmlparser.common.Interner;
-import nu.validator.htmlparser.common.TokenHandler;
-import nu.validator.htmlparser.common.XmlViolationPolicy;
-
-public abstract class TreeBuilder<T> implements TokenHandler,
- TreeBuilderState<T> {
-
- /**
- * Array version of U+FFFD.
- */
- private static final @NoLength char[] REPLACEMENT_CHARACTER = { '\uFFFD' };
-
- // Start dispatch groups
-
- final static int OTHER = 0;
-
- final static int A = 1;
-
- final static int BASE = 2;
-
- final static int BODY = 3;
-
- final static int BR = 4;
-
- final static int BUTTON = 5;
-
- final static int CAPTION = 6;
-
- final static int COL = 7;
-
- final static int COLGROUP = 8;
-
- final static int FORM = 9;
-
- final static int FRAME = 10;
-
- final static int FRAMESET = 11;
-
- final static int IMAGE = 12;
-
- final static int INPUT = 13;
-
- final static int ISINDEX = 14;
-
- final static int LI = 15;
-
- final static int LINK_OR_BASEFONT_OR_BGSOUND = 16;
-
- final static int MATH = 17;
-
- final static int META = 18;
-
- final static int SVG = 19;
-
- final static int HEAD = 20;
-
- final static int HR = 22;
-
- final static int HTML = 23;
-
- final static int NOBR = 24;
-
- final static int NOFRAMES = 25;
-
- final static int NOSCRIPT = 26;
-
- final static int OPTGROUP = 27;
-
- final static int OPTION = 28;
-
- final static int P = 29;
-
- final static int PLAINTEXT = 30;
-
- final static int SCRIPT = 31;
-
- final static int SELECT = 32;
-
- final static int STYLE = 33;
-
- final static int TABLE = 34;
-
- final static int TEXTAREA = 35;
-
- final static int TITLE = 36;
-
- final static int TR = 37;
-
- final static int XMP = 38;
-
- final static int TBODY_OR_THEAD_OR_TFOOT = 39;
-
- final static int TD_OR_TH = 40;
-
- final static int DD_OR_DT = 41;
-
- final static int H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
-
- final static int MARQUEE_OR_APPLET = 43;
-
- final static int PRE_OR_LISTING = 44;
-
- final static int B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U = 45;
-
- final static int UL_OR_OL_OR_DL = 46;
-
- final static int IFRAME = 47;
-
- final static int EMBED = 48;
-
- final static int AREA_OR_WBR = 49;
-
- final static int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
-
- final static int ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY = 51;
-
- final static int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
-
- final static int RB_OR_RTC = 53;
-
- final static int PARAM_OR_SOURCE_OR_TRACK = 55;
-
- final static int MGLYPH_OR_MALIGNMARK = 56;
-
- final static int MI_MO_MN_MS_MTEXT = 57;
-
- final static int ANNOTATION_XML = 58;
-
- final static int FOREIGNOBJECT_OR_DESC = 59;
-
- final static int NOEMBED = 60;
-
- final static int FIELDSET = 61;
-
- final static int OUTPUT = 62;
-
- final static int OBJECT = 63;
-
- final static int FONT = 64;
-
- final static int KEYGEN = 65;
-
- final static int MENUITEM = 66;
-
- final static int TEMPLATE = 67;
-
- final static int IMG = 68;
-
- final static int RT_OR_RP = 69;
-
- // start insertion modes
-
- private static final int IN_ROW = 0;
-
- private static final int IN_TABLE_BODY = 1;
-
- private static final int IN_TABLE = 2;
-
- private static final int IN_CAPTION = 3;
-
- private static final int IN_CELL = 4;
-
- private static final int FRAMESET_OK = 5;
-
- private static final int IN_BODY = 6;
-
- private static final int IN_HEAD = 7;
-
- private static final int IN_HEAD_NOSCRIPT = 8;
-
- // no fall-through
-
- private static final int IN_COLUMN_GROUP = 9;
-
- // no fall-through
-
- private static final int IN_SELECT_IN_TABLE = 10;
-
- private static final int IN_SELECT = 11;
-
- // no fall-through
-
- private static final int AFTER_BODY = 12;
-
- // no fall-through
-
- private static final int IN_FRAMESET = 13;
-
- private static final int AFTER_FRAMESET = 14;
-
- // no fall-through
-
- private static final int INITIAL = 15;
-
- // could add fall-through
-
- private static final int BEFORE_HTML = 16;
-
- // could add fall-through
-
- private static final int BEFORE_HEAD = 17;
-
- // no fall-through
-
- private static final int AFTER_HEAD = 18;
-
- // no fall-through
-
- private static final int AFTER_AFTER_BODY = 19;
-
- // no fall-through
-
- private static final int AFTER_AFTER_FRAMESET = 20;
-
- // no fall-through
-
- private static final int TEXT = 21;
-
- private static final int IN_TEMPLATE = 22;
-
- // start charset states
-
- private static final int CHARSET_INITIAL = 0;
-
- private static final int CHARSET_C = 1;
-
- private static final int CHARSET_H = 2;
-
- private static final int CHARSET_A = 3;
-
- private static final int CHARSET_R = 4;
-
- private static final int CHARSET_S = 5;
-
- private static final int CHARSET_E = 6;
-
- private static final int CHARSET_T = 7;
-
- private static final int CHARSET_EQUALS = 8;
-
- private static final int CHARSET_SINGLE_QUOTED = 9;
-
- private static final int CHARSET_DOUBLE_QUOTED = 10;
-
- private static final int CHARSET_UNQUOTED = 11;
-
- // end pseudo enums
-
- // [NOCPP[
-
- private final static String[] HTML4_PUBLIC_IDS = {
- "-//W3C//DTD HTML 4.0 Frameset//EN",
- "-//W3C//DTD HTML 4.0 Transitional//EN",
- "-//W3C//DTD HTML 4.0//EN", "-//W3C//DTD HTML 4.01 Frameset//EN",
- "-//W3C//DTD HTML 4.01 Transitional//EN",
- "-//W3C//DTD HTML 4.01//EN" };
-
- // ]NOCPP]
-
- @Literal private final static String[] QUIRKY_PUBLIC_IDS = {
- "+//silmaril//dtd html pro v0r11 19970101//",
- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
- "-//as//dtd html 3.0 aswedit + extensions//",
- "-//ietf//dtd html 2.0 level 1//",
- "-//ietf//dtd html 2.0 level 2//",
- "-//ietf//dtd html 2.0 strict level 1//",
- "-//ietf//dtd html 2.0 strict level 2//",
- "-//ietf//dtd html 2.0 strict//",
- "-//ietf//dtd html 2.0//",
- "-//ietf//dtd html 2.1e//",
- "-//ietf//dtd html 3.0//",
- "-//ietf//dtd html 3.2 final//",
- "-//ietf//dtd html 3.2//",
- "-//ietf//dtd html 3//",
- "-//ietf//dtd html level 0//",
- "-//ietf//dtd html level 1//",
- "-//ietf//dtd html level 2//",
- "-//ietf//dtd html level 3//",
- "-//ietf//dtd html strict level 0//",
- "-//ietf//dtd html strict level 1//",
- "-//ietf//dtd html strict level 2//",
- "-//ietf//dtd html strict level 3//",
- "-//ietf//dtd html strict//",
- "-//ietf//dtd html//",
- "-//metrius//dtd metrius presentational//",
- "-//microsoft//dtd internet explorer 2.0 html strict//",
- "-//microsoft//dtd internet explorer 2.0 html//",
- "-//microsoft//dtd internet explorer 2.0 tables//",
- "-//microsoft//dtd internet explorer 3.0 html strict//",
- "-//microsoft//dtd internet explorer 3.0 html//",
- "-//microsoft//dtd internet explorer 3.0 tables//",
- "-//netscape comm. corp.//dtd html//",
- "-//netscape comm. corp.//dtd strict html//",
- "-//o'reilly and associates//dtd html 2.0//",
- "-//o'reilly and associates//dtd html extended 1.0//",
- "-//o'reilly and associates//dtd html extended relaxed 1.0//",
- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
- "-//spyglass//dtd html 2.0 extended//",
- "-//sq//dtd html 2.0 hotmetal + extensions//",
- "-//sun microsystems corp.//dtd hotjava html//",
- "-//sun microsystems corp.//dtd hotjava strict html//",
- "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//",
- "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//",
- "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//",
- "-//w3c//dtd html 4.0 transitional//",
- "-//w3c//dtd html experimental 19960712//",
- "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//",
- "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//",
- "-//webtechs//dtd mozilla html//" };
-
- private static final int NOT_FOUND_ON_STACK = Integer.MAX_VALUE;
-
- // [NOCPP[
-
- private static final @Local String HTML_LOCAL = "html";
-
- // ]NOCPP]
-
- private int mode = INITIAL;
-
- private int originalMode = INITIAL;
-
- /**
- * Used only when moving back to IN_BODY.
- */
- private boolean framesetOk = true;
-
- protected Tokenizer tokenizer;
-
- // [NOCPP[
-
- protected ErrorHandler errorHandler;
-
- private DocumentModeHandler documentModeHandler;
-
- private DoctypeExpectation doctypeExpectation = DoctypeExpectation.HTML;
-
- private LocatorImpl firstCommentLocation;
-
- // ]NOCPP]
-
- private boolean scriptingEnabled = false;
-
- private boolean needToDropLF;
-
- // [NOCPP[
-
- private boolean wantingComments;
-
- // ]NOCPP]
-
- private boolean fragment;
-
- private @Local String contextName;
-
- private @NsUri String contextNamespace;
-
- private T contextNode;
-
- /**
- * Stack of template insertion modes
- */
- private @Auto int[] templateModeStack;
-
- /**
- * Current template mode stack pointer.
- */
- private int templateModePtr = -1;
-
- private @Auto StackNode<T>[] stack;
-
- private int currentPtr = -1;
-
- private @Auto StackNode<T>[] listOfActiveFormattingElements;
-
- private int listPtr = -1;
-
- private T formPointer;
-
- private T headPointer;
-
- /**
- * Used to work around Gecko limitations. Not used in Java.
- */
- private T deepTreeSurrogateParent;
-
- protected @Auto char[] charBuffer;
-
- protected int charBufferLen = 0;
-
- private boolean quirks = false;
-
- private boolean isSrcdocDocument = false;
-
- // [NOCPP[
-
- private boolean reportingDoctype = true;
-
- private XmlViolationPolicy namePolicy = XmlViolationPolicy.ALTER_INFOSET;
-
- private final Map<String, LocatorImpl> idLocations = new HashMap<String, LocatorImpl>();
-
- private boolean html4;
-
- // ]NOCPP]
-
- protected TreeBuilder() {
- fragment = false;
- }
-
- /**
- * Reports an condition that would make the infoset incompatible with XML
- * 1.0 as fatal.
- *
- * @throws SAXException
- * @throws SAXParseException
- */
- protected void fatal() throws SAXException {
- }
-
- // [NOCPP[
-
- protected final void fatal(Exception e) throws SAXException {
- SAXParseException spe = new SAXParseException(e.getMessage(),
- tokenizer, e);
- if (errorHandler != null) {
- errorHandler.fatalError(spe);
- }
- throw spe;
- }
-
- final void fatal(String s) throws SAXException {
- SAXParseException spe = new SAXParseException(s, tokenizer);
- if (errorHandler != null) {
- errorHandler.fatalError(spe);
- }
- throw spe;
- }
-
- /**
- * Reports a Parse Error.
- *
- * @param message
- * the message
- * @throws SAXException
- */
- final void err(String message) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck(message);
- }
-
- /**
- * Reports a Parse Error without checking if an error handler is present.
- *
- * @param message
- * the message
- * @throws SAXException
- */
- final void errNoCheck(String message) throws SAXException {
- SAXParseException spe = new SAXParseException(message, tokenizer);
- errorHandler.error(spe);
- }
-
- private void errListUnclosedStartTags(int eltPos) throws SAXException {
- if (currentPtr != -1) {
- for (int i = currentPtr; i > eltPos; i--) {
- reportUnclosedElementNameAndLocation(i);
- }
- }
- }
-
- /**
- * Reports the name and location of an unclosed element.
- *
- * @throws SAXException
- */
- private final void reportUnclosedElementNameAndLocation(int pos) throws SAXException {
- StackNode<T> node = stack[pos];
- if (node.isOptionalEndTag()) {
- return;
- }
- TaintableLocatorImpl locator = node.getLocator();
- if (locator.isTainted()) {
- return;
- }
- locator.markTainted();
- SAXParseException spe = new SAXParseException(
- "Unclosed element \u201C" + node.popName + "\u201D.", locator);
- errorHandler.error(spe);
- }
-
- /**
- * Reports a warning
- *
- * @param message
- * the message
- * @throws SAXException
- */
- final void warn(String message) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- SAXParseException spe = new SAXParseException(message, tokenizer);
- errorHandler.warning(spe);
- }
-
- /**
- * Reports a warning with an explicit locator
- *
- * @param message
- * the message
- * @throws SAXException
- */
- final void warn(String message, Locator locator) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- SAXParseException spe = new SAXParseException(message, locator);
- errorHandler.warning(spe);
- }
-
- // ]NOCPP]
-
- @SuppressWarnings("unchecked") public final void startTokenization(Tokenizer self) throws SAXException {
- tokenizer = self;
- stack = new StackNode[64];
- templateModeStack = new int[64];
- listOfActiveFormattingElements = new StackNode[64];
- needToDropLF = false;
- originalMode = INITIAL;
- templateModePtr = -1;
- currentPtr = -1;
- listPtr = -1;
- formPointer = null;
- headPointer = null;
- deepTreeSurrogateParent = null;
- // [NOCPP[
- html4 = false;
- idLocations.clear();
- wantingComments = wantsComments();
- firstCommentLocation = null;
- // ]NOCPP]
- start(fragment);
- charBufferLen = 0;
- charBuffer = null;
- framesetOk = true;
- if (fragment) {
- T elt;
- if (contextNode != null) {
- elt = contextNode;
- } else {
- elt = createHtmlElementSetAsRoot(tokenizer.emptyAttributes());
- }
- // When the context node is not in the HTML namespace, contrary
- // to the spec, the first node on the stack is not set to "html"
- // in the HTML namespace. Instead, it is set to a node that has
- // the characteristics of the appropriate "adjusted current node".
- // This way, there is no need to perform "adjusted current node"
- // checks during tree construction. Instead, it's sufficient to
- // just look at the current node. However, this also means that it
- // is not safe to treat "html" in the HTML namespace as a sentinel
- // that ends stack popping. Instead, stack popping loops that are
- // meant not to pop the first element on the stack need to check
- // for currentPos becoming zero.
- if (contextNamespace == "http://www.w3.org/2000/svg") {
- ElementName elementName = ElementName.SVG;
- if ("title" == contextName || "desc" == contextName
- || "foreignObject" == contextName) {
- // These elements are all alike and we don't care about
- // the exact name.
- elementName = ElementName.FOREIGNOBJECT;
- }
- // This is the SVG variant of the StackNode constructor.
- StackNode<T> node = new StackNode<T>(elementName,
- elementName.camelCaseName, elt
- // [NOCPP[
- , errorHandler == null ? null
- : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- currentPtr++;
- stack[currentPtr] = node;
- tokenizer.setState(Tokenizer.DATA);
- // The frameset-ok flag is set even though <frameset> never
- // ends up being allowed as HTML frameset in the fragment case.
- mode = FRAMESET_OK;
- } else if (contextNamespace == "http://www.w3.org/1998/Math/MathML") {
- ElementName elementName = ElementName.MATH;
- if ("mi" == contextName || "mo" == contextName
- || "mn" == contextName || "ms" == contextName
- || "mtext" == contextName) {
- // These elements are all alike and we don't care about
- // the exact name.
- elementName = ElementName.MTEXT;
- } else if ("annotation-xml" == contextName) {
- elementName = ElementName.ANNOTATION_XML;
- // Blink does not check the encoding attribute of the
- // annotation-xml element innerHTML is being set on.
- // Let's do the same at least until
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=26783
- // is resolved.
- }
- // This is the MathML variant of the StackNode constructor.
- StackNode<T> node = new StackNode<T>(elementName, elt,
- elementName.name, false
- // [NOCPP[
- , errorHandler == null ? null
- : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- currentPtr++;
- stack[currentPtr] = node;
- tokenizer.setState(Tokenizer.DATA);
- // The frameset-ok flag is set even though <frameset> never
- // ends up being allowed as HTML frameset in the fragment case.
- mode = FRAMESET_OK;
- } else { // html
- StackNode<T> node = new StackNode<T>(ElementName.HTML, elt
- // [NOCPP[
- , errorHandler == null ? null
- : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- currentPtr++;
- stack[currentPtr] = node;
- if ("template" == contextName) {
- pushTemplateMode(IN_TEMPLATE);
- }
- resetTheInsertionMode();
- formPointer = getFormPointerForContext(contextNode);
- if ("title" == contextName || "textarea" == contextName) {
- tokenizer.setState(Tokenizer.RCDATA);
- } else if ("style" == contextName || "xmp" == contextName
- || "iframe" == contextName || "noembed" == contextName
- || "noframes" == contextName
- || (scriptingEnabled && "noscript" == contextName)) {
- tokenizer.setState(Tokenizer.RAWTEXT);
- } else if ("plaintext" == contextName) {
- tokenizer.setState(Tokenizer.PLAINTEXT);
- } else if ("script" == contextName) {
- tokenizer.setState(Tokenizer.SCRIPT_DATA);
- } else {
- tokenizer.setState(Tokenizer.DATA);
- }
- }
- contextName = null;
- contextNode = null;
- } else {
- mode = INITIAL;
- // If we are viewing XML source, put a foreign element permanently
- // on the stack so that cdataSectionAllowed() returns true.
- // CPPONLY: if (tokenizer.isViewingXmlSource()) {
- // CPPONLY: T elt = createElement("http://www.w3.org/2000/svg",
- // CPPONLY: "svg",
- // CPPONLY: tokenizer.emptyAttributes(), null);
- // CPPONLY: StackNode<T> node = new StackNode<T>(ElementName.SVG,
- // CPPONLY: "svg",
- // CPPONLY: elt);
- // CPPONLY: currentPtr++;
- // CPPONLY: stack[currentPtr] = node;
- // CPPONLY: }
- }
- }
-
- public final void doctype(@Local String name, String publicIdentifier,
- String systemIdentifier, boolean forceQuirks) throws SAXException {
- needToDropLF = false;
- if (!isInForeign() && mode == INITIAL) {
- // [NOCPP[
- if (reportingDoctype) {
- // ]NOCPP]
- String emptyString = Portability.newEmptyString();
- appendDoctypeToDocument(name == null ? "" : name,
- publicIdentifier == null ? emptyString
- : publicIdentifier,
- systemIdentifier == null ? emptyString
- : systemIdentifier);
- Portability.releaseString(emptyString);
- // [NOCPP[
- }
- switch (doctypeExpectation) {
- case HTML:
- // ]NOCPP]
- if (isQuirky(name, publicIdentifier, systemIdentifier,
- forceQuirks)) {
- errQuirkyDoctype();
- documentModeInternal(DocumentMode.QUIRKS_MODE,
- publicIdentifier, systemIdentifier, false);
- } else if (isAlmostStandards(publicIdentifier,
- systemIdentifier)) {
- // [NOCPP[
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- // ]NOCPP]
- errAlmostStandardsDoctype();
- documentModeInternal(
- DocumentMode.ALMOST_STANDARDS_MODE,
- publicIdentifier, systemIdentifier, false);
- } else {
- // [NOCPP[
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- if ((Portability.literalEqualsString(
- "-//W3C//DTD HTML 4.0//EN", publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
- "http://www.w3.org/TR/REC-html40/strict.dtd",
- systemIdentifier)))
- || (Portability.literalEqualsString(
- "-//W3C//DTD HTML 4.01//EN",
- publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
- "http://www.w3.org/TR/html4/strict.dtd",
- systemIdentifier)))
- || (Portability.literalEqualsString(
- "-//W3C//DTD XHTML 1.0 Strict//EN",
- publicIdentifier) && Portability.literalEqualsString(
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd",
- systemIdentifier))
- || (Portability.literalEqualsString(
- "-//W3C//DTD XHTML 1.1//EN",
- publicIdentifier) && Portability.literalEqualsString(
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd",
- systemIdentifier))
-
- ) {
- warn("Obsolete doctype. Expected \u201C<!DOCTYPE html>\u201D.");
- } else if (!((systemIdentifier == null || Portability.literalEqualsString(
- "about:legacy-compat", systemIdentifier)) && publicIdentifier == null)) {
- err("Legacy doctype. Expected \u201C<!DOCTYPE html>\u201D.");
- }
- // ]NOCPP]
- documentModeInternal(DocumentMode.STANDARDS_MODE,
- publicIdentifier, systemIdentifier, false);
- }
- // [NOCPP[
- break;
- case HTML401_STRICT:
- html4 = true;
- tokenizer.turnOnAdditionalHtml4Errors();
- if (isQuirky(name, publicIdentifier, systemIdentifier,
- forceQuirks)) {
- err("Quirky doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- documentModeInternal(DocumentMode.QUIRKS_MODE,
- publicIdentifier, systemIdentifier, true);
- } else if (isAlmostStandards(publicIdentifier,
- systemIdentifier)) {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- err("Almost standards mode doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- documentModeInternal(
- DocumentMode.ALMOST_STANDARDS_MODE,
- publicIdentifier, systemIdentifier, true);
- } else {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
- if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- }
- } else {
- err("The doctype was not the HTML 4.01 Strict doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- }
- documentModeInternal(DocumentMode.STANDARDS_MODE,
- publicIdentifier, systemIdentifier, true);
- }
- break;
- case HTML401_TRANSITIONAL:
- html4 = true;
- tokenizer.turnOnAdditionalHtml4Errors();
- if (isQuirky(name, publicIdentifier, systemIdentifier,
- forceQuirks)) {
- err("Quirky doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- documentModeInternal(DocumentMode.QUIRKS_MODE,
- publicIdentifier, systemIdentifier, true);
- } else if (isAlmostStandards(publicIdentifier,
- systemIdentifier)) {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicIdentifier)
- && systemIdentifier != null) {
- if (!"http://www.w3.org/TR/html4/loose.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- }
- } else {
- err("The doctype was not a non-quirky HTML 4.01 Transitional doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- }
- documentModeInternal(
- DocumentMode.ALMOST_STANDARDS_MODE,
- publicIdentifier, systemIdentifier, true);
- } else {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- err("The doctype was not the HTML 4.01 Transitional doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- documentModeInternal(DocumentMode.STANDARDS_MODE,
- publicIdentifier, systemIdentifier, true);
- }
- break;
- case AUTO:
- html4 = isHtml4Doctype(publicIdentifier);
- if (html4) {
- tokenizer.turnOnAdditionalHtml4Errors();
- }
- if (isQuirky(name, publicIdentifier, systemIdentifier,
- forceQuirks)) {
- err("Quirky doctype. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- documentModeInternal(DocumentMode.QUIRKS_MODE,
- publicIdentifier, systemIdentifier, html4);
- } else if (isAlmostStandards(publicIdentifier,
- systemIdentifier)) {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicIdentifier)) {
- if (!"http://www.w3.org/TR/html4/loose.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- }
- } else {
- err("Almost standards mode doctype. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- }
- documentModeInternal(
- DocumentMode.ALMOST_STANDARDS_MODE,
- publicIdentifier, systemIdentifier, html4);
- } else {
- if (firstCommentLocation != null) {
- warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.",
- firstCommentLocation);
- }
- if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
- if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- }
- } else if ("-//W3C//DTD XHTML 1.0 Strict//EN".equals(publicIdentifier)) {
- if (!"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the XHTML 1.0 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\u201D.");
- }
- } else if ("//W3C//DTD XHTML 1.1//EN".equals(publicIdentifier)) {
- if (!"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd".equals(systemIdentifier)) {
- warn("The doctype did not contain the system identifier prescribed by the XHTML 1.1 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\u201D.");
- }
- } else if (!((systemIdentifier == null || Portability.literalEqualsString(
- "about:legacy-compat", systemIdentifier)) && publicIdentifier == null)) {
- err("Unexpected doctype. Expected, e.g., \u201C<!DOCTYPE html>\u201D.");
- }
- documentModeInternal(DocumentMode.STANDARDS_MODE,
- publicIdentifier, systemIdentifier, html4);
- }
- break;
- case NO_DOCTYPE_ERRORS:
- if (isQuirky(name, publicIdentifier, systemIdentifier,
- forceQuirks)) {
- documentModeInternal(DocumentMode.QUIRKS_MODE,
- publicIdentifier, systemIdentifier, false);
- } else if (isAlmostStandards(publicIdentifier,
- systemIdentifier)) {
- documentModeInternal(
- DocumentMode.ALMOST_STANDARDS_MODE,
- publicIdentifier, systemIdentifier, false);
- } else {
- documentModeInternal(DocumentMode.STANDARDS_MODE,
- publicIdentifier, systemIdentifier, false);
- }
- break;
- }
- // ]NOCPP]
-
- /*
- *
- * Then, switch to the root element mode of the tree construction
- * stage.
- */
- mode = BEFORE_HTML;
- return;
- }
- /*
- * A DOCTYPE token Parse error.
- */
- errStrayDoctype();
- /*
- * Ignore the token.
- */
- return;
- }
-
- // [NOCPP[
-
- private boolean isHtml4Doctype(String publicIdentifier) {
- if (publicIdentifier != null
- && (Arrays.binarySearch(TreeBuilder.HTML4_PUBLIC_IDS,
- publicIdentifier) > -1)) {
- return true;
- }
- return false;
- }
-
- // ]NOCPP]
-
- public final void comment(@NoLength char[] buf, int start, int length)
- throws SAXException {
- needToDropLF = false;
- // [NOCPP[
- if (firstCommentLocation == null) {
- firstCommentLocation = new LocatorImpl(tokenizer);
- }
- if (!wantingComments) {
- return;
- }
- // ]NOCPP]
- if (!isInForeign()) {
- switch (mode) {
- case INITIAL:
- case BEFORE_HTML:
- case AFTER_AFTER_BODY:
- case AFTER_AFTER_FRAMESET:
- /*
- * A comment token Append a Comment node to the Document
- * object with the data attribute set to the data given in
- * the comment token.
- */
- appendCommentToDocument(buf, start, length);
- return;
- case AFTER_BODY:
- /*
- * A comment token Append a Comment node to the first
- * element in the stack of open elements (the html element),
- * with the data attribute set to the data given in the
- * comment token.
- */
- flushCharacters();
- appendComment(stack[0].node, buf, start, length);
- return;
- default:
- break;
- }
- }
- /*
- * A comment token Append a Comment node to the current node with the
- * data attribute set to the data given in the comment token.
- */
- flushCharacters();
- appendComment(stack[currentPtr].node, buf, start, length);
- return;
- }
-
- /**
- * @see nu.validator.htmlparser.common.TokenHandler#characters(char[], int,
- * int)
- */
- public final void characters(@Const @NoLength char[] buf, int start, int length)
- throws SAXException {
- // Note: Can't attach error messages to EOF in C++ yet
-
- // CPPONLY: if (tokenizer.isViewingXmlSource()) {
- // CPPONLY: return;
- // CPPONLY: }
- if (needToDropLF) {
- needToDropLF = false;
- if (buf[start] == '\n') {
- start++;
- length--;
- if (length == 0) {
- return;
- }
- }
- }
-
- // optimize the most common case
- switch (mode) {
- case IN_BODY:
- case IN_CELL:
- case IN_CAPTION:
- if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
- reconstructTheActiveFormattingElements();
- }
- // fall through
- case TEXT:
- accumulateCharacters(buf, start, length);
- return;
- case IN_TABLE:
- case IN_TABLE_BODY:
- case IN_ROW:
- accumulateCharactersForced(buf, start, length);
- return;
- default:
- int end = start + length;
- charactersloop: for (int i = start; i < end; i++) {
- switch (buf[i]) {
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- case '\u000C':
- /*
- * A character token that is one of one of U+0009
- * CHARACTER TABULATION, U+000A LINE FEED (LF),
- * U+000C FORM FEED (FF), or U+0020 SPACE
- */
- switch (mode) {
- case INITIAL:
- case BEFORE_HTML:
- case BEFORE_HEAD:
- /*
- * Ignore the token.
- */
- start = i + 1;
- continue;
- case IN_HEAD:
- case IN_HEAD_NOSCRIPT:
- case AFTER_HEAD:
- case IN_COLUMN_GROUP:
- case IN_FRAMESET:
- case AFTER_FRAMESET:
- /*
- * Append the character to the current node.
- */
- continue;
- case FRAMESET_OK:
- case IN_TEMPLATE:
- case IN_BODY:
- case IN_CELL:
- case IN_CAPTION:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
-
- /*
- * Reconstruct the active formatting
- * elements, if any.
- */
- if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
- flushCharacters();
- reconstructTheActiveFormattingElements();
- }
- /*
- * Append the token's character to the
- * current node.
- */
- break charactersloop;
- case IN_SELECT:
- case IN_SELECT_IN_TABLE:
- break charactersloop;
- case IN_TABLE:
- case IN_TABLE_BODY:
- case IN_ROW:
- accumulateCharactersForced(buf, i, 1);
- start = i + 1;
- continue;
- case AFTER_BODY:
- case AFTER_AFTER_BODY:
- case AFTER_AFTER_FRAMESET:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Reconstruct the active formatting
- * elements, if any.
- */
- flushCharacters();
- reconstructTheActiveFormattingElements();
- /*
- * Append the token's character to the
- * current node.
- */
- continue;
- }
- default:
- /*
- * A character token that is not one of one of
- * U+0009 CHARACTER TABULATION, U+000A LINE FEED
- * (LF), U+000C FORM FEED (FF), or U+0020 SPACE
- */
- switch (mode) {
- case INITIAL:
- /*
- * Parse error.
- */
- // [NOCPP[
- switch (doctypeExpectation) {
- case AUTO:
- err("Non-space characters found without seeing a doctype first. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML:
- // XXX figure out a way to report this in the Gecko View Source case
- err("Non-space characters found without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML401_STRICT:
- err("Non-space characters found without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- break;
- case HTML401_TRANSITIONAL:
- err("Non-space characters found without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- break;
- case NO_DOCTYPE_ERRORS:
- }
- // ]NOCPP]
- /*
- *
- * Set the document to quirks mode.
- */
- documentModeInternal(
- DocumentMode.QUIRKS_MODE, null,
- null, false);
- /*
- * Then, switch to the root element mode of
- * the tree construction stage
- */
- mode = BEFORE_HTML;
- /*
- * and reprocess the current token.
- */
- i--;
- continue;
- case BEFORE_HTML:
- /*
- * Create an HTMLElement node with the tag
- * name html, in the HTML namespace. Append
- * it to the Document object.
- */
- // No need to flush characters here,
- // because there's nothing to flush.
- appendHtmlElementToDocumentAndPush();
- /* Switch to the main mode */
- mode = BEFORE_HEAD;
- /*
- * reprocess the current token.
- */
- i--;
- continue;
- case BEFORE_HEAD:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * /Act as if a start tag token with the tag
- * name "head" and no attributes had been
- * seen,
- */
- flushCharacters();
- appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_HEAD;
- /*
- * then reprocess the current token.
- *
- * This will result in an empty head element
- * being generated, with the current token
- * being reprocessed in the "after head"
- * insertion mode.
- */
- i--;
- continue;
- case IN_HEAD:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Act as if an end tag token with the tag
- * name "head" had been seen,
- */
- flushCharacters();
- pop();
- mode = AFTER_HEAD;
- /*
- * and reprocess the current token.
- */
- i--;
- continue;
- case IN_HEAD_NOSCRIPT:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Parse error. Act as if an end tag with
- * the tag name "noscript" had been seen
- */
- errNonSpaceInNoscriptInHead();
- flushCharacters();
- pop();
- mode = IN_HEAD;
- /*
- * and reprocess the current token.
- */
- i--;
- continue;
- case AFTER_HEAD:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Act as if a start tag token with the tag
- * name "body" and no attributes had been
- * seen,
- */
- flushCharacters();
- appendToCurrentNodeAndPushBodyElement();
- mode = FRAMESET_OK;
- /*
- * and then reprocess the current token.
- */
- i--;
- continue;
- case FRAMESET_OK:
- framesetOk = false;
- mode = IN_BODY;
- i--;
- continue;
- case IN_TEMPLATE:
- case IN_BODY:
- case IN_CELL:
- case IN_CAPTION:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Reconstruct the active formatting
- * elements, if any.
- */
- if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
- flushCharacters();
- reconstructTheActiveFormattingElements();
- }
- /*
- * Append the token's character to the
- * current node.
- */
- break charactersloop;
- case IN_TABLE:
- case IN_TABLE_BODY:
- case IN_ROW:
- accumulateCharactersForced(buf, i, 1);
- start = i + 1;
- continue;
- case IN_COLUMN_GROUP:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- start = i;
- }
- /*
- * Act as if an end tag with the tag name
- * "colgroup" had been seen, and then, if
- * that token wasn't ignored, reprocess the
- * current token.
- */
- if (currentPtr == 0 || stack[currentPtr].getGroup() ==
- TreeBuilder.TEMPLATE) {
- errNonSpaceInColgroupInFragment();
- start = i + 1;
- continue;
- }
- flushCharacters();
- pop();
- mode = IN_TABLE;
- i--;
- continue;
- case IN_SELECT:
- case IN_SELECT_IN_TABLE:
- break charactersloop;
- case AFTER_BODY:
- errNonSpaceAfterBody();
- fatal();
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- i--;
- continue;
- case IN_FRAMESET:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- // start index is adjusted below.
- }
- /*
- * Parse error.
- */
- errNonSpaceInFrameset();
- /*
- * Ignore the token.
- */
- start = i + 1;
- continue;
- case AFTER_FRAMESET:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- // start index is adjusted below.
- }
- /*
- * Parse error.
- */
- errNonSpaceAfterFrameset();
- /*
- * Ignore the token.
- */
- start = i + 1;
- continue;
- case AFTER_AFTER_BODY:
- /*
- * Parse error.
- */
- errNonSpaceInTrailer();
- /*
- * Switch back to the main mode and
- * reprocess the token.
- */
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- i--;
- continue;
- case AFTER_AFTER_FRAMESET:
- if (start < i) {
- accumulateCharacters(buf, start, i
- - start);
- // start index is adjusted below.
- }
- /*
- * Parse error.
- */
- errNonSpaceInTrailer();
- /*
- * Ignore the token.
- */
- start = i + 1;
- continue;
- }
- }
- }
- if (start < end) {
- accumulateCharacters(buf, start, end - start);
- }
- }
- }
-
- /**
- * @see nu.validator.htmlparser.common.TokenHandler#zeroOriginatingReplacementCharacter()
- */
- public void zeroOriginatingReplacementCharacter() throws SAXException {
- if (mode == TEXT) {
- accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
- return;
- }
- if (currentPtr >= 0) {
- if (isSpecialParentInForeign(stack[currentPtr])) {
- return;
- }
- accumulateCharacters(REPLACEMENT_CHARACTER, 0, 1);
- }
- }
-
- public final void eof() throws SAXException {
- flushCharacters();
- // Note: Can't attach error messages to EOF in C++ yet
- eofloop: for (;;) {
- switch (mode) {
- case INITIAL:
- /*
- * Parse error.
- */
- // [NOCPP[
- switch (doctypeExpectation) {
- case AUTO:
- err("End of file seen without seeing a doctype first. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML:
- err("End of file seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML401_STRICT:
- err("End of file seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- break;
- case HTML401_TRANSITIONAL:
- err("End of file seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- break;
- case NO_DOCTYPE_ERRORS:
- }
- // ]NOCPP]
- /*
- *
- * Set the document to quirks mode.
- */
- documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
- false);
- /*
- * Then, switch to the root element mode of the tree
- * construction stage
- */
- mode = BEFORE_HTML;
- /*
- * and reprocess the current token.
- */
- continue;
- case BEFORE_HTML:
- /*
- * Create an HTMLElement node with the tag name html, in the
- * HTML namespace. Append it to the Document object.
- */
- appendHtmlElementToDocumentAndPush();
- // XXX application cache manifest
- /* Switch to the main mode */
- mode = BEFORE_HEAD;
- /*
- * reprocess the current token.
- */
- continue;
- case BEFORE_HEAD:
- appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_HEAD;
- continue;
- case IN_HEAD:
- // [NOCPP[
- if (errorHandler != null && currentPtr > 1) {
- errEofWithUnclosedElements();
- }
- // ]NOCPP]
- while (currentPtr > 0) {
- popOnEof();
- }
- mode = AFTER_HEAD;
- continue;
- case IN_HEAD_NOSCRIPT:
- // [NOCPP[
- errEofWithUnclosedElements();
- // ]NOCPP]
- while (currentPtr > 1) {
- popOnEof();
- }
- mode = IN_HEAD;
- continue;
- case AFTER_HEAD:
- appendToCurrentNodeAndPushBodyElement();
- mode = IN_BODY;
- continue;
- case IN_TABLE_BODY:
- case IN_ROW:
- case IN_TABLE:
- case IN_SELECT_IN_TABLE:
- case IN_SELECT:
- case IN_COLUMN_GROUP:
- case FRAMESET_OK:
- case IN_CAPTION:
- case IN_CELL:
- case IN_BODY:
- // [NOCPP[
- // i > 0 to stop in time in the foreign fragment case.
- openelementloop: for (int i = currentPtr; i > 0; i--) {
- int group = stack[i].getGroup();
- switch (group) {
- case DD_OR_DT:
- case LI:
- case P:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TD_OR_TH:
- case BODY:
- case HTML:
- break;
- default:
- errEofWithUnclosedElements();
- break openelementloop;
- }
- }
- // ]NOCPP]
-
- if (isTemplateModeStackEmpty()) {
- break eofloop;
- }
-
- // fall through to IN_TEMPLATE
- case IN_TEMPLATE:
- int eltPos = findLast("template");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- break eofloop;
- }
- if (errorHandler != null) {
- errUnclosedElements(eltPos, "template");
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- popTemplateMode();
- resetTheInsertionMode();
-
- // Reprocess token.
- continue;
- case TEXT:
- // [NOCPP[
- if (errorHandler != null) {
- errNoCheck("End of file seen when expecting text or an end tag.");
- errListUnclosedStartTags(0);
- }
- // ]NOCPP]
- // XXX mark script as already executed
- if (originalMode == AFTER_HEAD) {
- popOnEof();
- }
- popOnEof();
- mode = originalMode;
- continue;
- case IN_FRAMESET:
- // [NOCPP[
- if (errorHandler != null && currentPtr > 0) {
- errEofWithUnclosedElements();
- }
- // ]NOCPP]
- break eofloop;
- case AFTER_BODY:
- case AFTER_FRAMESET:
- case AFTER_AFTER_BODY:
- case AFTER_AFTER_FRAMESET:
- default:
- // [NOCPP[
- if (currentPtr == 0) { // This silliness is here to poison
- // buggy compiler optimizations in
- // GWT
- System.currentTimeMillis();
- }
- // ]NOCPP]
- break eofloop;
- }
- }
- while (currentPtr > 0) {
- popOnEof();
- }
- if (!fragment) {
- popOnEof();
- }
- /* Stop parsing. */
- }
-
- /**
- * @see nu.validator.htmlparser.common.TokenHandler#endTokenization()
- */
- public final void endTokenization() throws SAXException {
- formPointer = null;
- headPointer = null;
- deepTreeSurrogateParent = null;
- templateModeStack = null;
- if (stack != null) {
- while (currentPtr > -1) {
- stack[currentPtr].release();
- currentPtr--;
- }
- stack = null;
- }
- if (listOfActiveFormattingElements != null) {
- while (listPtr > -1) {
- if (listOfActiveFormattingElements[listPtr] != null) {
- listOfActiveFormattingElements[listPtr].release();
- }
- listPtr--;
- }
- listOfActiveFormattingElements = null;
- }
- // [NOCPP[
- idLocations.clear();
- // ]NOCPP]
- charBuffer = null;
- end();
- }
-
- public final void startTag(ElementName elementName,
- HtmlAttributes attributes, boolean selfClosing) throws SAXException {
- flushCharacters();
-
- // [NOCPP[
- if (errorHandler != null) {
- // ID uniqueness
- @IdType String id = attributes.getId();
- if (id != null) {
- LocatorImpl oldLoc = idLocations.get(id);
- if (oldLoc != null) {
- err("Duplicate ID \u201C" + id + "\u201D.");
- errorHandler.warning(new SAXParseException(
- "The first occurrence of ID \u201C" + id
- + "\u201D was here.", oldLoc));
- } else {
- idLocations.put(id, new LocatorImpl(tokenizer));
- }
- }
- }
- // ]NOCPP]
-
- int eltPos;
- needToDropLF = false;
- starttagloop: for (;;) {
- int group = elementName.getGroup();
- @Local String name = elementName.name;
- if (isInForeign()) {
- StackNode<T> currentNode = stack[currentPtr];
- @NsUri String currNs = currentNode.ns;
- if (!(currentNode.isHtmlIntegrationPoint() || (currNs == "http://www.w3.org/1998/Math/MathML" && ((currentNode.getGroup() == MI_MO_MN_MS_MTEXT && group != MGLYPH_OR_MALIGNMARK) || (currentNode.getGroup() == ANNOTATION_XML && group == SVG))))) {
- switch (group) {
- case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
- case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
- case BODY:
- case BR:
- case RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR:
- case DD_OR_DT:
- case UL_OR_OL_OR_DL:
- case EMBED:
- case IMG:
- case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
- case HEAD:
- case HR:
- case LI:
- case META:
- case NOBR:
- case P:
- case PRE_OR_LISTING:
- case TABLE:
- case FONT:
- // re-check FONT to deal with the special case
- if (!(group == FONT && !(attributes.contains(AttributeName.COLOR)
- || attributes.contains(AttributeName.FACE) || attributes.contains(AttributeName.SIZE)))) {
- errHtmlStartTagInForeignContext(name);
- if (!fragment) {
- while (!isSpecialParentInForeign(stack[currentPtr])) {
- pop();
- }
- continue starttagloop;
- } // else fall thru
- }
- // else fall thru
- default:
- if ("http://www.w3.org/2000/svg" == currNs) {
- attributes.adjustForSvg();
- if (selfClosing) {
- appendVoidElementToCurrentMayFosterSVG(
- elementName, attributes);
- selfClosing = false;
- } else {
- appendToCurrentNodeAndPushElementMayFosterSVG(
- elementName, attributes);
- }
- attributes = null; // CPP
- break starttagloop;
- } else {
- attributes.adjustForMath();
- if (selfClosing) {
- appendVoidElementToCurrentMayFosterMathML(
- elementName, attributes);
- selfClosing = false;
- } else {
- appendToCurrentNodeAndPushElementMayFosterMathML(
- elementName, attributes);
- }
- attributes = null; // CPP
- break starttagloop;
- }
- } // switch
- } // foreignObject / annotation-xml
- }
- switch (mode) {
- case IN_TEMPLATE:
- switch (group) {
- case COL:
- popTemplateMode();
- pushTemplateMode(IN_COLUMN_GROUP);
- mode = IN_COLUMN_GROUP;
- // Reprocess token.
- continue;
- case CAPTION:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- popTemplateMode();
- pushTemplateMode(IN_TABLE);
- mode = IN_TABLE;
- // Reprocess token.
- continue;
- case TR:
- popTemplateMode();
- pushTemplateMode(IN_TABLE_BODY);
- mode = IN_TABLE_BODY;
- // Reprocess token.
- continue;
- case TD_OR_TH:
- popTemplateMode();
- pushTemplateMode(IN_ROW);
- mode = IN_ROW;
- // Reprocess token.
- continue;
- case META:
- checkMetaCharset(attributes);
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case TITLE:
- startTagTitleInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case BASE:
- case LINK_OR_BASEFONT_OR_BGSOUND:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case SCRIPT:
- startTagScriptInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case NOFRAMES:
- case STYLE:
- startTagGenericRawText(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case TEMPLATE:
- startTagTemplateInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- default:
- popTemplateMode();
- pushTemplateMode(IN_BODY);
- mode = IN_BODY;
- // Reprocess token.
- continue;
- }
- case IN_ROW:
- switch (group) {
- case TD_OR_TH:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TR));
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_CELL;
- insertMarker();
- attributes = null; // CPP
- break starttagloop;
- case CAPTION:
- case COL:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- eltPos = findLastOrRoot(TreeBuilder.TR);
- if (eltPos == 0) {
- assert fragment || isTemplateContents();
- errNoTableRowToClose();
- break starttagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE_BODY;
- continue;
- default:
- // fall through to IN_TABLE
- }
- case IN_TABLE_BODY:
- switch (group) {
- case TR:
- clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_ROW;
- attributes = null; // CPP
- break starttagloop;
- case TD_OR_TH:
- errStartTagInTableBody(name);
- clearStackBackTo(findLastInTableScopeOrRootTemplateTbodyTheadTfoot());
- appendToCurrentNodeAndPushElement(
- ElementName.TR,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_ROW;
- continue;
- case CAPTION:
- case COL:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
- if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
- assert fragment || isTemplateContents();
- errStrayStartTag(name);
- break starttagloop;
- } else {
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE;
- continue;
- }
- default:
- // fall through to IN_TABLE
- }
- case IN_TABLE:
- intableloop: for (;;) {
- switch (group) {
- case CAPTION:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
- insertMarker();
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_CAPTION;
- attributes = null; // CPP
- break starttagloop;
- case COLGROUP:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_COLUMN_GROUP;
- attributes = null; // CPP
- break starttagloop;
- case COL:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
- appendToCurrentNodeAndPushElement(
- ElementName.COLGROUP,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_COLUMN_GROUP;
- continue starttagloop;
- case TBODY_OR_THEAD_OR_TFOOT:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_TABLE_BODY;
- attributes = null; // CPP
- break starttagloop;
- case TR:
- case TD_OR_TH:
- clearStackBackTo(findLastOrRoot(TreeBuilder.TABLE));
- appendToCurrentNodeAndPushElement(
- ElementName.TBODY,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_TABLE_BODY;
- continue starttagloop;
- case TEMPLATE:
- // fall through to IN_HEAD
- break intableloop;
- case TABLE:
- errTableSeenWhileTableOpen();
- eltPos = findLastInTableScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment || isTemplateContents();
- break starttagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent("table")) {
- errNoCheckUnclosedElementsOnStack();
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- continue starttagloop;
- case SCRIPT:
- // XXX need to manage much more stuff
- // here if
- // supporting
- // document.write()
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.SCRIPT_DATA, elementName);
- attributes = null; // CPP
- break starttagloop;
- case STYLE:
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- case INPUT:
- errStartTagInTable(name);
- if (!Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "hidden",
- attributes.getValue(AttributeName.TYPE))) {
- break intableloop;
- }
- appendVoidElementToCurrent(
- name, attributes,
- formPointer);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case FORM:
- if (formPointer != null || isTemplateContents()) {
- errFormWhenFormOpen();
- break starttagloop;
- } else {
- errStartTagInTable(name);
- appendVoidFormToCurrent(attributes);
- attributes = null; // CPP
- break starttagloop;
- }
- default:
- errStartTagInTable(name);
- // fall through to IN_BODY
- break intableloop;
- }
- }
- case IN_CAPTION:
- switch (group) {
- case CAPTION:
- case COL:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- case TD_OR_TH:
- errStrayStartTag(name);
- eltPos = findLastInTableScope("caption");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- break starttagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && currentPtr != eltPos) {
- errNoCheckUnclosedElementsOnStack();
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- mode = IN_TABLE;
- continue;
- default:
- // fall through to IN_BODY
- }
- case IN_CELL:
- switch (group) {
- case CAPTION:
- case COL:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- case TD_OR_TH:
- eltPos = findLastInTableScopeTdTh();
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errNoCellToClose();
- break starttagloop;
- } else {
- closeTheCell(eltPos);
- continue;
- }
- default:
- // fall through to IN_BODY
- }
- case FRAMESET_OK:
- switch (group) {
- case FRAMESET:
- if (mode == FRAMESET_OK) {
- if (currentPtr == 0 || stack[1].getGroup() != BODY) {
- assert fragment || isTemplateContents();
- errStrayStartTag(name);
- break starttagloop;
- } else {
- errFramesetStart();
- detachFromParent(stack[1].node);
- while (currentPtr > 0) {
- pop();
- }
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_FRAMESET;
- attributes = null; // CPP
- break starttagloop;
- }
- } else {
- errStrayStartTag(name);
- break starttagloop;
- }
- // NOT falling through!
- case PRE_OR_LISTING:
- case LI:
- case DD_OR_DT:
- case BUTTON:
- case MARQUEE_OR_APPLET:
- case OBJECT:
- case TABLE:
- case AREA_OR_WBR:
- case BR:
- case EMBED:
- case IMG:
- case INPUT:
- case KEYGEN:
- case HR:
- case TEXTAREA:
- case XMP:
- case IFRAME:
- case SELECT:
- if (mode == FRAMESET_OK
- && !(group == INPUT && Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "hidden",
- attributes.getValue(AttributeName.TYPE)))) {
- framesetOk = false;
- mode = IN_BODY;
- }
- // fall through to IN_BODY
- default:
- // fall through to IN_BODY
- }
- case IN_BODY:
- inbodyloop: for (;;) {
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case BASE:
- case LINK_OR_BASEFONT_OR_BGSOUND:
- case META:
- case STYLE:
- case SCRIPT:
- case TITLE:
- case TEMPLATE:
- // Fall through to IN_HEAD
- break inbodyloop;
- case BODY:
- if (currentPtr == 0 || stack[1].getGroup() != BODY || isTemplateContents()) {
- assert fragment || isTemplateContents();
- errStrayStartTag(name);
- break starttagloop;
- }
- errFooSeenWhenFooOpen(name);
- framesetOk = false;
- if (mode == FRAMESET_OK) {
- mode = IN_BODY;
- }
- if (addAttributesToBody(attributes)) {
- attributes = null; // CPP
- }
- break starttagloop;
- case P:
- case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
- case UL_OR_OL_OR_DL:
- case ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
- implicitlyCloseP();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
- implicitlyCloseP();
- if (stack[currentPtr].getGroup() == H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) {
- errHeadingWhenHeadingOpen();
- pop();
- }
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case FIELDSET:
- implicitlyCloseP();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- attributes = null; // CPP
- break starttagloop;
- case PRE_OR_LISTING:
- implicitlyCloseP();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- needToDropLF = true;
- attributes = null; // CPP
- break starttagloop;
- case FORM:
- if (formPointer != null && !isTemplateContents()) {
- errFormWhenFormOpen();
- break starttagloop;
- } else {
- implicitlyCloseP();
- appendToCurrentNodeAndPushFormElementMayFoster(attributes);
- attributes = null; // CPP
- break starttagloop;
- }
- case LI:
- case DD_OR_DT:
- eltPos = currentPtr;
- for (;;) {
- StackNode<T> node = stack[eltPos]; // weak
- // ref
- if (node.getGroup() == group) { // LI or
- // DD_OR_DT
- generateImpliedEndTagsExceptFor(node.name);
- if (errorHandler != null
- && eltPos != currentPtr) {
- errUnclosedElementsImplied(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- break;
- } else if (eltPos == 0 || (node.isSpecial()
- && (node.ns != "http://www.w3.org/1999/xhtml"
- || (node.name != "p"
- && node.name != "address"
- && node.name != "div")))) {
- break;
- }
- eltPos--;
- }
- implicitlyCloseP();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case PLAINTEXT:
- implicitlyCloseP();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.PLAINTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- case A:
- int activeAPos = findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker("a");
- if (activeAPos != -1) {
- errFooSeenWhenFooOpen(name);
- StackNode<T> activeA = listOfActiveFormattingElements[activeAPos];
- activeA.retain();
- adoptionAgencyEndTag("a");
- removeFromStack(activeA);
- activeAPos = findInListOfActiveFormattingElements(activeA);
- if (activeAPos != -1) {
- removeFromListOfActiveFormattingElements(activeAPos);
- }
- activeA.release();
- }
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushFormattingElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
- case FONT:
- reconstructTheActiveFormattingElements();
- maybeForgetEarlierDuplicateFormattingElement(elementName.name, attributes);
- appendToCurrentNodeAndPushFormattingElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case NOBR:
- reconstructTheActiveFormattingElements();
- if (TreeBuilder.NOT_FOUND_ON_STACK != findLastInScope("nobr")) {
- errFooSeenWhenFooOpen(name);
- adoptionAgencyEndTag("nobr");
- reconstructTheActiveFormattingElements();
- }
- appendToCurrentNodeAndPushFormattingElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case BUTTON:
- eltPos = findLastInScope(name);
- if (eltPos != TreeBuilder.NOT_FOUND_ON_STACK) {
- errFooSeenWhenFooOpen(name);
- generateImpliedEndTags();
- if (errorHandler != null
- && !isCurrent(name)) {
- errUnclosedElementsImplied(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- continue starttagloop;
- } else {
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- attributes = null; // CPP
- break starttagloop;
- }
- case OBJECT:
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- insertMarker();
- attributes = null; // CPP
- break starttagloop;
- case MARQUEE_OR_APPLET:
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- insertMarker();
- attributes = null; // CPP
- break starttagloop;
- case TABLE:
- // The only quirk. Blame Hixie and
- // Acid2.
- if (!quirks) {
- implicitlyCloseP();
- }
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- mode = IN_TABLE;
- attributes = null; // CPP
- break starttagloop;
- case BR:
- case EMBED:
- case AREA_OR_WBR:
- reconstructTheActiveFormattingElements();
- // FALL THROUGH to PARAM_OR_SOURCE_OR_TRACK
- // CPPONLY: case MENUITEM:
- case PARAM_OR_SOURCE_OR_TRACK:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case HR:
- implicitlyCloseP();
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case IMAGE:
- errImage();
- elementName = ElementName.IMG;
- continue starttagloop;
- case IMG:
- case KEYGEN:
- case INPUT:
- reconstructTheActiveFormattingElements();
- appendVoidElementToCurrentMayFoster(
- name, attributes,
- formPointer);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case ISINDEX:
- errIsindex();
- if (formPointer != null && !isTemplateContents()) {
- break starttagloop;
- }
- implicitlyCloseP();
- HtmlAttributes formAttrs = new HtmlAttributes(0);
- int actionIndex = attributes.getIndex(AttributeName.ACTION);
- if (actionIndex > -1) {
- formAttrs.addAttribute(
- AttributeName.ACTION,
- attributes.getValueNoBoundsCheck(actionIndex)
- // [NOCPP[
- , XmlViolationPolicy.ALLOW
- // ]NOCPP]
- // CPPONLY: , attributes.getLineNoBoundsCheck(actionIndex)
- );
- }
- appendToCurrentNodeAndPushFormElementMayFoster(formAttrs);
- appendVoidElementToCurrentMayFoster(
- ElementName.HR,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- appendToCurrentNodeAndPushElementMayFoster(
- ElementName.LABEL,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- int promptIndex = attributes.getIndex(AttributeName.PROMPT);
- if (promptIndex > -1) {
- @Auto char[] prompt = Portability.newCharArrayFromString(attributes.getValueNoBoundsCheck(promptIndex));
- appendCharacters(stack[currentPtr].node,
- prompt, 0, prompt.length);
- } else {
- appendIsindexPrompt(stack[currentPtr].node);
- }
- HtmlAttributes inputAttributes = new HtmlAttributes(
- 0);
- inputAttributes.addAttribute(
- AttributeName.NAME,
- Portability.newStringFromLiteral("isindex")
- // [NOCPP[
- , XmlViolationPolicy.ALLOW
- // ]NOCPP]
- // CPPONLY: , tokenizer.getLineNumber()
- );
- for (int i = 0; i < attributes.getLength(); i++) {
- AttributeName attributeQName = attributes.getAttributeNameNoBoundsCheck(i);
- if (AttributeName.NAME == attributeQName
- || AttributeName.PROMPT == attributeQName) {
- attributes.releaseValue(i);
- } else if (AttributeName.ACTION != attributeQName) {
- inputAttributes.addAttribute(
- attributeQName,
- attributes.getValueNoBoundsCheck(i)
- // [NOCPP[
- , XmlViolationPolicy.ALLOW
- // ]NOCPP]
- // CPPONLY: , attributes.getLineNoBoundsCheck(i)
- );
- }
- }
- attributes.clearWithoutReleasingContents();
- appendVoidElementToCurrentMayFoster(
- "input",
- inputAttributes, formPointer);
- pop(); // label
- appendVoidElementToCurrentMayFoster(
- ElementName.HR,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- pop(); // form
-
- if (!isTemplateContents()) {
- formPointer = null;
- }
-
- selfClosing = false;
- // Portability.delete(formAttrs);
- // Portability.delete(inputAttributes);
- // Don't delete attributes, they are deleted
- // later
- break starttagloop;
- case TEXTAREA:
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RCDATA, elementName);
- originalMode = mode;
- mode = TEXT;
- needToDropLF = true;
- attributes = null; // CPP
- break starttagloop;
- case XMP:
- implicitlyCloseP();
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- case NOSCRIPT:
- if (!scriptingEnabled) {
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- } else {
- // fall through
- }
- case NOFRAMES:
- case IFRAME:
- case NOEMBED:
- startTagGenericRawText(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case SELECT:
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- switch (mode) {
- case IN_TABLE:
- case IN_CAPTION:
- case IN_COLUMN_GROUP:
- case IN_TABLE_BODY:
- case IN_ROW:
- case IN_CELL:
- mode = IN_SELECT_IN_TABLE;
- break;
- default:
- mode = IN_SELECT;
- break;
- }
- attributes = null; // CPP
- break starttagloop;
- case OPTGROUP:
- case OPTION:
- if (isCurrent("option")) {
- pop();
- }
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case RB_OR_RTC:
- eltPos = findLastInScope("ruby");
- if (eltPos != NOT_FOUND_ON_STACK) {
- generateImpliedEndTags();
- }
- if (eltPos != currentPtr) {
- if (eltPos == NOT_FOUND_ON_STACK) {
- errStartTagSeenWithoutRuby(name);
- } else {
- errUnclosedChildrenInRuby();
- }
- }
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case RT_OR_RP:
- eltPos = findLastInScope("ruby");
- if (eltPos != NOT_FOUND_ON_STACK) {
- generateImpliedEndTagsExceptFor("rtc");
- }
- if (eltPos != currentPtr) {
- if (!isCurrent("rtc")) {
- if (eltPos == NOT_FOUND_ON_STACK) {
- errStartTagSeenWithoutRuby(name);
- } else {
- errUnclosedChildrenInRuby();
- }
- }
- }
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case MATH:
- reconstructTheActiveFormattingElements();
- attributes.adjustForMath();
- if (selfClosing) {
- appendVoidElementToCurrentMayFosterMathML(
- elementName, attributes);
- selfClosing = false;
- } else {
- appendToCurrentNodeAndPushElementMayFosterMathML(
- elementName, attributes);
- }
- attributes = null; // CPP
- break starttagloop;
- case SVG:
- reconstructTheActiveFormattingElements();
- attributes.adjustForSvg();
- if (selfClosing) {
- appendVoidElementToCurrentMayFosterSVG(
- elementName,
- attributes);
- selfClosing = false;
- } else {
- appendToCurrentNodeAndPushElementMayFosterSVG(
- elementName, attributes);
- }
- attributes = null; // CPP
- break starttagloop;
- case CAPTION:
- case COL:
- case COLGROUP:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- case TD_OR_TH:
- case FRAME:
- case FRAMESET:
- case HEAD:
- errStrayStartTag(name);
- break starttagloop;
- case OUTPUT:
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes, formPointer);
- attributes = null; // CPP
- break starttagloop;
- default:
- reconstructTheActiveFormattingElements();
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- }
- }
- case IN_HEAD:
- inheadloop: for (;;) {
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case BASE:
- case LINK_OR_BASEFONT_OR_BGSOUND:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case META:
- // Fall through to IN_HEAD_NOSCRIPT
- break inheadloop;
- case TITLE:
- startTagTitleInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case NOSCRIPT:
- if (scriptingEnabled) {
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- } else {
- appendToCurrentNodeAndPushElementMayFoster(
- elementName,
- attributes);
- mode = IN_HEAD_NOSCRIPT;
- }
- attributes = null; // CPP
- break starttagloop;
- case SCRIPT:
- startTagScriptInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case STYLE:
- case NOFRAMES:
- startTagGenericRawText(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case HEAD:
- /* Parse error. */
- errFooSeenWhenFooOpen(name);
- /* Ignore the token. */
- break starttagloop;
- case TEMPLATE:
- startTagTemplateInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- default:
- pop();
- mode = AFTER_HEAD;
- continue starttagloop;
- }
- }
- case IN_HEAD_NOSCRIPT:
- switch (group) {
- case HTML:
- // XXX did Hixie really mean to omit "base"
- // here?
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case LINK_OR_BASEFONT_OR_BGSOUND:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case META:
- checkMetaCharset(attributes);
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case STYLE:
- case NOFRAMES:
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- case HEAD:
- errFooSeenWhenFooOpen(name);
- break starttagloop;
- case NOSCRIPT:
- errFooSeenWhenFooOpen(name);
- break starttagloop;
- default:
- errBadStartTagInHead(name);
- pop();
- mode = IN_HEAD;
- continue;
- }
- case IN_COLUMN_GROUP:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case COL:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- case TEMPLATE:
- startTagTemplateInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- default:
- if (currentPtr == 0 || stack[currentPtr].getGroup() == TEMPLATE) {
- assert fragment || isTemplateContents();
- errGarbageInColgroup();
- break starttagloop;
- }
- pop();
- mode = IN_TABLE;
- continue;
- }
- case IN_SELECT_IN_TABLE:
- switch (group) {
- case CAPTION:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- case TD_OR_TH:
- case TABLE:
- errStartTagWithSelectOpen(name);
- eltPos = findLastInTableScope("select");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- break starttagloop; // http://www.w3.org/Bugs/Public/show_bug.cgi?id=8375
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- continue;
- default:
- // fall through to IN_SELECT
- }
- case IN_SELECT:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case OPTION:
- if (isCurrent("option")) {
- pop();
- }
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case OPTGROUP:
- if (isCurrent("option")) {
- pop();
- }
- if (isCurrent("optgroup")) {
- pop();
- }
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case SELECT:
- errStartSelectWhereEndSelectExpected();
- eltPos = findLastInTableScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- errNoSelectInTableScope();
- break starttagloop;
- } else {
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- break starttagloop;
- }
- case INPUT:
- case TEXTAREA:
- case KEYGEN:
- errStartTagWithSelectOpen(name);
- eltPos = findLastInTableScope("select");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- break starttagloop;
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- continue;
- case SCRIPT:
- startTagScriptInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- case TEMPLATE:
- startTagTemplateInHead(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- default:
- errStrayStartTag(name);
- break starttagloop;
- }
- case AFTER_BODY:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- default:
- errStrayStartTag(name);
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- continue;
- }
- case IN_FRAMESET:
- switch (group) {
- case FRAMESET:
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- attributes = null; // CPP
- break starttagloop;
- case FRAME:
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- attributes = null; // CPP
- break starttagloop;
- default:
- // fall through to AFTER_FRAMESET
- }
- case AFTER_FRAMESET:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case NOFRAMES:
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- default:
- errStrayStartTag(name);
- break starttagloop;
- }
- case INITIAL:
- /*
- * Parse error.
- */
- // [NOCPP[
- switch (doctypeExpectation) {
- case AUTO:
- err("Start tag seen without seeing a doctype first. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML:
- // ]NOCPP]
- errStartTagWithoutDoctype();
- // [NOCPP[
- break;
- case HTML401_STRICT:
- err("Start tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- break;
- case HTML401_TRANSITIONAL:
- err("Start tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- break;
- case NO_DOCTYPE_ERRORS:
- }
- // ]NOCPP]
- /*
- *
- * Set the document to quirks mode.
- */
- documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
- false);
- /*
- * Then, switch to the root element mode of the tree
- * construction stage
- */
- mode = BEFORE_HTML;
- /*
- * and reprocess the current token.
- */
- continue;
- case BEFORE_HTML:
- switch (group) {
- case HTML:
- // optimize error check and streaming SAX by
- // hoisting
- // "html" handling here.
- if (attributes == HtmlAttributes.EMPTY_ATTRIBUTES) {
- // This has the right magic side effect
- // that
- // it
- // makes attributes in SAX Tree mutable.
- appendHtmlElementToDocumentAndPush();
- } else {
- appendHtmlElementToDocumentAndPush(attributes);
- }
- // XXX application cache should fire here
- mode = BEFORE_HEAD;
- attributes = null; // CPP
- break starttagloop;
- default:
- /*
- * Create an HTMLElement node with the tag name
- * html, in the HTML namespace. Append it to the
- * Document object.
- */
- appendHtmlElementToDocumentAndPush();
- /* Switch to the main mode */
- mode = BEFORE_HEAD;
- /*
- * reprocess the current token.
- */
- continue;
- }
- case BEFORE_HEAD:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case HEAD:
- /*
- * A start tag whose tag name is "head"
- *
- * Create an element for the token.
- *
- * Set the head element pointer to this new element
- * node.
- *
- * Append the new element to the current node and
- * push it onto the stack of open elements.
- */
- appendToCurrentNodeAndPushHeadElement(attributes);
- /*
- * Change the insertion mode to "in head".
- */
- mode = IN_HEAD;
- attributes = null; // CPP
- break starttagloop;
- default:
- /*
- * Any other start tag token
- *
- * Act as if a start tag token with the tag name
- * "head" and no attributes had been seen,
- */
- appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_HEAD;
- /*
- * then reprocess the current token.
- *
- * This will result in an empty head element being
- * generated, with the current token being
- * reprocessed in the "after head" insertion mode.
- */
- continue;
- }
- case AFTER_HEAD:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case BODY:
- if (attributes.getLength() == 0) {
- // This has the right magic side effect
- // that
- // it
- // makes attributes in SAX Tree mutable.
- appendToCurrentNodeAndPushBodyElement();
- } else {
- appendToCurrentNodeAndPushBodyElement(attributes);
- }
- framesetOk = false;
- mode = IN_BODY;
- attributes = null; // CPP
- break starttagloop;
- case FRAMESET:
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- mode = IN_FRAMESET;
- attributes = null; // CPP
- break starttagloop;
- case TEMPLATE:
- errFooBetweenHeadAndBody(name);
- pushHeadPointerOntoStack();
- StackNode<T> headOnStack = stack[currentPtr];
- startTagTemplateInHead(elementName, attributes);
- removeFromStack(headOnStack);
- attributes = null; // CPP
- break starttagloop;
- case BASE:
- case LINK_OR_BASEFONT_OR_BGSOUND:
- errFooBetweenHeadAndBody(name);
- pushHeadPointerOntoStack();
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- pop(); // head
- attributes = null; // CPP
- break starttagloop;
- case META:
- errFooBetweenHeadAndBody(name);
- checkMetaCharset(attributes);
- pushHeadPointerOntoStack();
- appendVoidElementToCurrentMayFoster(
- elementName,
- attributes);
- selfClosing = false;
- pop(); // head
- attributes = null; // CPP
- break starttagloop;
- case SCRIPT:
- errFooBetweenHeadAndBody(name);
- pushHeadPointerOntoStack();
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.SCRIPT_DATA, elementName);
- attributes = null; // CPP
- break starttagloop;
- case STYLE:
- case NOFRAMES:
- errFooBetweenHeadAndBody(name);
- pushHeadPointerOntoStack();
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RAWTEXT, elementName);
- attributes = null; // CPP
- break starttagloop;
- case TITLE:
- errFooBetweenHeadAndBody(name);
- pushHeadPointerOntoStack();
- appendToCurrentNodeAndPushElement(
- elementName,
- attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(
- Tokenizer.RCDATA, elementName);
- attributes = null; // CPP
- break starttagloop;
- case HEAD:
- errStrayStartTag(name);
- break starttagloop;
- default:
- appendToCurrentNodeAndPushBodyElement();
- mode = FRAMESET_OK;
- continue;
- }
- case AFTER_AFTER_BODY:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- default:
- errStrayStartTag(name);
- fatal();
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- continue;
- }
- case AFTER_AFTER_FRAMESET:
- switch (group) {
- case HTML:
- errStrayStartTag(name);
- if (!fragment && !isTemplateContents()) {
- addAttributesToHtml(attributes);
- attributes = null; // CPP
- }
- break starttagloop;
- case NOFRAMES:
- startTagGenericRawText(elementName, attributes);
- attributes = null; // CPP
- break starttagloop;
- default:
- errStrayStartTag(name);
- break starttagloop;
- }
- case TEXT:
- assert false;
- break starttagloop; // Avoid infinite loop if the assertion
- // fails
- }
- }
- if (selfClosing) {
- errSelfClosing();
- }
- // CPPONLY: if (mBuilder == null && attributes != HtmlAttributes.EMPTY_ATTRIBUTES) {
- // CPPONLY: Portability.delete(attributes);
- // CPPONLY: }
- }
-
- private void startTagTitleInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
- appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(Tokenizer.RCDATA, elementName);
- }
-
- private void startTagGenericRawText(ElementName elementName, HtmlAttributes attributes) throws SAXException {
- appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(Tokenizer.RAWTEXT, elementName);
- }
-
- private void startTagScriptInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
- // XXX need to manage much more stuff here if supporting document.write()
- appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);
- originalMode = mode;
- mode = TEXT;
- tokenizer.setStateAndEndTagExpectation(Tokenizer.SCRIPT_DATA, elementName);
- }
-
- private void startTagTemplateInHead(ElementName elementName, HtmlAttributes attributes) throws SAXException {
- appendToCurrentNodeAndPushElement(elementName, attributes);
- insertMarker();
- framesetOk = false;
- originalMode = mode;
- mode = IN_TEMPLATE;
- pushTemplateMode(IN_TEMPLATE);
- }
-
- private boolean isTemplateContents() {
- return TreeBuilder.NOT_FOUND_ON_STACK != findLast("template");
- }
-
- private boolean isTemplateModeStackEmpty() {
- return templateModePtr == -1;
- }
-
- private boolean isSpecialParentInForeign(StackNode<T> stackNode) {
- @NsUri String ns = stackNode.ns;
- return ("http://www.w3.org/1999/xhtml" == ns)
- || (stackNode.isHtmlIntegrationPoint())
- || (("http://www.w3.org/1998/Math/MathML" == ns) && (stackNode.getGroup() == MI_MO_MN_MS_MTEXT));
- }
-
- /**
- *
- * <p>
- * C++ memory note: The return value must be released.
- *
- * @return
- * @throws SAXException
- * @throws StopSniffingException
- */
- public static String extractCharsetFromContent(String attributeValue
- // CPPONLY: , TreeBuilder tb
- ) {
- // This is a bit ugly. Converting the string to char array in order to
- // make the portability layer smaller.
- int charsetState = CHARSET_INITIAL;
- int start = -1;
- int end = -1;
- @Auto char[] buffer = Portability.newCharArrayFromString(attributeValue);
-
- charsetloop: for (int i = 0; i < buffer.length; i++) {
- char c = buffer[i];
- switch (charsetState) {
- case CHARSET_INITIAL:
- switch (c) {
- case 'c':
- case 'C':
- charsetState = CHARSET_C;
- continue;
- default:
- continue;
- }
- case CHARSET_C:
- switch (c) {
- case 'h':
- case 'H':
- charsetState = CHARSET_H;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_H:
- switch (c) {
- case 'a':
- case 'A':
- charsetState = CHARSET_A;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_A:
- switch (c) {
- case 'r':
- case 'R':
- charsetState = CHARSET_R;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_R:
- switch (c) {
- case 's':
- case 'S':
- charsetState = CHARSET_S;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_S:
- switch (c) {
- case 'e':
- case 'E':
- charsetState = CHARSET_E;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_E:
- switch (c) {
- case 't':
- case 'T':
- charsetState = CHARSET_T;
- continue;
- default:
- charsetState = CHARSET_INITIAL;
- continue;
- }
- case CHARSET_T:
- switch (c) {
- case '\t':
- case '\n':
- case '\u000C':
- case '\r':
- case ' ':
- continue;
- case '=':
- charsetState = CHARSET_EQUALS;
- continue;
- default:
- return null;
- }
- case CHARSET_EQUALS:
- switch (c) {
- case '\t':
- case '\n':
- case '\u000C':
- case '\r':
- case ' ':
- continue;
- case '\'':
- start = i + 1;
- charsetState = CHARSET_SINGLE_QUOTED;
- continue;
- case '\"':
- start = i + 1;
- charsetState = CHARSET_DOUBLE_QUOTED;
- continue;
- default:
- start = i;
- charsetState = CHARSET_UNQUOTED;
- continue;
- }
- case CHARSET_SINGLE_QUOTED:
- switch (c) {
- case '\'':
- end = i;
- break charsetloop;
- default:
- continue;
- }
- case CHARSET_DOUBLE_QUOTED:
- switch (c) {
- case '\"':
- end = i;
- break charsetloop;
- default:
- continue;
- }
- case CHARSET_UNQUOTED:
- switch (c) {
- case '\t':
- case '\n':
- case '\u000C':
- case '\r':
- case ' ':
- case ';':
- end = i;
- break charsetloop;
- default:
- continue;
- }
- }
- }
- String charset = null;
- if (start != -1) {
- if (end == -1) {
- end = buffer.length;
- }
- charset = Portability.newStringFromBuffer(buffer, start, end
- - start
- // CPPONLY: , tb
- );
- }
- return charset;
- }
-
- private void checkMetaCharset(HtmlAttributes attributes)
- throws SAXException {
- String charset = attributes.getValue(AttributeName.CHARSET);
- if (charset != null) {
- if (tokenizer.internalEncodingDeclaration(charset)) {
- requestSuspension();
- return;
- }
- return;
- }
- if (!Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "content-type",
- attributes.getValue(AttributeName.HTTP_EQUIV))) {
- return;
- }
- String content = attributes.getValue(AttributeName.CONTENT);
- if (content != null) {
- String extract = TreeBuilder.extractCharsetFromContent(content
- // CPPONLY: , this
- );
- // remember not to return early without releasing the string
- if (extract != null) {
- if (tokenizer.internalEncodingDeclaration(extract)) {
- requestSuspension();
- }
- }
- Portability.releaseString(extract);
- }
- }
-
- public final void endTag(ElementName elementName) throws SAXException {
- flushCharacters();
- needToDropLF = false;
- int eltPos;
- int group = elementName.getGroup();
- @Local String name = elementName.name;
- endtagloop: for (;;) {
- if (isInForeign()) {
- if (stack[currentPtr].name != name) {
- if (currentPtr == 0) {
- errStrayEndTag(name);
- } else {
- errEndTagDidNotMatchCurrentOpenElement(name, stack[currentPtr].popName);
- }
- }
- eltPos = currentPtr;
- for (;;) {
- if (eltPos == 0) {
- assert fragment: "We can get this close to the root of the stack in foreign content only in the fragment case.";
- break endtagloop;
- }
- if (stack[eltPos].name == name) {
- while (currentPtr >= eltPos) {
- pop();
- }
- break endtagloop;
- }
- if (stack[--eltPos].ns == "http://www.w3.org/1999/xhtml") {
- break;
- }
- }
- }
- switch (mode) {
- case IN_TEMPLATE:
- switch (group) {
- case TEMPLATE:
- // fall through to IN_HEAD
- break;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case IN_ROW:
- switch (group) {
- case TR:
- eltPos = findLastOrRoot(TreeBuilder.TR);
- if (eltPos == 0) {
- assert fragment || isTemplateContents();
- errNoTableRowToClose();
- break endtagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE_BODY;
- break endtagloop;
- case TABLE:
- eltPos = findLastOrRoot(TreeBuilder.TR);
- if (eltPos == 0) {
- assert fragment || isTemplateContents();
- errNoTableRowToClose();
- break endtagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE_BODY;
- continue;
- case TBODY_OR_THEAD_OR_TFOOT:
- if (findLastInTableScope(name) == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- break endtagloop;
- }
- eltPos = findLastOrRoot(TreeBuilder.TR);
- if (eltPos == 0) {
- assert fragment || isTemplateContents();
- errNoTableRowToClose();
- break endtagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE_BODY;
- continue;
- case BODY:
- case CAPTION:
- case COL:
- case COLGROUP:
- case HTML:
- case TD_OR_TH:
- errStrayEndTag(name);
- break endtagloop;
- default:
- // fall through to IN_TABLE
- }
- case IN_TABLE_BODY:
- switch (group) {
- case TBODY_OR_THEAD_OR_TFOOT:
- eltPos = findLastOrRoot(name);
- if (eltPos == 0) {
- errStrayEndTag(name);
- break endtagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE;
- break endtagloop;
- case TABLE:
- eltPos = findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
- if (eltPos == 0 || stack[eltPos].getGroup() == TEMPLATE) {
- assert fragment || isTemplateContents();
- errStrayEndTag(name);
- break endtagloop;
- }
- clearStackBackTo(eltPos);
- pop();
- mode = IN_TABLE;
- continue;
- case BODY:
- case CAPTION:
- case COL:
- case COLGROUP:
- case HTML:
- case TD_OR_TH:
- case TR:
- errStrayEndTag(name);
- break endtagloop;
- default:
- // fall through to IN_TABLE
- }
- case IN_TABLE:
- switch (group) {
- case TABLE:
- eltPos = findLast("table");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment || isTemplateContents();
- errStrayEndTag(name);
- break endtagloop;
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- break endtagloop;
- case BODY:
- case CAPTION:
- case COL:
- case COLGROUP:
- case HTML:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TD_OR_TH:
- case TR:
- errStrayEndTag(name);
- break endtagloop;
- case TEMPLATE:
- // fall through to IN_HEAD
- break;
- default:
- errStrayEndTag(name);
- // fall through to IN_BODY
- }
- case IN_CAPTION:
- switch (group) {
- case CAPTION:
- eltPos = findLastInTableScope("caption");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- break endtagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && currentPtr != eltPos) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- mode = IN_TABLE;
- break endtagloop;
- case TABLE:
- errTableClosedWhileCaptionOpen();
- eltPos = findLastInTableScope("caption");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- break endtagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && currentPtr != eltPos) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- mode = IN_TABLE;
- continue;
- case BODY:
- case COL:
- case COLGROUP:
- case HTML:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TD_OR_TH:
- case TR:
- errStrayEndTag(name);
- break endtagloop;
- default:
- // fall through to IN_BODY
- }
- case IN_CELL:
- switch (group) {
- case TD_OR_TH:
- eltPos = findLastInTableScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- break endtagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- mode = IN_ROW;
- break endtagloop;
- case TABLE:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- if (findLastInTableScope(name) == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert name == "tbody" || name == "tfoot" || name == "thead" || fragment || isTemplateContents();
- errStrayEndTag(name);
- break endtagloop;
- }
- closeTheCell(findLastInTableScopeTdTh());
- continue;
- case BODY:
- case CAPTION:
- case COL:
- case COLGROUP:
- case HTML:
- errStrayEndTag(name);
- break endtagloop;
- default:
- // fall through to IN_BODY
- }
- case FRAMESET_OK:
- case IN_BODY:
- switch (group) {
- case BODY:
- if (!isSecondOnStackBody()) {
- assert fragment || isTemplateContents();
- errStrayEndTag(name);
- break endtagloop;
- }
- assert currentPtr >= 1;
- if (errorHandler != null) {
- uncloseloop1: for (int i = 2; i <= currentPtr; i++) {
- switch (stack[i].getGroup()) {
- case DD_OR_DT:
- case LI:
- case OPTGROUP:
- case OPTION: // is this possible?
- case P:
- case RB_OR_RTC:
- case RT_OR_RP:
- case TD_OR_TH:
- case TBODY_OR_THEAD_OR_TFOOT:
- break;
- default:
- errEndWithUnclosedElements(name);
- break uncloseloop1;
- }
- }
- }
- mode = AFTER_BODY;
- break endtagloop;
- case HTML:
- if (!isSecondOnStackBody()) {
- assert fragment || isTemplateContents();
- errStrayEndTag(name);
- break endtagloop;
- }
- if (errorHandler != null) {
- uncloseloop2: for (int i = 0; i <= currentPtr; i++) {
- switch (stack[i].getGroup()) {
- case DD_OR_DT:
- case LI:
- case P:
- case RB_OR_RTC:
- case RT_OR_RP:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TD_OR_TH:
- case BODY:
- case HTML:
- break;
- default:
- errEndWithUnclosedElements(name);
- break uncloseloop2;
- }
- }
- }
- mode = AFTER_BODY;
- continue;
- case DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU:
- case UL_OR_OL_OR_DL:
- case PRE_OR_LISTING:
- case FIELDSET:
- case BUTTON:
- case ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY:
- eltPos = findLastInScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- } else {
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- }
- break endtagloop;
- case FORM:
- if (!isTemplateContents()) {
- if (formPointer == null) {
- errStrayEndTag(name);
- break endtagloop;
- }
- formPointer = null;
- eltPos = findLastInScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- break endtagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- removeFromStack(eltPos);
- break endtagloop;
- } else {
- eltPos = findLastInScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- break endtagloop;
- }
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- break endtagloop;
- }
- case P:
- eltPos = findLastInButtonScope("p");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errNoElementToCloseButEndTagSeen("p");
- // XXX Can the 'in foreign' case happen anymore?
- if (isInForeign()) {
- errHtmlStartTagInForeignContext(name);
- // Check for currentPtr for the fragment
- // case.
- while (currentPtr >= 0 && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml") {
- pop();
- }
- }
- appendVoidElementToCurrentMayFoster(
- elementName,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- break endtagloop;
- }
- generateImpliedEndTagsExceptFor("p");
- assert eltPos != TreeBuilder.NOT_FOUND_ON_STACK;
- if (errorHandler != null && eltPos != currentPtr) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- break endtagloop;
- case LI:
- eltPos = findLastInListScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errNoElementToCloseButEndTagSeen(name);
- } else {
- generateImpliedEndTagsExceptFor(name);
- if (errorHandler != null
- && eltPos != currentPtr) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- }
- break endtagloop;
- case DD_OR_DT:
- eltPos = findLastInScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errNoElementToCloseButEndTagSeen(name);
- } else {
- generateImpliedEndTagsExceptFor(name);
- if (errorHandler != null
- && eltPos != currentPtr) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- }
- break endtagloop;
- case H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6:
- eltPos = findLastInScopeHn();
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- } else {
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- }
- break endtagloop;
- case OBJECT:
- case MARQUEE_OR_APPLET:
- eltPos = findLastInScope(name);
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag(name);
- } else {
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- }
- break endtagloop;
- case BR:
- errEndTagBr();
- if (isInForeign()) {
- // XXX can this happen anymore?
- errHtmlStartTagInForeignContext(name);
- // Check for currentPtr for the fragment
- // case.
- while (currentPtr >= 0 && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml") {
- pop();
- }
- }
- reconstructTheActiveFormattingElements();
- appendVoidElementToCurrentMayFoster(
- elementName,
- HtmlAttributes.EMPTY_ATTRIBUTES);
- break endtagloop;
- case TEMPLATE:
- // fall through to IN_HEAD;
- break;
- case AREA_OR_WBR:
- // CPPONLY: case MENUITEM:
- case PARAM_OR_SOURCE_OR_TRACK:
- case EMBED:
- case IMG:
- case IMAGE:
- case INPUT:
- case KEYGEN: // XXX??
- case HR:
- case ISINDEX:
- case IFRAME:
- case NOEMBED: // XXX???
- case NOFRAMES: // XXX??
- case SELECT:
- case TABLE:
- case TEXTAREA: // XXX??
- errStrayEndTag(name);
- break endtagloop;
- case NOSCRIPT:
- if (scriptingEnabled) {
- errStrayEndTag(name);
- break endtagloop;
- } else {
- // fall through
- }
- case A:
- case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
- case FONT:
- case NOBR:
- if (adoptionAgencyEndTag(name)) {
- break endtagloop;
- }
- // else handle like any other tag
- default:
- if (isCurrent(name)) {
- pop();
- break endtagloop;
- }
-
- eltPos = currentPtr;
- for (;;) {
- StackNode<T> node = stack[eltPos];
- if (node.ns == "http://www.w3.org/1999/xhtml" && node.name == name) {
- generateImpliedEndTags();
- if (errorHandler != null
- && !isCurrent(name)) {
- errUnclosedElements(eltPos, name);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- break endtagloop;
- } else if (eltPos == 0 || node.isSpecial()) {
- errStrayEndTag(name);
- break endtagloop;
- }
- eltPos--;
- }
- }
- case IN_HEAD:
- switch (group) {
- case HEAD:
- pop();
- mode = AFTER_HEAD;
- break endtagloop;
- case BR:
- case HTML:
- case BODY:
- pop();
- mode = AFTER_HEAD;
- continue;
- case TEMPLATE:
- endTagTemplateInHead();
- break endtagloop;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case IN_HEAD_NOSCRIPT:
- switch (group) {
- case NOSCRIPT:
- pop();
- mode = IN_HEAD;
- break endtagloop;
- case BR:
- errStrayEndTag(name);
- pop();
- mode = IN_HEAD;
- continue;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case IN_COLUMN_GROUP:
- switch (group) {
- case COLGROUP:
- if (currentPtr == 0 || stack[currentPtr].getGroup() ==
- TreeBuilder.TEMPLATE) {
- assert fragment || isTemplateContents();
- errGarbageInColgroup();
- break endtagloop;
- }
- pop();
- mode = IN_TABLE;
- break endtagloop;
- case COL:
- errStrayEndTag(name);
- break endtagloop;
- case TEMPLATE:
- endTagTemplateInHead();
- break endtagloop;
- default:
- if (currentPtr == 0 || stack[currentPtr].getGroup() ==
- TreeBuilder.TEMPLATE) {
- assert fragment || isTemplateContents();
- errGarbageInColgroup();
- break endtagloop;
- }
- pop();
- mode = IN_TABLE;
- continue;
- }
- case IN_SELECT_IN_TABLE:
- switch (group) {
- case CAPTION:
- case TABLE:
- case TBODY_OR_THEAD_OR_TFOOT:
- case TR:
- case TD_OR_TH:
- errEndTagSeenWithSelectOpen(name);
- if (findLastInTableScope(name) != TreeBuilder.NOT_FOUND_ON_STACK) {
- eltPos = findLastInTableScope("select");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- break endtagloop; // http://www.w3.org/Bugs/Public/show_bug.cgi?id=8375
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- continue;
- } else {
- break endtagloop;
- }
- default:
- // fall through to IN_SELECT
- }
- case IN_SELECT:
- switch (group) {
- case OPTION:
- if (isCurrent("option")) {
- pop();
- break endtagloop;
- } else {
- errStrayEndTag(name);
- break endtagloop;
- }
- case OPTGROUP:
- if (isCurrent("option")
- && "optgroup" == stack[currentPtr - 1].name) {
- pop();
- }
- if (isCurrent("optgroup")) {
- pop();
- } else {
- errStrayEndTag(name);
- }
- break endtagloop;
- case SELECT:
- eltPos = findLastInTableScope("select");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- assert fragment;
- errStrayEndTag(name);
- break endtagloop;
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- resetTheInsertionMode();
- break endtagloop;
- case TEMPLATE:
- endTagTemplateInHead();
- break endtagloop;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case AFTER_BODY:
- switch (group) {
- case HTML:
- if (fragment) {
- errStrayEndTag(name);
- break endtagloop;
- } else {
- mode = AFTER_AFTER_BODY;
- break endtagloop;
- }
- default:
- errEndTagAfterBody();
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- continue;
- }
- case IN_FRAMESET:
- switch (group) {
- case FRAMESET:
- if (currentPtr == 0) {
- assert fragment;
- errStrayEndTag(name);
- break endtagloop;
- }
- pop();
- if ((!fragment) && !isCurrent("frameset")) {
- mode = AFTER_FRAMESET;
- }
- break endtagloop;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case AFTER_FRAMESET:
- switch (group) {
- case HTML:
- mode = AFTER_AFTER_FRAMESET;
- break endtagloop;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case INITIAL:
- /*
- * Parse error.
- */
- // [NOCPP[
- switch (doctypeExpectation) {
- case AUTO:
- err("End tag seen without seeing a doctype first. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
- break;
- case HTML:
- // ]NOCPP]
- errEndTagSeenWithoutDoctype();
- // [NOCPP[
- break;
- case HTML401_STRICT:
- err("End tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
- break;
- case HTML401_TRANSITIONAL:
- err("End tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
- break;
- case NO_DOCTYPE_ERRORS:
- }
- // ]NOCPP]
- /*
- *
- * Set the document to quirks mode.
- */
- documentModeInternal(DocumentMode.QUIRKS_MODE, null, null,
- false);
- /*
- * Then, switch to the root element mode of the tree
- * construction stage
- */
- mode = BEFORE_HTML;
- /*
- * and reprocess the current token.
- */
- continue;
- case BEFORE_HTML:
- switch (group) {
- case HEAD:
- case BR:
- case HTML:
- case BODY:
- /*
- * Create an HTMLElement node with the tag name
- * html, in the HTML namespace. Append it to the
- * Document object.
- */
- appendHtmlElementToDocumentAndPush();
- /* Switch to the main mode */
- mode = BEFORE_HEAD;
- /*
- * reprocess the current token.
- */
- continue;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case BEFORE_HEAD:
- switch (group) {
- case HEAD:
- case BR:
- case HTML:
- case BODY:
- appendToCurrentNodeAndPushHeadElement(HtmlAttributes.EMPTY_ATTRIBUTES);
- mode = IN_HEAD;
- continue;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case AFTER_HEAD:
- switch (group) {
- case TEMPLATE:
- endTagTemplateInHead();
- break endtagloop;
- case HTML:
- case BODY:
- case BR:
- appendToCurrentNodeAndPushBodyElement();
- mode = FRAMESET_OK;
- continue;
- default:
- errStrayEndTag(name);
- break endtagloop;
- }
- case AFTER_AFTER_BODY:
- errStrayEndTag(name);
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- continue;
- case AFTER_AFTER_FRAMESET:
- errStrayEndTag(name);
- break endtagloop;
- case TEXT:
- // XXX need to manage insertion point here
- pop();
- if (originalMode == AFTER_HEAD) {
- silentPop();
- }
- mode = originalMode;
- break endtagloop;
- }
- } // endtagloop
- }
-
- private void endTagTemplateInHead() throws SAXException {
- int eltPos = findLast("template");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- errStrayEndTag("template");
- return;
- }
- generateImpliedEndTags();
- if (errorHandler != null && !isCurrent("template")) {
- errUnclosedElements(eltPos, "template");
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- popTemplateMode();
- resetTheInsertionMode();
- }
-
- private int findLastInTableScopeOrRootTemplateTbodyTheadTfoot() {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].getGroup() == TreeBuilder.TBODY_OR_THEAD_OR_TFOOT ||
- stack[i].getGroup() == TreeBuilder.TEMPLATE) {
- return i;
- }
- }
- return 0;
- }
-
- private int findLast(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
- return i;
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private int findLastInTableScope(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
- if (stack[i].name == name) {
- return i;
- } else if (stack[i].name == "table" || stack[i].name == "template") {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private int findLastInButtonScope(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
- if (stack[i].name == name) {
- return i;
- } else if (stack[i].name == "button") {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
-
- if (stack[i].isScoping()) {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private int findLastInScope(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
- return i;
- } else if (stack[i].isScoping()) {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private int findLastInListScope(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
- if (stack[i].name == name) {
- return i;
- } else if (stack[i].name == "ul" || stack[i].name == "ol") {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
-
- if (stack[i].isScoping()) {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private int findLastInScopeHn() {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].getGroup() == TreeBuilder.H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6) {
- return i;
- } else if (stack[i].isScoping()) {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private void generateImpliedEndTagsExceptFor(@Local String name)
- throws SAXException {
- for (;;) {
- StackNode<T> node = stack[currentPtr];
- switch (node.getGroup()) {
- case P:
- case LI:
- case DD_OR_DT:
- case OPTION:
- case OPTGROUP:
- case RB_OR_RTC:
- case RT_OR_RP:
- if (node.ns == "http://www.w3.org/1999/xhtml" && node.name == name) {
- return;
- }
- pop();
- continue;
- default:
- return;
- }
- }
- }
-
- private void generateImpliedEndTags() throws SAXException {
- for (;;) {
- switch (stack[currentPtr].getGroup()) {
- case P:
- case LI:
- case DD_OR_DT:
- case OPTION:
- case OPTGROUP:
- case RB_OR_RTC:
- case RT_OR_RP:
- pop();
- continue;
- default:
- return;
- }
- }
- }
-
- private boolean isSecondOnStackBody() {
- return currentPtr >= 1 && stack[1].getGroup() == TreeBuilder.BODY;
- }
-
- private void documentModeInternal(DocumentMode m, String publicIdentifier,
- String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
- throws SAXException {
-
- if (isSrcdocDocument) {
- // Srcdoc documents are always rendered in standards mode.
- quirks = false;
- if (documentModeHandler != null) {
- documentModeHandler.documentMode(
- DocumentMode.STANDARDS_MODE
- // [NOCPP[
- , null, null, false
- // ]NOCPP]
- );
- }
- return;
- }
-
- quirks = (m == DocumentMode.QUIRKS_MODE);
- if (documentModeHandler != null) {
- documentModeHandler.documentMode(
- m
- // [NOCPP[
- , publicIdentifier, systemIdentifier,
- html4SpecificAdditionalErrorChecks
- // ]NOCPP]
- );
- }
- // [NOCPP[
- documentMode(m, publicIdentifier, systemIdentifier,
- html4SpecificAdditionalErrorChecks);
- // ]NOCPP]
- }
-
- private boolean isAlmostStandards(String publicIdentifier,
- String systemIdentifier) {
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd xhtml 1.0 transitional//en", publicIdentifier)) {
- return true;
- }
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd xhtml 1.0 frameset//en", publicIdentifier)) {
- return true;
- }
- if (systemIdentifier != null) {
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd html 4.01 transitional//en", publicIdentifier)) {
- return true;
- }
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd html 4.01 frameset//en", publicIdentifier)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isQuirky(@Local String name, String publicIdentifier,
- String systemIdentifier, boolean forceQuirks) {
- if (forceQuirks) {
- return true;
- }
- if (name != HTML_LOCAL) {
- return true;
- }
- if (publicIdentifier != null) {
- for (int i = 0; i < TreeBuilder.QUIRKY_PUBLIC_IDS.length; i++) {
- if (Portability.lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
- TreeBuilder.QUIRKY_PUBLIC_IDS[i], publicIdentifier)) {
- return true;
- }
- }
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3o//dtd w3 html strict 3.0//en//", publicIdentifier)
- || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-/w3c/dtd html 4.0 transitional/en",
- publicIdentifier)
- || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "html", publicIdentifier)) {
- return true;
- }
- }
- if (systemIdentifier == null) {
- if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd html 4.01 transitional//en", publicIdentifier)) {
- return true;
- } else if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "-//w3c//dtd html 4.01 frameset//en", publicIdentifier)) {
- return true;
- }
- } else if (Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",
- systemIdentifier)) {
- return true;
- }
- return false;
- }
-
- private void closeTheCell(int eltPos) throws SAXException {
- generateImpliedEndTags();
- if (errorHandler != null && eltPos != currentPtr) {
- errUnclosedElementsCell(eltPos);
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- clearTheListOfActiveFormattingElementsUpToTheLastMarker();
- mode = IN_ROW;
- return;
- }
-
- private int findLastInTableScopeTdTh() {
- for (int i = currentPtr; i > 0; i--) {
- @Local String name = stack[i].name;
- if (stack[i].ns == "http://www.w3.org/1999/xhtml") {
- if ("td" == name || "th" == name) {
- return i;
- } else if (name == "table" || name == "template") {
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
- }
- }
- return TreeBuilder.NOT_FOUND_ON_STACK;
- }
-
- private void clearStackBackTo(int eltPos) throws SAXException {
- int eltGroup = stack[eltPos].getGroup();
- while (currentPtr > eltPos) { // > not >= intentional
- if (stack[currentPtr].ns == "http://www.w3.org/1999/xhtml"
- && stack[currentPtr].getGroup() == TEMPLATE
- && (eltGroup == TABLE || eltGroup == TBODY_OR_THEAD_OR_TFOOT|| eltGroup == TR || eltPos == 0)) {
- return;
- }
- pop();
- }
- }
-
- private void resetTheInsertionMode() {
- StackNode<T> node;
- @Local String name;
- @NsUri String ns;
- for (int i = currentPtr; i >= 0; i--) {
- node = stack[i];
- name = node.name;
- ns = node.ns;
- if (i == 0) {
- if (!(contextNamespace == "http://www.w3.org/1999/xhtml" && (contextName == "td" || contextName == "th"))) {
- if (fragment) {
- // Make sure we are parsing a fragment otherwise the context element doesn't make sense.
- name = contextName;
- ns = contextNamespace;
- }
- } else {
- mode = framesetOk ? FRAMESET_OK : IN_BODY; // XXX from Hixie's email
- return;
- }
- }
- if ("select" == name) {
- int ancestorIndex = i;
- while (ancestorIndex > 0) {
- StackNode<T> ancestor = stack[ancestorIndex--];
- if ("http://www.w3.org/1999/xhtml" == ancestor.ns) {
- if ("template" == ancestor.name) {
- break;
- }
- if ("table" == ancestor.name) {
- mode = IN_SELECT_IN_TABLE;
- return;
- }
- }
- }
- mode = IN_SELECT;
- return;
- } else if ("td" == name || "th" == name) {
- mode = IN_CELL;
- return;
- } else if ("tr" == name) {
- mode = IN_ROW;
- return;
- } else if ("tbody" == name || "thead" == name || "tfoot" == name) {
- mode = IN_TABLE_BODY;
- return;
- } else if ("caption" == name) {
- mode = IN_CAPTION;
- return;
- } else if ("colgroup" == name) {
- mode = IN_COLUMN_GROUP;
- return;
- } else if ("table" == name) {
- mode = IN_TABLE;
- return;
- } else if ("http://www.w3.org/1999/xhtml" != ns) {
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- return;
- } else if ("template" == name) {
- assert templateModePtr >= 0;
- mode = templateModeStack[templateModePtr];
- return;
- } else if ("head" == name) {
- if (name == contextName) {
- mode = framesetOk ? FRAMESET_OK : IN_BODY; // really
- } else {
- mode = IN_HEAD;
- }
- return;
- } else if ("body" == name) {
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- return;
- } else if ("frameset" == name) {
- // TODO: Fragment case. Add error reporting.
- mode = IN_FRAMESET;
- return;
- } else if ("html" == name) {
- if (headPointer == null) {
- // TODO: Fragment case. Add error reporting.
- mode = BEFORE_HEAD;
- } else {
- mode = AFTER_HEAD;
- }
- return;
- } else if (i == 0) {
- mode = framesetOk ? FRAMESET_OK : IN_BODY;
- return;
- }
- }
- }
-
- /**
- * @throws SAXException
- *
- */
- private void implicitlyCloseP() throws SAXException {
- int eltPos = findLastInButtonScope("p");
- if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
- return;
- }
- generateImpliedEndTagsExceptFor("p");
- if (errorHandler != null && eltPos != currentPtr) {
- errUnclosedElementsImplied(eltPos, "p");
- }
- while (currentPtr >= eltPos) {
- pop();
- }
- }
-
- private boolean debugOnlyClearLastStackSlot() {
- stack[currentPtr] = null;
- return true;
- }
-
- private boolean debugOnlyClearLastListSlot() {
- listOfActiveFormattingElements[listPtr] = null;
- return true;
- }
-
- private void pushTemplateMode(int mode) {
- templateModePtr++;
- if (templateModePtr == templateModeStack.length) {
- int[] newStack = new int[templateModeStack.length + 64];
- System.arraycopy(templateModeStack, 0, newStack, 0, templateModeStack.length);
- templateModeStack = newStack;
- }
- templateModeStack[templateModePtr] = mode;
- }
-
- @SuppressWarnings("unchecked") private void push(StackNode<T> node) throws SAXException {
- currentPtr++;
- if (currentPtr == stack.length) {
- StackNode<T>[] newStack = new StackNode[stack.length + 64];
- System.arraycopy(stack, 0, newStack, 0, stack.length);
- stack = newStack;
- }
- stack[currentPtr] = node;
- elementPushed(node.ns, node.popName, node.node);
- }
-
- @SuppressWarnings("unchecked") private void silentPush(StackNode<T> node) throws SAXException {
- currentPtr++;
- if (currentPtr == stack.length) {
- StackNode<T>[] newStack = new StackNode[stack.length + 64];
- System.arraycopy(stack, 0, newStack, 0, stack.length);
- stack = newStack;
- }
- stack[currentPtr] = node;
- }
-
- @SuppressWarnings("unchecked") private void append(StackNode<T> node) {
- listPtr++;
- if (listPtr == listOfActiveFormattingElements.length) {
- StackNode<T>[] newList = new StackNode[listOfActiveFormattingElements.length + 64];
- System.arraycopy(listOfActiveFormattingElements, 0, newList, 0,
- listOfActiveFormattingElements.length);
- listOfActiveFormattingElements = newList;
- }
- listOfActiveFormattingElements[listPtr] = node;
- }
-
- @Inline private void insertMarker() {
- append(null);
- }
-
- private void clearTheListOfActiveFormattingElementsUpToTheLastMarker() {
- while (listPtr > -1) {
- if (listOfActiveFormattingElements[listPtr] == null) {
- --listPtr;
- return;
- }
- listOfActiveFormattingElements[listPtr].release();
- --listPtr;
- }
- }
-
- @Inline private boolean isCurrent(@Local String name) {
- return stack[currentPtr].ns == "http://www.w3.org/1999/xhtml" &&
- name == stack[currentPtr].name;
- }
-
- private void removeFromStack(int pos) throws SAXException {
- if (currentPtr == pos) {
- pop();
- } else {
- fatal();
- stack[pos].release();
- System.arraycopy(stack, pos + 1, stack, pos, currentPtr - pos);
- assert debugOnlyClearLastStackSlot();
- currentPtr--;
- }
- }
-
- private void removeFromStack(StackNode<T> node) throws SAXException {
- if (stack[currentPtr] == node) {
- pop();
- } else {
- int pos = currentPtr - 1;
- while (pos >= 0 && stack[pos] != node) {
- pos--;
- }
- if (pos == -1) {
- // dead code?
- return;
- }
- fatal();
- node.release();
- System.arraycopy(stack, pos + 1, stack, pos, currentPtr - pos);
- currentPtr--;
- }
- }
-
- private void removeFromListOfActiveFormattingElements(int pos) {
- assert listOfActiveFormattingElements[pos] != null;
- listOfActiveFormattingElements[pos].release();
- if (pos == listPtr) {
- assert debugOnlyClearLastListSlot();
- listPtr--;
- return;
- }
- assert pos < listPtr;
- System.arraycopy(listOfActiveFormattingElements, pos + 1,
- listOfActiveFormattingElements, pos, listPtr - pos);
- assert debugOnlyClearLastListSlot();
- listPtr--;
- }
-
- /**
- * Adoption agency algorithm.
- *
- * @param name subject as described in the specified algorithm.
- * @return Returns true if the algorithm has completed and there is nothing remaining to
- * be done. Returns false if the algorithm needs to "act as described in the 'any other
- * end tag' entry" as described in the specified algorithm.
- * @throws SAXException
- */
- private boolean adoptionAgencyEndTag(@Local String name) throws SAXException {
- // This check intends to ensure that for properly nested tags, closing tags will match
- // against the stack instead of the listOfActiveFormattingElements.
- if (stack[currentPtr].ns == "http://www.w3.org/1999/xhtml" &&
- stack[currentPtr].name == name &&
- findInListOfActiveFormattingElements(stack[currentPtr]) == -1) {
- // If the current element matches the name but isn't on the list of active
- // formatting elements, then it is possible that the list was mangled by the Noah's Ark
- // clause. In this case, we want to match the end tag against the stack instead of
- // proceeding with the AAA algorithm that may match against the list of
- // active formatting elements (and possibly mangle the tree in unexpected ways).
- pop();
- return true;
- }
-
- // If you crash around here, perhaps some stack node variable claimed to
- // be a weak ref isn't.
- for (int i = 0; i < 8; ++i) {
- int formattingEltListPos = listPtr;
- while (formattingEltListPos > -1) {
- StackNode<T> listNode = listOfActiveFormattingElements[formattingEltListPos]; // weak ref
- if (listNode == null) {
- formattingEltListPos = -1;
- break;
- } else if (listNode.name == name) {
- break;
- }
- formattingEltListPos--;
- }
- if (formattingEltListPos == -1) {
- return false;
- }
- // this *looks* like a weak ref to the list of formatting elements
- StackNode<T> formattingElt = listOfActiveFormattingElements[formattingEltListPos];
- int formattingEltStackPos = currentPtr;
- boolean inScope = true;
- while (formattingEltStackPos > -1) {
- StackNode<T> node = stack[formattingEltStackPos]; // weak ref
- if (node == formattingElt) {
- break;
- } else if (node.isScoping()) {
- inScope = false;
- }
- formattingEltStackPos--;
- }
- if (formattingEltStackPos == -1) {
- errNoElementToCloseButEndTagSeen(name);
- removeFromListOfActiveFormattingElements(formattingEltListPos);
- return true;
- }
- if (!inScope) {
- errNoElementToCloseButEndTagSeen(name);
- return true;
- }
- // stackPos now points to the formatting element and it is in scope
- if (formattingEltStackPos != currentPtr) {
- errEndTagViolatesNestingRules(name);
- }
- int furthestBlockPos = formattingEltStackPos + 1;
- while (furthestBlockPos <= currentPtr) {
- StackNode<T> node = stack[furthestBlockPos]; // weak ref
- assert furthestBlockPos > 0: "How is formattingEltStackPos + 1 not > 0?";
- if (node.isSpecial()) {
- break;
- }
- furthestBlockPos++;
- }
- if (furthestBlockPos > currentPtr) {
- // no furthest block
- while (currentPtr >= formattingEltStackPos) {
- pop();
- }
- removeFromListOfActiveFormattingElements(formattingEltListPos);
- return true;
- }
- StackNode<T> commonAncestor = stack[formattingEltStackPos - 1]; // weak ref
- StackNode<T> furthestBlock = stack[furthestBlockPos]; // weak ref
- // detachFromParent(furthestBlock.node); XXX AAA CHANGE
- int bookmark = formattingEltListPos;
- int nodePos = furthestBlockPos;
- StackNode<T> lastNode = furthestBlock; // weak ref
- int j = 0;
- for (;;) {
- ++j;
- nodePos--;
- if (nodePos == formattingEltStackPos) {
- break;
- }
- StackNode<T> node = stack[nodePos]; // weak ref
- int nodeListPos = findInListOfActiveFormattingElements(node);
-
- if (j > 3 && nodeListPos != -1) {
- removeFromListOfActiveFormattingElements(nodeListPos);
-
- // Adjust the indices into the list to account
- // for the removal of nodeListPos.
- if (nodeListPos <= formattingEltListPos) {
- formattingEltListPos--;
- }
- if (nodeListPos <= bookmark) {
- bookmark--;
- }
-
- // Update position to reflect removal from list.
- nodeListPos = -1;
- }
-
- if (nodeListPos == -1) {
- assert formattingEltStackPos < nodePos;
- assert bookmark < nodePos;
- assert furthestBlockPos > nodePos;
- removeFromStack(nodePos); // node is now a bad pointer in C++
- furthestBlockPos--;
- continue;
- }
- // now node is both on stack and in the list
- if (nodePos == furthestBlockPos) {
- bookmark = nodeListPos + 1;
- }
- // if (hasChildren(node.node)) { XXX AAA CHANGE
- assert node == listOfActiveFormattingElements[nodeListPos];
- assert node == stack[nodePos];
- T clone = createElement("http://www.w3.org/1999/xhtml",
- node.name, node.attributes.cloneAttributes(null), commonAncestor.node);
- StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns,
- node.name, clone, node.popName, node.attributes
- // [NOCPP[
- , node.getLocator()
- // ]NOCPP]
- ); // creation ownership goes to stack
- node.dropAttributes(); // adopt ownership to newNode
- stack[nodePos] = newNode;
- newNode.retain(); // retain for list
- listOfActiveFormattingElements[nodeListPos] = newNode;
- node.release(); // release from stack
- node.release(); // release from list
- node = newNode;
- // } XXX AAA CHANGE
- detachFromParent(lastNode.node);
- appendElement(lastNode.node, node.node);
- lastNode = node;
- }
- if (commonAncestor.isFosterParenting()) {
- fatal();
- detachFromParent(lastNode.node);
- insertIntoFosterParent(lastNode.node);
- } else {
- detachFromParent(lastNode.node);
- appendElement(lastNode.node, commonAncestor.node);
- }
- T clone = createElement("http://www.w3.org/1999/xhtml",
- formattingElt.name,
- formattingElt.attributes.cloneAttributes(null), furthestBlock.node);
- StackNode<T> formattingClone = new StackNode<T>(
- formattingElt.getFlags(), formattingElt.ns,
- formattingElt.name, clone, formattingElt.popName,
- formattingElt.attributes
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- ); // Ownership transfers to stack below
- formattingElt.dropAttributes(); // transfer ownership to
- // formattingClone
- appendChildrenToNewParent(furthestBlock.node, clone);
- appendElement(clone, furthestBlock.node);
- removeFromListOfActiveFormattingElements(formattingEltListPos);
- insertIntoListOfActiveFormattingElements(formattingClone, bookmark);
- assert formattingEltStackPos < furthestBlockPos;
- removeFromStack(formattingEltStackPos);
- // furthestBlockPos is now off by one and points to the slot after
- // it
- insertIntoStack(formattingClone, furthestBlockPos);
- }
- return true;
- }
-
- private void insertIntoStack(StackNode<T> node, int position)
- throws SAXException {
- assert currentPtr + 1 < stack.length;
- assert position <= currentPtr + 1;
- if (position == currentPtr + 1) {
- push(node);
- } else {
- System.arraycopy(stack, position, stack, position + 1,
- (currentPtr - position) + 1);
- currentPtr++;
- stack[position] = node;
- }
- }
-
- private void insertIntoListOfActiveFormattingElements(
- StackNode<T> formattingClone, int bookmark) {
- formattingClone.retain();
- assert listPtr + 1 < listOfActiveFormattingElements.length;
- if (bookmark <= listPtr) {
- System.arraycopy(listOfActiveFormattingElements, bookmark,
- listOfActiveFormattingElements, bookmark + 1,
- (listPtr - bookmark) + 1);
- }
- listPtr++;
- listOfActiveFormattingElements[bookmark] = formattingClone;
- }
-
- private int findInListOfActiveFormattingElements(StackNode<T> node) {
- for (int i = listPtr; i >= 0; i--) {
- if (node == listOfActiveFormattingElements[i]) {
- return i;
- }
- }
- return -1;
- }
-
- private int findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
- @Local String name) {
- for (int i = listPtr; i >= 0; i--) {
- StackNode<T> node = listOfActiveFormattingElements[i];
- if (node == null) {
- return -1;
- } else if (node.name == name) {
- return i;
- }
- }
- return -1;
- }
-
-
- private void maybeForgetEarlierDuplicateFormattingElement(
- @Local String name, HtmlAttributes attributes) throws SAXException {
- int candidate = -1;
- int count = 0;
- for (int i = listPtr; i >= 0; i--) {
- StackNode<T> node = listOfActiveFormattingElements[i];
- if (node == null) {
- break;
- }
- if (node.name == name && node.attributes.equalsAnother(attributes)) {
- candidate = i;
- ++count;
- }
- }
- if (count >= 3) {
- removeFromListOfActiveFormattingElements(candidate);
- }
- }
-
- private int findLastOrRoot(@Local String name) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].ns == "http://www.w3.org/1999/xhtml" && stack[i].name == name) {
- return i;
- }
- }
- return 0;
- }
-
- private int findLastOrRoot(int group) {
- for (int i = currentPtr; i > 0; i--) {
- if (stack[i].getGroup() == group) {
- return i;
- }
- }
- return 0;
- }
-
- /**
- * Attempt to add attribute to the body element.
- * @param attributes the attributes
- * @return <code>true</code> iff the attributes were added
- * @throws SAXException
- */
- private boolean addAttributesToBody(HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- if (currentPtr >= 1) {
- StackNode<T> body = stack[1];
- if (body.getGroup() == TreeBuilder.BODY) {
- addAttributesToElement(body.node, attributes);
- return true;
- }
- }
- return false;
- }
-
- private void addAttributesToHtml(HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- addAttributesToElement(stack[0].node, attributes);
- }
-
- private void pushHeadPointerOntoStack() throws SAXException {
- assert headPointer != null;
- assert mode == AFTER_HEAD;
- fatal();
- silentPush(new StackNode<T>(ElementName.HEAD, headPointer
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- ));
- }
-
- /**
- * @throws SAXException
- *
- */
- private void reconstructTheActiveFormattingElements() throws SAXException {
- if (listPtr == -1) {
- return;
- }
- StackNode<T> mostRecent = listOfActiveFormattingElements[listPtr];
- if (mostRecent == null || isInStack(mostRecent)) {
- return;
- }
- int entryPos = listPtr;
- for (;;) {
- entryPos--;
- if (entryPos == -1) {
- break;
- }
- if (listOfActiveFormattingElements[entryPos] == null) {
- break;
- }
- if (isInStack(listOfActiveFormattingElements[entryPos])) {
- break;
- }
- }
- while (entryPos < listPtr) {
- entryPos++;
- StackNode<T> entry = listOfActiveFormattingElements[entryPos];
- StackNode<T> currentNode = stack[currentPtr];
-
- T clone;
- if (currentNode.isFosterParenting()) {
- clone = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", entry.name,
- entry.attributes.cloneAttributes(null));
- } else {
- clone = createElement("http://www.w3.org/1999/xhtml", entry.name,
- entry.attributes.cloneAttributes(null), currentNode.node);
- appendElement(clone, currentNode.node);
- }
-
- StackNode<T> entryClone = new StackNode<T>(entry.getFlags(),
- entry.ns, entry.name, clone, entry.popName,
- entry.attributes
- // [NOCPP[
- , entry.getLocator()
- // ]NOCPP]
- );
-
- entry.dropAttributes(); // transfer ownership to entryClone
-
- push(entryClone);
- // stack takes ownership of the local variable
- listOfActiveFormattingElements[entryPos] = entryClone;
- // overwriting the old entry on the list, so release & retain
- entry.release();
- entryClone.retain();
- }
- }
-
- private void insertIntoFosterParent(T child) throws SAXException {
- int tablePos = findLastOrRoot(TreeBuilder.TABLE);
- int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
-
- if (templatePos >= tablePos) {
- appendElement(child, stack[templatePos].node);
- return;
- }
-
- StackNode<T> node = stack[tablePos];
- insertFosterParentedChild(child, node.node, stack[tablePos - 1].node);
- }
-
- private T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes) throws SAXException {
- return createAndInsertFosterParentedElement(ns, name, attributes, null);
- }
-
- private T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes, T form) throws SAXException {
- int tablePos = findLastOrRoot(TreeBuilder.TABLE);
- int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
-
- if (templatePos >= tablePos) {
- T child = createElement(ns, name, attributes, form, stack[templatePos].node);
- appendElement(child, stack[templatePos].node);
- return child;
- }
-
- StackNode<T> node = stack[tablePos];
- return createAndInsertFosterParentedElement(ns, name, attributes, form, node.node, stack[tablePos - 1].node);
- }
-
- private boolean isInStack(StackNode<T> node) {
- for (int i = currentPtr; i >= 0; i--) {
- if (stack[i] == node) {
- return true;
- }
- }
- return false;
- }
-
- private void popTemplateMode() {
- templateModePtr--;
- }
-
- private void pop() throws SAXException {
- StackNode<T> node = stack[currentPtr];
- assert debugOnlyClearLastStackSlot();
- currentPtr--;
- elementPopped(node.ns, node.popName, node.node);
- node.release();
- }
-
- private void silentPop() throws SAXException {
- StackNode<T> node = stack[currentPtr];
- assert debugOnlyClearLastStackSlot();
- currentPtr--;
- node.release();
- }
-
- private void popOnEof() throws SAXException {
- StackNode<T> node = stack[currentPtr];
- assert debugOnlyClearLastStackSlot();
- currentPtr--;
- markMalformedIfScript(node.node);
- elementPopped(node.ns, node.popName, node.node);
- node.release();
- }
-
- // [NOCPP[
- private void checkAttributes(HtmlAttributes attributes, @NsUri String ns)
- throws SAXException {
- if (errorHandler != null) {
- int len = attributes.getXmlnsLength();
- for (int i = 0; i < len; i++) {
- AttributeName name = attributes.getXmlnsAttributeName(i);
- if (name == AttributeName.XMLNS) {
- if (html4) {
- err("Attribute \u201Cxmlns\u201D not allowed here. (HTML4-only error.)");
- } else {
- String xmlns = attributes.getXmlnsValue(i);
- if (!ns.equals(xmlns)) {
- err("Bad value \u201C"
- + xmlns
- + "\u201D for the attribute \u201Cxmlns\u201D (only \u201C"
- + ns + "\u201D permitted here).");
- switch (namePolicy) {
- case ALTER_INFOSET:
- // fall through
- case ALLOW:
- warn("Attribute \u201Cxmlns\u201D is not serializable as XML 1.0.");
- break;
- case FATAL:
- fatal("Attribute \u201Cxmlns\u201D is not serializable as XML 1.0.");
- break;
- }
- }
- }
- } else if (ns != "http://www.w3.org/1999/xhtml"
- && name == AttributeName.XMLNS_XLINK) {
- String xmlns = attributes.getXmlnsValue(i);
- if (!"http://www.w3.org/1999/xlink".equals(xmlns)) {
- err("Bad value \u201C"
- + xmlns
- + "\u201D for the attribute \u201Cxmlns:link\u201D (only \u201Chttp://www.w3.org/1999/xlink\u201D permitted here).");
- switch (namePolicy) {
- case ALTER_INFOSET:
- // fall through
- case ALLOW:
- warn("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
- break;
- case FATAL:
- fatal("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
- break;
- }
- }
- } else {
- err("Attribute \u201C" + attributes.getXmlnsLocalName(i)
- + "\u201D not allowed here.");
- switch (namePolicy) {
- case ALTER_INFOSET:
- // fall through
- case ALLOW:
- warn("Attribute with the local name \u201C"
- + attributes.getXmlnsLocalName(i)
- + "\u201D is not serializable as XML 1.0.");
- break;
- case FATAL:
- fatal("Attribute with the local name \u201C"
- + attributes.getXmlnsLocalName(i)
- + "\u201D is not serializable as XML 1.0.");
- break;
- }
- }
- }
- }
- attributes.processNonNcNames(this, namePolicy);
- }
-
- private String checkPopName(@Local String name) throws SAXException {
- if (NCName.isNCName(name)) {
- return name;
- } else {
- switch (namePolicy) {
- case ALLOW:
- warn("Element name \u201C" + name
- + "\u201D cannot be represented as XML 1.0.");
- return name;
- case ALTER_INFOSET:
- warn("Element name \u201C" + name
- + "\u201D cannot be represented as XML 1.0.");
- return NCName.escapeName(name);
- case FATAL:
- fatal("Element name \u201C" + name
- + "\u201D cannot be represented as XML 1.0.");
- }
- }
- return null; // keep compiler happy
- }
-
- // ]NOCPP]
-
- private void appendHtmlElementToDocumentAndPush(HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- T elt = createHtmlElementSetAsRoot(attributes);
- StackNode<T> node = new StackNode<T>(ElementName.HTML,
- elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendHtmlElementToDocumentAndPush() throws SAXException {
- appendHtmlElementToDocumentAndPush(tokenizer.emptyAttributes());
- }
-
- private void appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- T currentNode = stack[currentPtr].node;
- T elt = createElement("http://www.w3.org/1999/xhtml", "head", attributes, currentNode);
- appendElement(elt, currentNode);
- headPointer = elt;
- StackNode<T> node = new StackNode<T>(ElementName.HEAD,
- elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendToCurrentNodeAndPushBodyElement(HtmlAttributes attributes)
- throws SAXException {
- appendToCurrentNodeAndPushElement(ElementName.BODY,
- attributes);
- }
-
- private void appendToCurrentNodeAndPushBodyElement() throws SAXException {
- appendToCurrentNodeAndPushBodyElement(tokenizer.emptyAttributes());
- }
-
- private void appendToCurrentNodeAndPushFormElementMayFoster(
- HtmlAttributes attributes) throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
-
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", "form", attributes);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", "form", attributes, current.node);
- appendElement(elt, current.node);
- }
-
- if (!isTemplateContents()) {
- formPointer = elt;
- }
-
- StackNode<T> node = new StackNode<T>(ElementName.FORM,
- elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendToCurrentNodeAndPushFormattingElementMayFoster(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- // This method can't be called for custom elements
- HtmlAttributes clone = attributes.cloneAttributes(null);
- // Attributes must not be read after calling createElement, because
- // createElement may delete attributes in C++.
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.name, attributes);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes, current.node);
- appendElement(elt, current.node);
- }
- StackNode<T> node = new StackNode<T>(elementName, elt, clone
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- append(node);
- node.retain(); // append doesn't retain itself
- }
-
- private void appendToCurrentNodeAndPushElement(ElementName elementName,
- HtmlAttributes attributes)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- // This method can't be called for custom elements
- T currentNode = stack[currentPtr].node;
- T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes, currentNode);
- appendElement(elt, currentNode);
- if (ElementName.TEMPLATE == elementName) {
- elt = getDocumentFragmentForTemplate(elt);
- }
- StackNode<T> node = new StackNode<T>(elementName, elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName,
- HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.name;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- StackNode<T> node = new StackNode<T>(elementName, elt, popName
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendToCurrentNodeAndPushElementMayFosterMathML(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.name;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- boolean markAsHtmlIntegrationPoint = false;
- if (ElementName.ANNOTATION_XML == elementName
- && annotationXmlEncodingPermitsHtml(attributes)) {
- markAsHtmlIntegrationPoint = true;
- }
- // Attributes must not be read after calling createElement(), since
- // createElement may delete the object in C++.
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- StackNode<T> node = new StackNode<T>(elementName, elt, popName,
- markAsHtmlIntegrationPoint
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- // [NOCPP[
- T getDocumentFragmentForTemplate(T template) {
- return template;
- }
-
- T getFormPointerForContext(T context) {
- return null;
- }
- // ]NOCPP]
-
- private boolean annotationXmlEncodingPermitsHtml(HtmlAttributes attributes) {
- String encoding = attributes.getValue(AttributeName.ENCODING);
- if (encoding == null) {
- return false;
- }
- return Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "application/xhtml+xml", encoding)
- || Portability.lowerCaseLiteralEqualsIgnoreAsciiCaseString(
- "text/html", encoding);
- }
-
- private void appendToCurrentNodeAndPushElementMayFosterSVG(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.camelCaseName;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/2000/svg");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/2000/svg", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/2000/svg", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- StackNode<T> node = new StackNode<T>(elementName, popName, elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName,
- HtmlAttributes attributes, T form)
- throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- // Can't be called for custom elements
- T elt;
- T formOwner = form == null || fragment || isTemplateContents() ? null : form;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.name,
- attributes, formOwner);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", elementName.name,
- attributes, formOwner, current.node);
- appendElement(elt, current.node);
- }
- StackNode<T> node = new StackNode<T>(elementName, elt
- // [NOCPP[
- , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer)
- // ]NOCPP]
- );
- push(node);
- }
-
- private void appendVoidElementToCurrentMayFoster(
- @Local String name, HtmlAttributes attributes, T form) throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- // Can't be called for custom elements
- T elt;
- T formOwner = form == null || fragment || isTemplateContents() ? null : form;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", name,
- attributes, formOwner);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", name,
- attributes, formOwner, current.node);
- appendElement(elt, current.node);
- }
- elementPushed("http://www.w3.org/1999/xhtml", name, elt);
- elementPopped("http://www.w3.org/1999/xhtml", name, elt);
- }
-
- private void appendVoidElementToCurrentMayFoster(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.name;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/1999/xhtml", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- elementPushed("http://www.w3.org/1999/xhtml", popName, elt);
- elementPopped("http://www.w3.org/1999/xhtml", popName, elt);
- }
-
- private void appendVoidElementToCurrentMayFosterSVG(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.camelCaseName;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/2000/svg");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/2000/svg", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/2000/svg", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- elementPushed("http://www.w3.org/2000/svg", popName, elt);
- elementPopped("http://www.w3.org/2000/svg", popName, elt);
- }
-
- private void appendVoidElementToCurrentMayFosterMathML(
- ElementName elementName, HtmlAttributes attributes)
- throws SAXException {
- @Local String popName = elementName.name;
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML");
- if (elementName.isCustom()) {
- popName = checkPopName(popName);
- }
- // ]NOCPP]
- T elt;
- StackNode<T> current = stack[currentPtr];
- if (current.isFosterParenting()) {
- fatal();
- elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes);
- } else {
- elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, current.node);
- appendElement(elt, current.node);
- }
- elementPushed("http://www.w3.org/1998/Math/MathML", popName, elt);
- elementPopped("http://www.w3.org/1998/Math/MathML", popName, elt);
- }
-
- private void appendVoidElementToCurrent(
- @Local String name, HtmlAttributes attributes, T form) throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- // Can't be called for custom elements
- T currentNode = stack[currentPtr].node;
- T elt = createElement("http://www.w3.org/1999/xhtml", name, attributes,
- form == null || fragment || isTemplateContents() ? null : form, currentNode);
- appendElement(elt, currentNode);
- elementPushed("http://www.w3.org/1999/xhtml", name, elt);
- elementPopped("http://www.w3.org/1999/xhtml", name, elt);
- }
-
- private void appendVoidFormToCurrent(HtmlAttributes attributes) throws SAXException {
- // [NOCPP[
- checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
- // ]NOCPP]
- T currentNode = stack[currentPtr].node;
- T elt = createElement("http://www.w3.org/1999/xhtml", "form",
- attributes, currentNode);
- formPointer = elt;
- // ownership transferred to form pointer
- appendElement(elt, currentNode);
- elementPushed("http://www.w3.org/1999/xhtml", "form", elt);
- elementPopped("http://www.w3.org/1999/xhtml", "form", elt);
- }
-
- // [NOCPP[
-
- private final void accumulateCharactersForced(@Const @NoLength char[] buf,
- int start, int length) throws SAXException {
- System.arraycopy(buf, start, charBuffer, charBufferLen, length);
- charBufferLen += length;
- }
-
- @Override public void ensureBufferSpace(int inputLength)
- throws SAXException {
- // TODO: Unify Tokenizer.strBuf and TreeBuilder.charBuffer so that
- // this method becomes unnecessary.
- int worstCase = charBufferLen + inputLength;
- if (charBuffer == null) {
- // Add an arbitrary small value to avoid immediate reallocation
- // once there are a few characters in the buffer.
- charBuffer = new char[worstCase + 128];
- } else if (worstCase > charBuffer.length) {
- // HotSpot reportedly allocates memory with 8-byte accuracy, so
- // there's no point in trying to do math here to avoid slop.
- // Maybe we should add some small constant to worstCase here
- // but not doing that without profiling. In C++ with jemalloc,
- // the corresponding method should do math to round up here
- // to avoid slop.
- char[] newBuf = new char[worstCase];
- System.arraycopy(charBuffer, 0, newBuf, 0, charBufferLen);
- charBuffer = newBuf;
- }
- }
-
- // ]NOCPP]
-
- protected void accumulateCharacters(@Const @NoLength char[] buf, int start,
- int length) throws SAXException {
- appendCharacters(stack[currentPtr].node, buf, start, length);
- }
-
- // ------------------------------- //
-
- protected final void requestSuspension() {
- tokenizer.requestSuspension();
- }
-
- protected abstract T createElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes, T intendedParent) throws SAXException;
-
- protected T createElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes, T form, T intendedParent) throws SAXException {
- return createElement("http://www.w3.org/1999/xhtml", name, attributes, intendedParent);
- }
-
- protected abstract T createHtmlElementSetAsRoot(HtmlAttributes attributes)
- throws SAXException;
-
- protected abstract void detachFromParent(T element) throws SAXException;
-
- protected abstract boolean hasChildren(T element) throws SAXException;
-
- protected abstract void appendElement(T child, T newParent)
- throws SAXException;
-
- protected abstract void appendChildrenToNewParent(T oldParent, T newParent)
- throws SAXException;
-
- protected abstract void insertFosterParentedChild(T child, T table,
- T stackParent) throws SAXException;
-
- // We don't generate CPP code for this method because it is not used in generated CPP
- // code. Instead, the form owner version of this method is called with a null form owner.
- // [NOCPP[
-
- protected abstract T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes, T table, T stackParent) throws SAXException;
-
- // ]NOCPP]
-
- protected T createAndInsertFosterParentedElement(@NsUri String ns, @Local String name,
- HtmlAttributes attributes, T form, T table, T stackParent) throws SAXException {
- return createAndInsertFosterParentedElement(ns, name, attributes, table, stackParent);
- };
-
- protected abstract void insertFosterParentedCharacters(
- @NoLength char[] buf, int start, int length, T table, T stackParent)
- throws SAXException;
-
- protected abstract void appendCharacters(T parent, @NoLength char[] buf,
- int start, int length) throws SAXException;
-
- protected abstract void appendIsindexPrompt(T parent) throws SAXException;
-
- protected abstract void appendComment(T parent, @NoLength char[] buf,
- int start, int length) throws SAXException;
-
- protected abstract void appendCommentToDocument(@NoLength char[] buf,
- int start, int length) throws SAXException;
-
- protected abstract void addAttributesToElement(T element,
- HtmlAttributes attributes) throws SAXException;
-
- protected void markMalformedIfScript(T elt) throws SAXException {
-
- }
-
- protected void start(boolean fragmentMode) throws SAXException {
-
- }
-
- protected void end() throws SAXException {
-
- }
-
- protected void appendDoctypeToDocument(@Local String name,
- String publicIdentifier, String systemIdentifier)
- throws SAXException {
-
- }
-
- protected void elementPushed(@NsUri String ns, @Local String name, T node)
- throws SAXException {
-
- }
-
- protected void elementPopped(@NsUri String ns, @Local String name, T node)
- throws SAXException {
-
- }
-
- // [NOCPP[
-
- protected void documentMode(DocumentMode m, String publicIdentifier,
- String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
- throws SAXException {
-
- }
-
- /**
- * @see nu.validator.htmlparser.common.TokenHandler#wantsComments()
- */
- public boolean wantsComments() {
- return wantingComments;
- }
-
- public void setIgnoringComments(boolean ignoreComments) {
- wantingComments = !ignoreComments;
- }
-
- /**
- * Sets the errorHandler.
- *
- * @param errorHandler
- * the errorHandler to set
- */
- public final void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Returns the errorHandler.
- *
- * @return the errorHandler
- */
- public ErrorHandler getErrorHandler() {
- return errorHandler;
- }
-
- /**
- * The argument MUST be an interned string or <code>null</code>.
- *
- * @param context
- */
- public final void setFragmentContext(@Local String context) {
- this.contextName = context;
- this.contextNamespace = "http://www.w3.org/1999/xhtml";
- this.contextNode = null;
- this.fragment = (contextName != null);
- this.quirks = false;
- }
-
- // ]NOCPP]
-
- /**
- * @see nu.validator.htmlparser.common.TokenHandler#cdataSectionAllowed()
- */
- @Inline public boolean cdataSectionAllowed() throws SAXException {
- return isInForeign();
- }
-
- private boolean isInForeign() {
- return currentPtr >= 0
- && stack[currentPtr].ns != "http://www.w3.org/1999/xhtml";
- }
-
- private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() {
- if (currentPtr < 0) {
- return false;
- }
- return !isSpecialParentInForeign(stack[currentPtr]);
- }
-
- /**
- * The argument MUST be an interned string or <code>null</code>.
- *
- * @param context
- */
- public final void setFragmentContext(@Local String context,
- @NsUri String ns, T node, boolean quirks) {
- // [NOCPP[
- if (!((context == null && ns == null)
- || "http://www.w3.org/1999/xhtml" == ns
- || "http://www.w3.org/2000/svg" == ns || "http://www.w3.org/1998/Math/MathML" == ns)) {
- throw new IllegalArgumentException(
- "The namespace must be the HTML, SVG or MathML namespace (or null when the local name is null). Got: "
- + ns);
- }
- // ]NOCPP]
- this.contextName = context;
- this.contextNamespace = ns;
- this.contextNode = node;
- this.fragment = (contextName != null);
- this.quirks = quirks;
- }
-
- protected final T currentNode() {
- return stack[currentPtr].node;
- }
-
- /**
- * Returns the scriptingEnabled.
- *
- * @return the scriptingEnabled
- */
- public boolean isScriptingEnabled() {
- return scriptingEnabled;
- }
-
- /**
- * Sets the scriptingEnabled.
- *
- * @param scriptingEnabled
- * the scriptingEnabled to set
- */
- public void setScriptingEnabled(boolean scriptingEnabled) {
- this.scriptingEnabled = scriptingEnabled;
- }
-
- public void setIsSrcdocDocument(boolean isSrcdocDocument) {
- this.isSrcdocDocument = isSrcdocDocument;
- }
-
- // [NOCPP[
-
- /**
- * Sets the doctypeExpectation.
- *
- * @param doctypeExpectation
- * the doctypeExpectation to set
- */
- public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
- this.doctypeExpectation = doctypeExpectation;
- }
-
- public void setNamePolicy(XmlViolationPolicy namePolicy) {
- this.namePolicy = namePolicy;
- }
-
- /**
- * Sets the documentModeHandler.
- *
- * @param documentModeHandler
- * the documentModeHandler to set
- */
- public void setDocumentModeHandler(DocumentModeHandler documentModeHandler) {
- this.documentModeHandler = documentModeHandler;
- }
-
- /**
- * Sets the reportingDoctype.
- *
- * @param reportingDoctype
- * the reportingDoctype to set
- */
- public void setReportingDoctype(boolean reportingDoctype) {
- this.reportingDoctype = reportingDoctype;
- }
-
- // ]NOCPP]
-
- /**
- * Flushes the pending characters. Public for document.write use cases only.
- * @throws SAXException
- */
- public final void flushCharacters() throws SAXException {
- if (charBufferLen > 0) {
- if ((mode == IN_TABLE || mode == IN_TABLE_BODY || mode == IN_ROW)
- && charBufferContainsNonWhitespace()) {
- errNonSpaceInTable();
- reconstructTheActiveFormattingElements();
- if (!stack[currentPtr].isFosterParenting()) {
- // reconstructing gave us a new current node
- appendCharacters(currentNode(), charBuffer, 0,
- charBufferLen);
- charBufferLen = 0;
- return;
- }
-
- int tablePos = findLastOrRoot(TreeBuilder.TABLE);
- int templatePos = findLastOrRoot(TreeBuilder.TEMPLATE);
-
- if (templatePos >= tablePos) {
- appendCharacters(stack[templatePos].node, charBuffer, 0, charBufferLen);
- charBufferLen = 0;
- return;
- }
-
- StackNode<T> tableElt = stack[tablePos];
- insertFosterParentedCharacters(charBuffer, 0, charBufferLen,
- tableElt.node, stack[tablePos - 1].node);
- charBufferLen = 0;
- return;
- }
- appendCharacters(currentNode(), charBuffer, 0, charBufferLen);
- charBufferLen = 0;
- }
- }
-
- private boolean charBufferContainsNonWhitespace() {
- for (int i = 0; i < charBufferLen; i++) {
- switch (charBuffer[i]) {
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- case '\u000C':
- continue;
- default:
- return true;
- }
- }
- return false;
- }
-
- /**
- * Creates a comparable snapshot of the tree builder state. Snapshot
- * creation is only supported immediately after a script end tag has been
- * processed. In C++ the caller is responsible for calling
- * <code>delete</code> on the returned object.
- *
- * @return a snapshot.
- * @throws SAXException
- */
- @SuppressWarnings("unchecked") public TreeBuilderState<T> newSnapshot()
- throws SAXException {
- StackNode<T>[] listCopy = new StackNode[listPtr + 1];
- for (int i = 0; i < listCopy.length; i++) {
- StackNode<T> node = listOfActiveFormattingElements[i];
- if (node != null) {
- StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns,
- node.name, node.node, node.popName,
- node.attributes.cloneAttributes(null)
- // [NOCPP[
- , node.getLocator()
- // ]NOCPP]
- );
- listCopy[i] = newNode;
- } else {
- listCopy[i] = null;
- }
- }
- StackNode<T>[] stackCopy = new StackNode[currentPtr + 1];
- for (int i = 0; i < stackCopy.length; i++) {
- StackNode<T> node = stack[i];
- int listIndex = findInListOfActiveFormattingElements(node);
- if (listIndex == -1) {
- StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns,
- node.name, node.node, node.popName,
- null
- // [NOCPP[
- , node.getLocator()
- // ]NOCPP]
- );
- stackCopy[i] = newNode;
- } else {
- stackCopy[i] = listCopy[listIndex];
- stackCopy[i].retain();
- }
- }
- int[] templateModeStackCopy = new int[templateModePtr + 1];
- System.arraycopy(templateModeStack, 0, templateModeStackCopy, 0,
- templateModeStackCopy.length);
- return new StateSnapshot<T>(stackCopy, listCopy, templateModeStackCopy, formPointer,
- headPointer, deepTreeSurrogateParent, mode, originalMode, framesetOk,
- needToDropLF, quirks);
- }
-
- public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
- StackNode<T>[] stackCopy = snapshot.getStack();
- int stackLen = snapshot.getStackLength();
- StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
- int listLen = snapshot.getListOfActiveFormattingElementsLength();
- int[] templateModeStackCopy = snapshot.getTemplateModeStack();
- int templateModeStackLen = snapshot.getTemplateModeStackLength();
-
- if (stackLen != currentPtr + 1
- || listLen != listPtr + 1
- || templateModeStackLen != templateModePtr + 1
- || formPointer != snapshot.getFormPointer()
- || headPointer != snapshot.getHeadPointer()
- || deepTreeSurrogateParent != snapshot.getDeepTreeSurrogateParent()
- || mode != snapshot.getMode()
- || originalMode != snapshot.getOriginalMode()
- || framesetOk != snapshot.isFramesetOk()
- || needToDropLF != snapshot.isNeedToDropLF()
- || quirks != snapshot.isQuirks()) { // maybe just assert quirks
- return false;
- }
- for (int i = listLen - 1; i >= 0; i--) {
- if (listCopy[i] == null
- && listOfActiveFormattingElements[i] == null) {
- continue;
- } else if (listCopy[i] == null
- || listOfActiveFormattingElements[i] == null) {
- return false;
- }
- if (listCopy[i].node != listOfActiveFormattingElements[i].node) {
- return false; // it's possible that this condition is overly
- // strict
- }
- }
- for (int i = stackLen - 1; i >= 0; i--) {
- if (stackCopy[i].node != stack[i].node) {
- return false;
- }
- }
- for (int i = templateModeStackLen - 1; i >=0; i--) {
- if (templateModeStackCopy[i] != templateModeStack[i]) {
- return false;
- }
- }
- return true;
- }
-
- @SuppressWarnings("unchecked") public void loadState(
- TreeBuilderState<T> snapshot, Interner interner)
- throws SAXException {
- StackNode<T>[] stackCopy = snapshot.getStack();
- int stackLen = snapshot.getStackLength();
- StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
- int listLen = snapshot.getListOfActiveFormattingElementsLength();
- int[] templateModeStackCopy = snapshot.getTemplateModeStack();
- int templateModeStackLen = snapshot.getTemplateModeStackLength();
-
- for (int i = 0; i <= listPtr; i++) {
- if (listOfActiveFormattingElements[i] != null) {
- listOfActiveFormattingElements[i].release();
- }
- }
- if (listOfActiveFormattingElements.length < listLen) {
- listOfActiveFormattingElements = new StackNode[listLen];
- }
- listPtr = listLen - 1;
-
- for (int i = 0; i <= currentPtr; i++) {
- stack[i].release();
- }
- if (stack.length < stackLen) {
- stack = new StackNode[stackLen];
- }
- currentPtr = stackLen - 1;
-
- if (templateModeStack.length < templateModeStackLen) {
- templateModeStack = new int[templateModeStackLen];
- }
- templateModePtr = templateModeStackLen - 1;
-
- for (int i = 0; i < listLen; i++) {
- StackNode<T> node = listCopy[i];
- if (node != null) {
- StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns,
- Portability.newLocalFromLocal(node.name, interner), node.node,
- Portability.newLocalFromLocal(node.popName, interner),
- node.attributes.cloneAttributes(null)
- // [NOCPP[
- , node.getLocator()
- // ]NOCPP]
- );
- listOfActiveFormattingElements[i] = newNode;
- } else {
- listOfActiveFormattingElements[i] = null;
- }
- }
- for (int i = 0; i < stackLen; i++) {
- StackNode<T> node = stackCopy[i];
- int listIndex = findInArray(node, listCopy);
- if (listIndex == -1) {
- StackNode<T> newNode = new StackNode<T>(node.getFlags(), node.ns,
- Portability.newLocalFromLocal(node.name, interner), node.node,
- Portability.newLocalFromLocal(node.popName, interner),
- null
- // [NOCPP[
- , node.getLocator()
- // ]NOCPP]
- );
- stack[i] = newNode;
- } else {
- stack[i] = listOfActiveFormattingElements[listIndex];
- stack[i].retain();
- }
- }
- System.arraycopy(templateModeStackCopy, 0, templateModeStack, 0, templateModeStackLen);
- formPointer = snapshot.getFormPointer();
- headPointer = snapshot.getHeadPointer();
- deepTreeSurrogateParent = snapshot.getDeepTreeSurrogateParent();
- mode = snapshot.getMode();
- originalMode = snapshot.getOriginalMode();
- framesetOk = snapshot.isFramesetOk();
- needToDropLF = snapshot.isNeedToDropLF();
- quirks = snapshot.isQuirks();
- }
-
- private int findInArray(StackNode<T> node, StackNode<T>[] arr) {
- for (int i = listPtr; i >= 0; i--) {
- if (node == arr[i]) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
- */
- public T getFormPointer() {
- return formPointer;
- }
-
- /**
- * Returns the headPointer.
- *
- * @return the headPointer
- */
- public T getHeadPointer() {
- return headPointer;
- }
-
- /**
- * Returns the deepTreeSurrogateParent.
- *
- * @return the deepTreeSurrogateParent
- */
- public T getDeepTreeSurrogateParent() {
- return deepTreeSurrogateParent;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
- */
- public StackNode<T>[] getListOfActiveFormattingElements() {
- return listOfActiveFormattingElements;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
- */
- public StackNode<T>[] getStack() {
- return stack;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
- */
- public int[] getTemplateModeStack() {
- return templateModeStack;
- }
-
- /**
- * Returns the mode.
- *
- * @return the mode
- */
- public int getMode() {
- return mode;
- }
-
- /**
- * Returns the originalMode.
- *
- * @return the originalMode
- */
- public int getOriginalMode() {
- return originalMode;
- }
-
- /**
- * Returns the framesetOk.
- *
- * @return the framesetOk
- */
- public boolean isFramesetOk() {
- return framesetOk;
- }
-
- /**
- * Returns the needToDropLF.
- *
- * @return the needToDropLF
- */
- public boolean isNeedToDropLF() {
- return needToDropLF;
- }
-
- /**
- * Returns the quirks.
- *
- * @return the quirks
- */
- public boolean isQuirks() {
- return quirks;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
- */
- public int getListOfActiveFormattingElementsLength() {
- return listPtr + 1;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
- */
- public int getStackLength() {
- return currentPtr + 1;
- }
-
- /**
- * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
- */
- public int getTemplateModeStackLength() {
- return templateModePtr + 1;
- }
-
- /**
- * Reports a stray start tag.
- * @param name the name of the stray tag
- *
- * @throws SAXException
- */
- private void errStrayStartTag(@Local String name) throws SAXException {
- err("Stray start tag \u201C" + name + "\u201D.");
- }
-
- /**
- * Reports a stray end tag.
- * @param name the name of the stray tag
- *
- * @throws SAXException
- */
- private void errStrayEndTag(@Local String name) throws SAXException {
- err("Stray end tag \u201C" + name + "\u201D.");
- }
-
- /**
- * Reports a state when elements expected to be closed were not.
- *
- * @param eltPos the position of the start tag on the stack of the element
- * being closed.
- * @param name the name of the end tag
- *
- * @throws SAXException
- */
- private void errUnclosedElements(int eltPos, @Local String name) throws SAXException {
- errNoCheck("End tag \u201C" + name + "\u201D seen, but there were open elements.");
- errListUnclosedStartTags(eltPos);
- }
-
- /**
- * Reports a state when elements expected to be closed ahead of an implied
- * end tag but were not.
- *
- * @param eltPos the position of the start tag on the stack of the element
- * being closed.
- * @param name the name of the end tag
- *
- * @throws SAXException
- */
- private void errUnclosedElementsImplied(int eltPos, String name) throws SAXException {
- errNoCheck("End tag \u201C" + name + "\u201D implied, but there were open elements.");
- errListUnclosedStartTags(eltPos);
- }
-
- /**
- * Reports a state when elements expected to be closed ahead of an implied
- * table cell close.
- *
- * @param eltPos the position of the start tag on the stack of the element
- * being closed.
- * @throws SAXException
- */
- private void errUnclosedElementsCell(int eltPos) throws SAXException {
- errNoCheck("A table cell was implicitly closed, but there were open elements.");
- errListUnclosedStartTags(eltPos);
- }
-
- private void errStrayDoctype() throws SAXException {
- err("Stray doctype.");
- }
-
- private void errAlmostStandardsDoctype() throws SAXException {
- if (!isSrcdocDocument) {
- err("Almost standards mode doctype. Expected \u201C<!DOCTYPE html>\u201D.");
- }
- }
-
- private void errQuirkyDoctype() throws SAXException {
- if (!isSrcdocDocument) {
- err("Quirky doctype. Expected \u201C<!DOCTYPE html>\u201D.");
- }
- }
-
- private void errNonSpaceInTrailer() throws SAXException {
- err("Non-space character in page trailer.");
- }
-
- private void errNonSpaceAfterFrameset() throws SAXException {
- err("Non-space after \u201Cframeset\u201D.");
- }
-
- private void errNonSpaceInFrameset() throws SAXException {
- err("Non-space in \u201Cframeset\u201D.");
- }
-
- private void errNonSpaceAfterBody() throws SAXException {
- err("Non-space character after body.");
- }
-
- private void errNonSpaceInColgroupInFragment() throws SAXException {
- err("Non-space in \u201Ccolgroup\u201D when parsing fragment.");
- }
-
- private void errNonSpaceInNoscriptInHead() throws SAXException {
- err("Non-space character inside \u201Cnoscript\u201D inside \u201Chead\u201D.");
- }
-
- private void errFooBetweenHeadAndBody(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("\u201C" + name + "\u201D element between \u201Chead\u201D and \u201Cbody\u201D.");
- }
-
- private void errStartTagWithoutDoctype() throws SAXException {
- if (!isSrcdocDocument) {
- err("Start tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
- }
- }
-
- private void errNoSelectInTableScope() throws SAXException {
- err("No \u201Cselect\u201D in table scope.");
- }
-
- private void errStartSelectWhereEndSelectExpected() throws SAXException {
- err("\u201Cselect\u201D start tag where end tag expected.");
- }
-
- private void errStartTagWithSelectOpen(@Local String name)
- throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("\u201C" + name
- + "\u201D start tag with \u201Cselect\u201D open.");
- }
-
- private void errBadStartTagInHead(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("Bad start tag in \u201C" + name
- + "\u201D in \u201Chead\u201D.");
- }
-
- private void errImage() throws SAXException {
- err("Saw a start tag \u201Cimage\u201D.");
- }
-
- private void errIsindex() throws SAXException {
- err("\u201Cisindex\u201D seen.");
- }
-
- private void errFooSeenWhenFooOpen(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("An \u201C" + name + "\u201D start tag seen but an element of the same type was already open.");
- }
-
- private void errHeadingWhenHeadingOpen() throws SAXException {
- err("Heading cannot be a child of another heading.");
- }
-
- private void errFramesetStart() throws SAXException {
- err("\u201Cframeset\u201D start tag seen.");
- }
-
- private void errNoCellToClose() throws SAXException {
- err("No cell to close.");
- }
-
- private void errStartTagInTable(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("Start tag \u201C" + name
- + "\u201D seen in \u201Ctable\u201D.");
- }
-
- private void errFormWhenFormOpen() throws SAXException {
- err("Saw a \u201Cform\u201D start tag, but there was already an active \u201Cform\u201D element. Nested forms are not allowed. Ignoring the tag.");
- }
-
- private void errTableSeenWhileTableOpen() throws SAXException {
- err("Start tag for \u201Ctable\u201D seen but the previous \u201Ctable\u201D is still open.");
- }
-
- private void errStartTagInTableBody(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("\u201C" + name + "\u201D start tag in table body.");
- }
-
- private void errEndTagSeenWithoutDoctype() throws SAXException {
- if (!isSrcdocDocument) {
- err("End tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
- }
- }
-
- private void errEndTagAfterBody() throws SAXException {
- err("Saw an end tag after \u201Cbody\u201D had been closed.");
- }
-
- private void errEndTagSeenWithSelectOpen(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("\u201C" + name
- + "\u201D end tag with \u201Cselect\u201D open.");
- }
-
- private void errGarbageInColgroup() throws SAXException {
- err("Garbage in \u201Ccolgroup\u201D fragment.");
- }
-
- private void errEndTagBr() throws SAXException {
- err("End tag \u201Cbr\u201D.");
- }
-
- private void errNoElementToCloseButEndTagSeen(@Local String name)
- throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("No \u201C" + name + "\u201D element in scope but a \u201C"
- + name + "\u201D end tag seen.");
- }
-
- private void errHtmlStartTagInForeignContext(@Local String name)
- throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("HTML start tag \u201C" + name
- + "\u201D in a foreign namespace context.");
- }
-
- private void errTableClosedWhileCaptionOpen() throws SAXException {
- err("\u201Ctable\u201D closed but \u201Ccaption\u201D was still open.");
- }
-
- private void errNoTableRowToClose() throws SAXException {
- err("No table row to close.");
- }
-
- private void errNonSpaceInTable() throws SAXException {
- err("Misplaced non-space characters insided a table.");
- }
-
- private void errUnclosedChildrenInRuby() throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("Unclosed children in \u201Cruby\u201D.");
- }
-
- private void errStartTagSeenWithoutRuby(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("Start tag \u201C"
- + name
- + "\u201D seen without a \u201Cruby\u201D element being open.");
- }
-
- private void errSelfClosing() throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("Self-closing syntax (\u201C/>\u201D) used on a non-void HTML element. Ignoring the slash and treating as a start tag.");
- }
-
- private void errNoCheckUnclosedElementsOnStack() throws SAXException {
- errNoCheck("Unclosed elements on stack.");
- }
-
- private void errEndTagDidNotMatchCurrentOpenElement(@Local String name,
- @Local String currOpenName) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("End tag \u201C"
- + name
- + "\u201D did not match the name of the current open element (\u201C"
- + currOpenName + "\u201D).");
- }
-
- private void errEndTagViolatesNestingRules(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("End tag \u201C" + name + "\u201D violates nesting rules.");
- }
-
- private void errEofWithUnclosedElements() throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("End of file seen and there were open elements.");
- // just report all remaining unclosed elements
- errListUnclosedStartTags(0);
- }
-
- /**
- * Reports arriving at/near end of document with unclosed elements remaining.
- *
- * @param message
- * the message
- * @throws SAXException
- */
- private void errEndWithUnclosedElements(@Local String name) throws SAXException {
- if (errorHandler == null) {
- return;
- }
- errNoCheck("End tag for \u201C"
- + name
- + "\u201D seen, but there were unclosed elements.");
- // just report all remaining unclosed elements
- errListUnclosedStartTags(0);
- }
-}
diff --git a/parser/html/javasrc/UTF16Buffer.java b/parser/html/javasrc/UTF16Buffer.java
deleted file mode 100644
index ec79185ec..000000000
--- a/parser/html/javasrc/UTF16Buffer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2008-2010 Mozilla Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package nu.validator.htmlparser.impl;
-
-import nu.validator.htmlparser.annotation.NoLength;
-
-/**
- * An UTF-16 buffer that knows the start and end indeces of its unconsumed
- * content.
- *
- * @version $Id$
- * @author hsivonen
- */
-public final class UTF16Buffer {
-
- /**
- * The backing store of the buffer. May be larger than the logical content
- * of this <code>UTF16Buffer</code>.
- */
- private final @NoLength char[] buffer;
-
- /**
- * The index of the first unconsumed character in the backing buffer.
- */
- private int start;
-
- /**
- * The index of the slot immediately after the last character in the backing
- * buffer that is part of the logical content of this
- * <code>UTF16Buffer</code>.
- */
- private int end;
-
- //[NOCPP[
-
- /**
- * Constructor for wrapping an existing UTF-16 code unit array.
- *
- * @param buffer
- * the backing buffer
- * @param start
- * the index of the first character to consume
- * @param end
- * the index immediately after the last character to consume
- */
- public UTF16Buffer(@NoLength char[] buffer, int start, int end) {
- this.buffer = buffer;
- this.start = start;
- this.end = end;
- }
-
- // ]NOCPP]
-
- /**
- * Returns the start index.
- *
- * @return the start index
- */
- public int getStart() {
- return start;
- }
-
- /**
- * Sets the start index.
- *
- * @param start
- * the start index
- */
- public void setStart(int start) {
- this.start = start;
- }
-
- /**
- * Returns the backing buffer.
- *
- * @return the backing buffer
- */
- public @NoLength char[] getBuffer() {
- return buffer;
- }
-
- /**
- * Returns the end index.
- *
- * @return the end index
- */
- public int getEnd() {
- return end;
- }
-
- /**
- * Checks if the buffer has data left.
- *
- * @return <code>true</code> if there's data left
- */
- public boolean hasMore() {
- return start < end;
- }
-
- /**
- * Returns <code>end - start</code>.
- *
- * @return <code>end - start</code>
- */
- public int getLength() {
- return end - start;
- }
-
- /**
- * Adjusts the start index to skip over the first character if it is a line
- * feed and the previous character was a carriage return.
- *
- * @param lastWasCR
- * whether the previous character was a carriage return
- */
- public void adjust(boolean lastWasCR) {
- if (lastWasCR && buffer[start] == '\n') {
- start++;
- }
- }
-
- /**
- * Sets the end index.
- *
- * @param end
- * the end index
- */
- public void setEnd(int end) {
- this.end = end;
- }
-}