private void processEndTag( EndTag tag ) { while( !stack.isEmpty() ) { Level popped = stack.pop(); if( popped.getTag().getName().equalsIgnoreCase( tag.getName() ) ) { break; } } writer.write( tag.toString() ); }
private void processEndTag( EndTag tag ) { while( !stack.isEmpty() ) { Level popped = stack.pop(); if( popped.getTag().getName().equalsIgnoreCase( tag.getName() ) ) { break; } } writer.write( tag.toString() ); }
private String getClosingTagsBehindElement(Element element) { StringBuilder closingTags = new StringBuilder(); Element parent = element.getParentElement(); while (parent != null) { closingTags.append( (parent.getEndTag() == null) ? "" : ("</" + parent.getEndTag().getName() + ">") ); parent = parent.getParentElement(); } return closingTags.toString(); }
protected RULE_TYPE updateEndTagRuleState(EndTag endTag) { RULE_TYPE ruleType = getConfig().getElementRuleTypeCandidate(endTag.getName()); RuleType currentState = null; if (!currentState.ruleName.equalsIgnoreCase(endTag.getName())) { String character = Integer.toString(endTag.getBegin()); throw new OkapiBadFilterInputException("End tag " + endTag.getName() + " and start tag " + currentState.ruleName + " do not match at character number " + character);
private Segment[] getEndTag(final int afterPos, final StartTag nextStartTag, final EndTag nextEndTag, final boolean checkForEmptyElementTag, final boolean isXMLTagName) { // returns null if no end tag exists in the rest of the file, otherwise the following two segments: // first is the matching end tag to this start tag. Must be present if array is returned. // second is the next occurrence after the returned end tag of a start tag of the same name. (null if none exists) if (nextEndTag==null) return null; // no end tag in the rest of the file final Segment[] returnArray={nextEndTag,nextStartTag}; if (nextStartTag==null || nextStartTag.begin>nextEndTag.begin) return returnArray; // no more start tags of the same name in rest of file, or they occur after the end tag that we found. This means we have found the matching end tag. final Segment[] getResult=nextStartTag.getEndTag(nextEndTag,checkForEmptyElementTag,isXMLTagName); // get the matching end tag to the interloping start tag if (getResult==null) return null; // no end tag in the rest of the file final EndTag nextStartTagsEndTag=(EndTag)getResult[0]; final EndTag nextNextEndTag=EndTag.getNext(source,nextStartTagsEndTag.end,nextEndTag.getName(),nextEndTag.getEndTagType()); // get end tag after the interloping start tag's end tag return getEndTag(nextStartTagsEndTag.end,(StartTag)getResult[1],nextNextEndTag,checkForEmptyElementTag,isXMLTagName); // recurse to see if this is the matching end tag } }
if (begin==-1) return null; final EndTag endTag=(EndTag)source.getTagAt(begin); if (endTag!=null && endTag.getEndTagType()==endTagType && name.equals(endTag.getName())) return endTag; } while ((begin-=1)>=0); } catch (IndexOutOfBoundsException ex) {
if (begin==-1) return null; final EndTag endTag=(EndTag)source.getTagAt(begin); if (endTag!=null && endTag.getEndTagType()==endTagType && name.equals(endTag.getName())) return endTag; } while ((begin+=1)<source.end); } catch (IndexOutOfBoundsException ex) {
RULE_TYPE ruleType = getConfig().getElementRuleTypeCandidate(endTag.getName()); RuleType currentState = null; try { currentState = getRuleState().peekInlineRule(); if (currentState.ruleName.equalsIgnoreCase(endTag.getName())) { currentState = getRuleState().popInlineRule(); ruleType = currentState.ruleType; if (!currentState.ruleName.equalsIgnoreCase(endTag.getName())) { String character = Integer.toString(endTag.getBegin()); LOGGER.debug("End tag {} and start tag {} do not match at character number {}", endTag.getName(), currentState.ruleName, character);
while (nextTag != null && !nextTag.getName().equalsIgnoreCase(elem.getName())) { nextTag = elem.getSource().getNextEndTag(nextTag.getEnd()); if (nextTag.getName().equalsIgnoreCase(elem.getName())) { final String cfscript = elem.getSource().subSequence(elem.getStartTag().getEnd(), nextTag.getBegin()) .toString();
sTagName = endTag.getName(); // DWH 2-26-09
while (nextTag != null && !nextTag.getName().equalsIgnoreCase(elem.getName())) { nextTag = elem.getSource().getNextEndTag(nextTag.getEnd()); if (nextTag.getName().equalsIgnoreCase(elem.getName())) { cfscript = elem.getSource().subSequence(elem.getStartTag().getEnd(), nextTag.getBegin()) .toString();
while (nextTag != null && !nextTag.getName().equalsIgnoreCase(elem.getName())) { nextTag = elem.getSource().getNextEndTag(nextTag.getEnd()); if (nextTag.getName().equalsIgnoreCase(elem.getName())) { cfscript = elem.getSource().subSequence(elem.getStartTag().getEnd(), nextTag.getBegin()) .toString();
if (getConfig().isRuleType(endTag.getName(), RULE_TYPE.PRESERVE_WHITESPACE)) { ruleState.popPreserverWhitespaceRule(); setPreserveWhitespace(ruleState.isPreserveWhitespaceState()); } else if (ruleState.peekPreserverWhitespaceRule().ruleName.equalsIgnoreCase(endTag.getName())) { ruleState.popPreserverWhitespaceRule(); setPreserveWhitespace(ruleState.isPreserveWhitespaceState()); if (getConfig().isRuleType(endTag.getName(), RULE_TYPE.PRESERVE_WHITESPACE)) { ruleState.popPreserverWhitespaceRule(); setPreserveWhitespace(ruleState.isPreserveWhitespaceState()); } else if (ruleState.peekPreserverWhitespaceRule().ruleName.equalsIgnoreCase(endTag.getName())) { ruleState.popPreserverWhitespaceRule(); setPreserveWhitespace(ruleState.isPreserveWhitespaceState());