/** * @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); } }
private void addAttributesToHtml(HtmlAttributes attributes) throws SAXException { // [NOCPP[ checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); // ]NOCPP] addAttributesToElement(stack[0].node, attributes); }
if (charBufferLen > 0) { if ((mode == IN_TABLE || mode == IN_TABLE_BODY || mode == IN_ROW) && charBufferContainsNonWhitespace()) { errNonSpaceInTable(); reconstructTheActiveFormattingElements(); if (!stack[currentPtr].isFosterParenting()) { appendCharacters(currentNode(), charBuffer, 0, charBufferLen); charBufferLen = 0; return; int eltPos = findLastOrRoot(TreeBuilder.TABLE); StackNode<T> node = stack[eltPos]; T elt = node.node; if (eltPos == 0) { appendCharacters(elt, charBuffer, 0, charBufferLen); charBufferLen = 0; return; insertFosterParentedCharacters(charBuffer, 0, charBufferLen, elt, stack[eltPos - 1].node); charBufferLen = 0; return; appendCharacters(currentNode(), charBuffer, 0, charBufferLen); charBufferLen = 0;
public final void startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) throws SAXException { flushCharacters(); 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 int group = elementName.getGroup(); @Local String name = elementName.getName(); if (isInForeign()) { StackNode<T> currentNode = stack[currentPtr]; @NsUri String currNs = currentNode.ns; errHtmlStartTagInForeignContext(name); if (!fragment) { while (!isSpecialParentInForeign(stack[currentPtr])) { pop(); attributes.adjustForSvg(); if (selfClosing) { appendVoidElementToCurrentMayFosterSVG( elementName, attributes); selfClosing = false; } else { appendToCurrentNodeAndPushElementMayFosterSVG( elementName, attributes);
public final void endTag(ElementName elementName) throws SAXException { flushCharacters(); needToDropLF = false; int eltPos; @Local String name = elementName.name; endtagloop: for (;;) { if (isInForeign()) { if (stack[currentPtr].name != name) { errEndTagDidNotMatchCurrentOpenElement(name, stack[currentPtr].popName); if (stack[eltPos].name == name) { while (currentPtr >= eltPos) { pop(); switch (group) { case TR: eltPos = findLastOrRoot(TreeBuilder.TR); if (eltPos == 0) { assert fragment; errNoTableRowToClose(); break endtagloop; clearStackBackTo(eltPos); pop(); mode = IN_TABLE_BODY; break endtagloop; case TABLE: eltPos = findLastOrRoot(TreeBuilder.TR); if (eltPos == 0) {
case IN_CELL: case IN_CAPTION: if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) { reconstructTheActiveFormattingElements(); accumulateCharacters(buf, start, length); return; case IN_TABLE: case IN_TABLE_BODY: case IN_ROW: accumulateCharactersForced(buf, start, length); return; default: case IN_CAPTION: if (start < i) { accumulateCharacters(buf, start, i - start); start = i; if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) { flushCharacters(); reconstructTheActiveFormattingElements(); case IN_TABLE_BODY: case IN_ROW: accumulateCharactersForced(buf, i, 1); start = i + 1; continue;
findInListOfActiveFormattingElements(stack[currentPtr]) == -1) { pop(); return true; errNoElementToCloseButEndTagSeen(name); removeFromListOfActiveFormattingElements(formattingEltListPos); return true; errNoElementToCloseButEndTagSeen(name); return true; errEndTagViolatesNestingRules(name); pop(); removeFromListOfActiveFormattingElements(formattingEltListPos); return true; int nodeListPos = findInListOfActiveFormattingElements(node); removeFromListOfActiveFormattingElements(nodeListPos); assert bookmark < nodePos; assert furthestBlockPos > nodePos; removeFromStack(nodePos); // node is now a bad pointer in C++ furthestBlockPos--; continue;
@Local String popName = elementName.getName(); checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML"); if (!elementName.isInterned()) { popName = checkPopName(popName); && annotationXmlEncodingPermitsHtml(attributes)) { markAsHtmlIntegrationPoint = true; StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, current.node appendElement(elt, current.node); StackNode<T> node = createStackNode(elementName, elt, popName, markAsHtmlIntegrationPoint push(node);
throws SAXException { checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes T currentNode = nodeFromStackWithBlinkCompat(currentPtr); elt = createElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes, currentNode appendElement(elt, currentNode); StackNode<T> node = createStackNode(elementName, elt, clone push(node); append(node);
@Local String popName = elementName.name; checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML"); if (elementName.isCustom()) { popName = checkPopName(popName); T elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); && annotationXmlEncodingPermitsHtml(attributes)) { markAsHtmlIntegrationPoint = true; 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 T elt = createElement("http://www.w3.org/1999/xhtml", elementName.name, attributes); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); insertIntoFosterParent(elt); } else { appendElement(elt, current.node); } StackNode<T> node = new StackNode<T>(elementName, elt, attributes.cloneAttributes(null) // [NOCPP[ , errorHandler == null ? null : new TaintableLocatorImpl(tokenizer) // ]NOCPP] ); push(node); append(node); node.retain(); // append doesn't retain itself }
protected void accumulateCharacters(@Const @NoLength char[] buf, int start, int length) throws SAXException { appendCharacters(stack[currentPtr].node, buf, start, length); }
@Inline private void insertMarker() { append(null); }
public final void startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) throws SAXException { flushCharacters(); 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 int group = elementName.getGroup(); @Local String name = elementName.getName(); if (isInForeign()) { StackNode<T> currentNode = stack[currentPtr]; @NsUri String currNs = currentNode.ns; errHtmlStartTagInForeignContext(name); if (!fragment) { while (!isSpecialParentInForeign(stack[currentPtr])) { pop(); attributes.adjustForSvg(); if (selfClosing) { appendVoidElementToCurrentMayFosterSVG( elementName, attributes); selfClosing = false; } else { appendToCurrentNodeAndPushElementMayFosterSVG( elementName, attributes);
public final void endTag(ElementName elementName) throws SAXException { flushCharacters(); needToDropLF = false; int eltPos; @Local String name = elementName.getName(); endtagloop: for (;;) { if (isInForeign()) { if (stack[currentPtr].name != name) { if (currentPtr == 0) { errStrayEndTag(name); } else { errEndTagDidNotMatchCurrentOpenElement(name, stack[currentPtr].popName); pop(); errStrayEndTag(name); break endtagloop; switch (group) { case TR: eltPos = findLastOrRoot(TreeBuilder.TR); if (eltPos == 0) { assert fragment || isTemplateContents(); errNoTableRowToClose(); break endtagloop; clearStackBackTo(eltPos); pop(); mode = IN_TABLE_BODY;
case IN_CELL: case IN_CAPTION: if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) { reconstructTheActiveFormattingElements(); accumulateCharacters(buf, start, length); return; case IN_TABLE: case IN_TABLE_BODY: case IN_ROW: accumulateCharactersForced(buf, start, length); return; default: case IN_CAPTION: if (start < i) { accumulateCharacters(buf, start, i - start); start = i; if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) { flushCharacters(); reconstructTheActiveFormattingElements(); case IN_TABLE_BODY: case IN_ROW: accumulateCharactersForced(buf, i, 1); start = i + 1; continue;
findInListOfActiveFormattingElements(stack[currentPtr]) == -1) { pop(); return true; errNoElementToCloseButEndTagSeen(name); removeFromListOfActiveFormattingElements(formattingEltListPos); return true; errNoElementToCloseButEndTagSeen(name); return true; errEndTagViolatesNestingRules(name); pop(); removeFromListOfActiveFormattingElements(formattingEltListPos); return true; T insertionCommonAncestor = nodeFromStackWithBlinkCompat(formattingEltStackPos - 1); // weak ref int nodeListPos = findInListOfActiveFormattingElements(node); removeFromListOfActiveFormattingElements(nodeListPos); assert bookmark < nodePos; assert furthestBlockPos > nodePos; removeFromStack(nodePos); // node is now a bad pointer in C++ furthestBlockPos--;
@Local String popName = elementName.getName(); checkAttributes(attributes, "http://www.w3.org/1998/Math/MathML"); if (!elementName.isInterned()) { popName = checkPopName(popName); && annotationXmlEncodingPermitsHtml(attributes)) { markAsHtmlIntegrationPoint = true; StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); elt = createAndInsertFosterParentedElement("http://www.w3.org/1998/Math/MathML", popName, attributes T currentNode = nodeFromStackWithBlinkCompat(currentPtr); elt = createElement("http://www.w3.org/1998/Math/MathML", popName, attributes, currentNode appendElement(elt, currentNode); StackNode<T> node = createStackNode(elementName, elt, popName, markAsHtmlIntegrationPoint push(node);
throws SAXException { checkAttributes(attributes, "http://www.w3.org/1999/xhtml"); StackNode<T> current = stack[currentPtr]; if (current.isFosterParenting()) { fatal(); elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes elt = createElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes, current.node appendElement(elt, current.node); StackNode<T> node = createStackNode(elementName, elt, clone push(node); append(node);
protected void accumulateCharacters(@Const @NoLength char[] buf, int start, int length) throws SAXException { appendCharacters(stack[currentPtr].node, buf, start, length); }