/** * Indicates whether a matching end tag is required. * <p> * This property returns <code>true</code> if one of the following conditions is met: * <ul> * <li>The {@linkplain #getStartTagType() type} of this start tag is NOT {@link StartTagType#NORMAL}, but specifies a * {@linkplain StartTagType#getCorrespondingEndTagType() corresponding end tag type}. * <li>The {@linkplain #getName() name} of this start tag indicates it is the start of an * <a href="Element.html#HTML">HTML element</a> whose {@linkplain HTMLElements#getEndTagRequiredElementNames() end tag is required}. * <li>This start tag is NOT {@linkplain #isSyntacticalEmptyElementTag() syntactically an empty-element tag} and its * {@linkplain #getName() name} indicates it is the start of a <a href="HTMLElements.html#NonHTMLElement">non-HTML element</a>. * </ul> * * @return <code>true</code> if a matching end tag is required, otherwise <code>false</code>. */ public boolean isEndTagRequired() { if (getStartTagType()!=StartTagType.NORMAL) return getStartTagType().getCorrespondingEndTagType()!=null; if (HTMLElements.getEndTagRequiredElementNames().contains(name)) return true; if (HTMLElements.getElementNames().contains(name)) return false; return !isSyntacticalEmptyElementTag(); }
/** * Indicates whether a matching end tag is forbidden. * <p> * This property returns <code>true</code> if one of the following conditions is met: * <ul> * <li>The {@linkplain #getStartTagType() type} of this start tag does not specify a * {@linkplain StartTagType#getCorrespondingEndTagType() corresponding end tag type}. * <li>The {@linkplain #getName() name} of this start tag indicates it is the start of an * <a href="Element.html#HTML">HTML element</a> whose {@linkplain HTMLElements#getEndTagForbiddenElementNames() end tag is forbidden}. * <li>This start tag is {@linkplain #isSyntacticalEmptyElementTag() syntactically an empty-element tag} and its * {@linkplain #getName() name} indicates it is the start of a <a href="HTMLElements.html#NonHTMLElement">non-HTML element</a>. * </ul> * <p> * If this property returns <code>true</code> then this start tag's {@linkplain #getElement() element} will always be a * <a href="Element.html#SingleTag">single tag element</a>. * * @return <code>true</code> if a matching end tag is forbidden, otherwise <code>false</code>. */ public boolean isEndTagForbidden() { if (getStartTagType()!=StartTagType.NORMAL) return getStartTagType().getCorrespondingEndTagType()==null; if (HTMLElements.getEndTagForbiddenElementNames().contains(name)) return true; if (HTMLElements.getElementNames().contains(name)) return false; return isSyntacticalEmptyElementTag(); }
if (tag instanceof StartTag) { StartTag startTag=(StartTag)tag; if (startTag.getStartTagType().getCorrespondingEndTagType()==null) continue; if (HTMLElements.getEndTagForbiddenElementNames().contains(startTag.getName())) continue; if (startTag.isEmptyElementTag()) continue;
private EndTag getEndTagInternal() { boolean checkForEmptyElementTag=true; final EndTagType endTagType=startTagType.getCorrespondingEndTagType(); if (startTagType==StartTagType.NORMAL) {