diff options
Diffstat (limited to 'parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java')
-rw-r--r-- | parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java | 157 |
1 files changed, 73 insertions, 84 deletions
diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java index db0775e18..5e1a93bfd 100644 --- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java +++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/TreeBuilder.java @@ -2326,85 +2326,74 @@ public abstract class TreeBuilder<T> implements TokenHandler, 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; + // CPPONLY:case ISINDEX: + // CPPONLY: errIsindex(); + // CPPONLY: if (formPointer != null && !isTemplateContents()) { + // CPPONLY: break starttagloop; + // CPPONLY: } + // CPPONLY: implicitlyCloseP(); + // CPPONLY: HtmlAttributes formAttrs = new HtmlAttributes(0); + // CPPONLY: int actionIndex = attributes.getIndex(AttributeName.ACTION); + // CPPONLY: if (actionIndex > -1) { + // CPPONLY: formAttrs.addAttribute( + // CPPONLY: AttributeName.ACTION, + // CPPONLY: attributes.getValueNoBoundsCheck(actionIndex), + // CPPONLY: attributes.getLineNoBoundsCheck(actionIndex) + // CPPONLY: ); + // CPPONLY: } + // CPPONLY: appendToCurrentNodeAndPushFormElementMayFoster(formAttrs); + // CPPONLY: appendVoidElementToCurrentMayFoster( + // CPPONLY: ElementName.HR, + // CPPONLY: HtmlAttributes.EMPTY_ATTRIBUTES); + // CPPONLY: appendToCurrentNodeAndPushElementMayFoster( + // CPPONLY: ElementName.LABEL, + // CPPONLY: HtmlAttributes.EMPTY_ATTRIBUTES); + // CPPONLY: int promptIndex = attributes.getIndex(AttributeName.PROMPT); + // CPPONLY: if (promptIndex > -1) { + // CPPONLY: @Auto char[] prompt = Portability.newCharArrayFromString(attributes.getValueNoBoundsCheck(promptIndex)); + // CPPONLY: appendCharacters(stack[currentPtr].node, + // CPPONLY: prompt, 0, prompt.length); + // CPPONLY: } else { + // CPPONLY: appendIsindexPrompt(stack[currentPtr].node); + // CPPONLY: } + // CPPONLY: HtmlAttributes inputAttributes = new HtmlAttributes( + // CPPONLY: 0); + // CPPONLY: inputAttributes.addAttribute( + // CPPONLY: AttributeName.NAME, + // CPPONLY: Portability.newStringFromLiteral("isindex"), + // CPPONLY: tokenizer.getLineNumber() + // CPPONLY: ); + // CPPONLY: for (int i = 0; i < attributes.getLength(); i++) { + // CPPONLY: @Local String attributeQName = attributes.getLocalNameNoBoundsCheck(i); + // CPPONLY: if ("name" == attributeQName + // CPPONLY: || "prompt" == attributeQName) { + // CPPONLY: attributes.releaseValue(i); + // CPPONLY: } else if ("action" != attributeQName) { + // CPPONLY: inputAttributes.AddAttributeWithLocal( + // CPPONLY: attributeQName, + // CPPONLY: attributes.getValueNoBoundsCheck(i), + // CPPONLY: attributes.getLineNoBoundsCheck(i) + // CPPONLY: ); + // CPPONLY: } + // CPPONLY: } + // CPPONLY: attributes.clearWithoutReleasingContents(); + // CPPONLY: appendVoidElementToCurrentMayFoster( + // CPPONLY: "input", + // CPPONLY: inputAttributes, formPointer); + // CPPONLY: pop(); // label + // CPPONLY: appendVoidElementToCurrentMayFoster( + // CPPONLY: ElementName.HR, + // CPPONLY: HtmlAttributes.EMPTY_ATTRIBUTES); + // CPPONLY: pop(); // form + // CPPONLY: + // CPPONLY: if (!isTemplateContents()) { + // CPPONLY: formPointer = null; + // CPPONLY: } + // CPPONLY: + // CPPONLY: selfClosing = false; + // CPPONLY: // Don't delete attributes, they are deleted + // CPPONLY: // later + // CPPONLY: break starttagloop; case TEXTAREA: appendToCurrentNodeAndPushElementMayFoster( elementName, @@ -3837,7 +3826,7 @@ public abstract class TreeBuilder<T> implements TokenHandler, case INPUT: case KEYGEN: // XXX?? case HR: - case ISINDEX: + // CPPONLY: case ISINDEX: case IFRAME: case NOEMBED: // XXX??? case NOFRAMES: // XXX?? @@ -5681,7 +5670,7 @@ public abstract class TreeBuilder<T> implements TokenHandler, protected abstract void appendCharacters(T parent, @NoLength char[] buf, int start, int length) throws SAXException; - protected abstract void appendIsindexPrompt(T parent) throws SAXException; + // CPPONLY: protected abstract void appendIsindexPrompt(T parent) throws SAXException; protected abstract void appendComment(T parent, @NoLength char[] buf, int start, int length) throws SAXException; @@ -6377,9 +6366,9 @@ public abstract class TreeBuilder<T> implements TokenHandler, err("Saw a start tag \u201Cimage\u201D."); } - private void errIsindex() throws SAXException { - err("\u201Cisindex\u201D seen."); - } + // CPPONLY: private void errIsindex() throws SAXException { + // CPPONLY: err("\u201Cisindex\u201D seen."); + // CPPONLY: } private void errFooSeenWhenFooOpen(@Local String name) throws SAXException { if (errorHandler == null) { |