/** Handle End Tag. */ protected void handleEndTag(TagElement tag) { Element elem = tag.getElement(); if (elem == dtd.body) { inbody--; } else if (elem == dtd.title) { intitle--; seentitle = true; } else if (elem == dtd.head) { inhead--; } else if (elem == dtd.style) { instyle--; } if (debugFlag) { debug("End Tag: " + tag.getHTMLTag() + " pos: " + getCurrentPos()); } callback.handleEndTag(tag.getHTMLTag(), getBlockStartPosition()); }
/** Handle Start Tag. */ protected void handleStartTag(TagElement tag) { Element elem = tag.getElement(); if (elem == dtd.body) { inbody++; } else if (elem == dtd.html) { } else if (elem == dtd.head) { inhead++; } else if (elem == dtd.title) { intitle++; } else if (elem == dtd.style) { instyle++; } if (debugFlag) { if (tag.fictional()) { debug("Start Tag: " + tag.getHTMLTag() + " pos: " + getCurrentPos()); } else { debug( "Start Tag: " + tag.getHTMLTag() + " attributes: " + getAttributes() + " pos: " + getCurrentPos()); } } if (tag.fictional()) { SimpleAttributeSet attrs = new SimpleAttributeSet(); attrs.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED, Boolean.TRUE); callback.handleStartTag(tag.getHTMLTag(), attrs, getBlockStartPosition()); } else { callback.handleStartTag(tag.getHTMLTag(), getAttributes(), getBlockStartPosition()); flushAttributes(); } }
/** Handle Empty Tag. */ protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException { Element elem = tag.getElement(); if (elem == dtd.meta && !ignoreCharSet) { SimpleAttributeSet atts = getAttributes(); if (atts != null) { String content = (String) atts.getAttribute(HTML.Attribute.CONTENT); if (content != null) { if ("content-type" .equalsIgnoreCase((String) atts.getAttribute(HTML.Attribute.HTTPEQUIV))) { throw new ChangedCharSetException(content, false); } else if ("charset" .equalsIgnoreCase((String) atts.getAttribute(HTML.Attribute.HTTPEQUIV))) { throw new ChangedCharSetException(content, true); } } } } if (inbody != 0 || elem == dtd.meta || elem == dtd.base || elem == dtd.isindex || elem == dtd.style || elem == dtd.link) { if (debugFlag) { if (tag.fictional()) { debug("Empty Tag: " + tag.getHTMLTag() + " pos: " + getCurrentPos()); } else { debug( "Empty Tag: " + tag.getHTMLTag() + " attributes: " + getAttributes() + " pos: " + getCurrentPos()); } } if (tag.fictional()) { SimpleAttributeSet attrs = new SimpleAttributeSet(); attrs.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED, Boolean.TRUE); callback.handleSimpleTag(tag.getHTMLTag(), attrs, getBlockStartPosition()); } else { callback.handleSimpleTag(tag.getHTMLTag(), getAttributes(), getBlockStartPosition()); flushAttributes(); } } }