Tag getPreviousNonServerTag(int pos) { while (true) { final Tag tag=getPreviousTag(pos-1); if (tag==null) return null; if (!tag.getTagType().isServerTag()) return tag; pos=tag.begin-1; } }
Tag getNextNonServerTag(int pos) { while (true) { final Tag tag=getNextTag(pos); if (tag==null) return null; if (!tag.getTagType().isServerTag()) return tag; pos=tag.end; } }
static final Tag getTagAt(final Source source, final int pos, final boolean serverTagOnly, final boolean assumeNoNestedTags) { final TagTypeRegister.ProspectiveTagTypeIterator prospectiveTagTypeIterator=new TagTypeRegister.ProspectiveTagTypeIterator(source,pos); // prospectiveTagTypeIterator is empty if pos is out of range. while (prospectiveTagTypeIterator.hasNext()) { final TagType tagType=prospectiveTagTypeIterator.next(); if (serverTagOnly && !tagType.isServerTag()) continue; if (!assumeNoNestedTags && !tagType.isValidPosition(source,pos,source.fullSequentialParseData)) continue; try { final Tag tag=tagType.constructTagAt(source,pos); if (tag!=null) return tag; } catch (IndexOutOfBoundsException ex) { if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(pos).appendTo(new StringBuilder(200).append("Tag at ")).append(" not recognised as type '").append(tagType.getDescription()).append("' because it has no end delimiter").toString()); } } return null; }
final StartTag childStartTag=source.getNextStartTag(pos); if (childStartTag==null || childStartTag.begin>=end) break; if (!Config.IncludeServerTagsInElementHierarchy && childStartTag.getTagType().isServerTag()) { pos=childStartTag.end; continue;
if (childStartTag==null || childStartTag.begin>=maxChildBegin) break; if (Config.IncludeServerTagsInElementHierarchy) { if (childStartTag.begin<startTag.end && !childStartTag.getTagType().isServerTag() && !startTag.getTagType().isServerTag()) { continue; } else if (childStartTag.getTagType().isServerTag()) { pos=childStartTag.end; continue;
public Tag getTagAt(final int pos, final boolean serverTagOnly) { // This must only be called on allTagTypesSubCache (ie tagType==null) if (cache.getSourceLength()==0) return null; if (pos<0 || pos>=cache.getSourceLength()) return null; final int index=getIndexOfPos(pos); final CacheEntry cacheEntry=array[index]; if (cacheEntry.pos==pos) { if (serverTagOnly && !cacheEntry.tag.getTagType().isServerTag()) return null; return cacheEntry.tag; } if (cacheEntry.previousCached) return null; return cache.addTagAt(pos,serverTagOnly); }
final StartTag childStartTag=source.getNextStartTag(pos); if (childStartTag==null) break; if (!Config.IncludeServerTagsInElementHierarchy && childStartTag.getTagType().isServerTag()) { pos=childStartTag.end; continue;
if (segment instanceof Tag) { final Tag tag=(Tag)segment; if (tag.getTagType().isServerTag()) {
final int tagEnd=(tag.end<end) ? tag.end : end; assert index<tagEnd; if (tag.getTagType()==StartTagType.COMMENT || tag.getTagType()==StartTagType.CDATA_SECTION || tag.getTagType().isServerTag()) { appendTextPreserveIndentation(tagEnd,depth); } else if (tidyTags) { return; if ((tag.name==HTMLElementName.SCRIPT && !indentScriptElements) || tag.getTagType().isServerTag()) {