/** * Parses the content using provided lagarto parser. */ protected Document doParse(final LagartoParser lagartoParser) { lagartoParser.setConfig(config); LagartoDOMBuilderTagVisitor domBuilderTagVisitor = new LagartoDOMBuilderTagVisitor(this); lagartoParser.parse(domBuilderTagVisitor); return domBuilderTagVisitor.getDocument(); }
case START: if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); removeLastChildNodeIfEmptyText(parentNode, true); Node matchingParent = findMatchingParentOpenTag(tagName); error("Orphan closed tag ignored: </" + tagName + "> " + tag.getTagPosition()); break; fixUnclosedTagsUpToMatchingParent(tag, matchingParent); removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); parentNode.addChild(node); break;
error("Unclosed tag closed: <" + thisNode.getNodeName() + ">"); removeLastChildNodeIfEmptyText(parentNode, true);
@Override public void script(final Tag tag, final CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
@Override public void comment(final CharSequence comment) { if (!enabled) { return; } if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); } if (domBuilder.config.isIgnoreComments()) { return; } Node node = new Comment(rootNode, comment.toString()); parentNode.addChild(node); }
error("Unclosed tag closed: <" + thisNode.getNodeName() + ">"); removeLastChildNodeIfEmptyText(parentNode, true);
public void script(Tag tag, CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
public void comment(CharSequence comment) { if (!enabled) { return; } if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); } if (domBuilder.config.isIgnoreComments()) { return; } Node node = new Comment(rootNode, comment.toString()); parentNode.addChild(node); }
case START: if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); removeLastChildNodeIfEmptyText(parentNode, true); Node matchingParent = findMatchingParentOpenTag(tagName); error("Orphan closed tag ignored: </" + tagName + "> " + tag.getTagPosition()); break; fixUnclosedTagsUpToMatchingParent(tag, matchingParent); removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); parentNode.addChild(node); break;
/** * Parses the content using provided lagarto parser. */ protected Document doParse(LagartoParser lagartoParser) { lagartoParser.setConfig(config); LagartoDOMBuilderTagVisitor domBuilderTagVisitor = new LagartoDOMBuilderTagVisitor(this); lagartoParser.parse(domBuilderTagVisitor); return domBuilderTagVisitor.getDocument(); }
error("Unclosed tag closed: <" + thisNode.getNodeName() + ">"); removeLastChildNodeIfEmptyText(parentNode, true);
@Override public void script(final Tag tag, final CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
@Override public void comment(final CharSequence comment) { if (!enabled) { return; } if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); } if (domBuilder.config.isIgnoreComments()) { return; } Node node = new Comment(rootNode, comment.toString()); parentNode.addChild(node); }
case START: if (domBuilder.config.isIgnoreWhitespacesBetweenTags()) { removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); removeLastChildNodeIfEmptyText(parentNode, true); Node matchingParent = findMatchingParentOpenTag(tagName); error("Orphan closed tag ignored: </" + tagName + "> " + tag.getTagPosition()); break; fixUnclosedTagsUpToMatchingParent(tag, matchingParent); removeLastChildNodeIfEmptyText(parentNode, false); node = createElementNode(tag); parentNode.addChild(node); break;
/** * Parses the content using provided lagarto parser. */ protected Document doParse(final LagartoParser lagartoParser) { lagartoParser.setConfig(config); LagartoDOMBuilderTagVisitor domBuilderTagVisitor = new LagartoDOMBuilderTagVisitor(this); lagartoParser.parse(domBuilderTagVisitor); return domBuilderTagVisitor.getDocument(); }