Bug 539434 follow-up - Sync the Java sources of the HTML5 parser with the htmlparser repository. rs=sicking. NPOTB.

This commit is contained in:
Henri Sivonen
2010-03-26 09:50:20 +02:00
parent 81c14185b4
commit 070ff9188e
8 changed files with 3066 additions and 1063 deletions

View File

@@ -28,6 +28,7 @@ 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;
@@ -447,6 +448,25 @@ public final class HtmlAttributes implements Attributes {
mode = AttributeName.SVG;
}
public HtmlAttributes cloneAttributes(Interner interner) throws SAXException {
assert (length == 0 && xmlnsLength == 0) || 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]
);
}
// [NOCPP[
for (int i = 0; i < xmlnsLength; i++) {
clone.addAttribute(xmlnsNames[i],
xmlnsValues[i], XmlViolationPolicy.ALLOW);
}
// ]NOCPP]
return clone; // XXX!!!
}
// [NOCPP[
void processNonNcNames(TreeBuilder<?> treeBuilder, XmlViolationPolicy namePolicy) throws SAXException {
@@ -481,6 +501,7 @@ public final class HtmlAttributes implements Attributes {
}
}
// ]NOCPP]
}