/** * Indicates whether this element is an <a target="_blank" href="http://www.w3.org/TR/REC-xml#dt-eetag">empty-element tag</a>. * <p> * This is equivalent to {@link #getStartTag()}<code>.</code>{@link StartTag#isEmptyElementTag() isEmptyElementTag()}. * * @return <code>true</code> if this element is an <a target="_blank" href="http://www.w3.org/TR/REC-xml#dt-eetag">empty-element tag</a>, otherwise <code>false</code>. */ public boolean isEmptyElementTag() { return startTag.isEmptyElementTag(); }
private void processStartTag( StartTag tag ) { if( "<".equals( tag.getTagType().getStartDelimiter() ) ) { stack.push( new Level( tag ) ); writer.write( "<" ); writer.write( tag.getNameSegment().toString() ); Attributes attributes = tag.getAttributes(); if( !attributes.isEmpty() ) { for( Attribute attribute : attributes ) { processAttribute( attribute ); } } if( tag.toString().trim().endsWith( "/>" ) || tag.isEmptyElementTag() ) { stack.pop(); writer.write( "/>" ); } else { writer.write( ">" ); } } else { writer.write( tag.toString() ); } }
private void processStartTag( StartTag tag ) { if( "<".equals( tag.getTagType().getStartDelimiter() ) ) { Element e = document.createElement( tag.getNameSegment().toString() ); stack.push( new Level( tag ) ); writer.write( "<" ); writer.write( tag.getNameSegment().toString() ); Attributes attributes = tag.getAttributes(); if( !attributes.isEmpty() ) { for( Attribute attribute : attributes ) { processAttribute( attribute ); } } if( tag.toString().trim().endsWith( "/>" ) || tag.isEmptyElementTag() ) { stack.pop(); writer.write( "/>" ); } else { writer.write( ">" ); } } else { writer.write( tag.toString() ); } }
private static final Tag parseAllgetNextTag(final Source source, final ParseText parseText, final int pos, final boolean assumeNoNestedTags) { try { int begin=pos; do { begin=parseText.indexOf('<',begin); // this assumes that all tags start with '<' if (begin==-1) return null; final Tag tag=TagType.getTagAt(source,begin,false,assumeNoNestedTags); if (tag!=null) { if (!assumeNoNestedTags) { // POSSIBLE BUG: // It appears that this code should be executed even if assumeNoNestedTags is true. // This was originally not the case when first created, but the subsequent addition of the SCRIPT element handling means it should always be executed. // This should be proven and fixed if assumeNoNestedTags is ever allowed to be true (at present it is hard coded to false). final TagType tagType=tag.getTagType(); if (tag.end>source.fullSequentialParseData[0] && tagType!=StartTagType.DOCTYPE_DECLARATION && tagType!=StartTagType.UNREGISTERED && tagType!=EndTagType.UNREGISTERED) { source.fullSequentialParseData[0]=(tagType==StartTagType.NORMAL && tag.name==HTMLElementName.SCRIPT && !((StartTag)tag).isEmptyElementTag()) ? Integer.MAX_VALUE : tag.end; } } return tag; } } while ((begin+=1)<source.end); } catch (IndexOutOfBoundsException ex) { // this should only happen when the end of file is reached in the middle of a tag. // we don't have to do anything to handle it as there are no more tags anyway. } return null; }
if (startTag.getStartTagType().getCorrespondingEndTagType()==null) continue; if (HTMLElements.getEndTagForbiddenElementNames().contains(startTag.getName())) continue; if (startTag.isEmptyElementTag()) continue; depth++; if (depth>maxDepth) maxDepth++;
if (!startTag.isEmptyElementTag() && !startTag.isEndTagForbidden()) {//e.g. not "<br>" tagInfo.ensureCapacity(tagInfo.size() + 5); final int parentTag = thisTag;
if (!startTag.isEmptyElementTag() && !startTag.isEndTagForbidden() && !startTag.isSyntacticalEmptyElementTag()) {//e.g. not "<br>" tagInfo.ensureCapacity(tagInfo.size() + 5); final int parentTag = thisTag;
final TagType tagType=tag.getTagType(); if (tag.end>source.fullSequentialParseData[0] && tagType!=StartTagType.DOCTYPE_DECLARATION) { source.fullSequentialParseData[0]=(tagType==StartTagType.NORMAL && tag.name==HTMLElementName.SCRIPT && !((StartTag)tag).isEmptyElementTag()) ? Integer.MAX_VALUE : tag.end;