jodd.lagarto.dom
Class LagartoDOMBuilder

java.lang.Object
  extended by jodd.lagarto.LagartoParserEngine
      extended by jodd.lagarto.dom.LagartoDOMBuilder

public class LagartoDOMBuilder
extends LagartoParserEngine

Lagarto DOM builder creates DOM tree from HTML, XHTML or XML content.


Field Summary
protected  boolean caseSensitive
           
protected  boolean collectErrors
           
protected  java.lang.String conditionalCommentExpression
           
static java.lang.String[] HTML5_VOID_TAGS
          Default void tags.
protected  boolean ignoreComments
           
protected  boolean ignoreWhitespacesBetweenTags
           
protected  boolean selfCloseVoidTags
           
protected  java.lang.String[] voidTags
           
 
Fields inherited from class jodd.lagarto.LagartoParserEngine
calculateErrorPosition, enableConditionalComments, parseSpecialTagsAsCdata
 
Constructor Summary
LagartoDOMBuilder()
           
 
Method Summary
protected  DOMBuilderTagVisitor createDOMDomBuilderTagVisitor()
          Creates DOMBuilderTagVisitor.
protected  Document doParse()
          Parses the content.
 LagartoDOMBuilder enableHtmlMode()
          Enables HTML5 parsing mode.
 LagartoDOMBuilder enableXhtmlMode()
          Enables XHTML mode.
 LagartoDOMBuilder enableXmlMode()
          Enables XML parsing mode.
 java.lang.String getConditionalCommentExpression()
           
 java.lang.String[] getVoidTags()
           
 boolean hasVoidTags()
          Returns true if void tags are used.
 boolean isCaseSensitive()
           
 boolean isCollectErrors()
           
 boolean isIgnoreComments()
           
 boolean isIgnoreWhitespacesBetweenTags()
           
 boolean isSelfCloseVoidTags()
           
 boolean isVoidTag(java.lang.String tagName)
          Returns true if tag name is void.
 Document parse(java.nio.CharBuffer content)
          Creates DOM tree from the provided content.
 Document parse(java.lang.CharSequence content)
          Creates DOM tree from provided content.
 void setCaseSensitive(boolean caseSensitive)
          Specifies if tag names are case sensitive.
 void setCollectErrors(boolean collectErrors)
          Enables error collection during parsing.
 void setConditionalCommentExpression(java.lang.String conditionalCommentExpression)
           
 void setIgnoreComments(boolean ignoreComments)
          Specifies if comments should be ignored in DOM tree.
 void setIgnoreWhitespacesBetweenTags(boolean ignoreWhitespacesBetweenTags)
          Specifies if whitespaces between open/closed tags should be ignored.
 void setSelfCloseVoidTags(boolean selfCloseVoidTags)
          Specifies if void tags should be self closed.
 void setVoidTags(java.lang.String... voidTags)
          Sets void tags.
 
Methods inherited from class jodd.lagarto.LagartoParserEngine
acceptTag, error, flushText, initialize, isCalculateErrorPosition, isEnableConditionalComments, isParseSpecialTagsAsCdata, nextToken, parse, parse, parseAttribute, parseCCEnd, parseCDATA, parseCommentOrConditionalComment, parseDoctype, parseRevealedCCStart, parseSpecialTag, parseTag, parseTagAndAttributes, parseText, setCalculateErrorPosition, setEnableConditionalComments, setParseSpecialTagsAsCdata, skipWhiteSpace, text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML5_VOID_TAGS

public static final java.lang.String[] HTML5_VOID_TAGS
Default void tags. http://dev.w3.org/html5/spec/Overview.html#void-elements


ignoreWhitespacesBetweenTags

protected boolean ignoreWhitespacesBetweenTags

caseSensitive

protected boolean caseSensitive

ignoreComments

protected boolean ignoreComments

selfCloseVoidTags

protected boolean selfCloseVoidTags

collectErrors

protected boolean collectErrors

conditionalCommentExpression

protected java.lang.String conditionalCommentExpression

voidTags

protected java.lang.String[] voidTags
Constructor Detail

LagartoDOMBuilder

public LagartoDOMBuilder()
Method Detail

isIgnoreWhitespacesBetweenTags

public boolean isIgnoreWhitespacesBetweenTags()

setIgnoreWhitespacesBetweenTags

public void setIgnoreWhitespacesBetweenTags(boolean ignoreWhitespacesBetweenTags)
Specifies if whitespaces between open/closed tags should be ignored.


isCaseSensitive

public boolean isCaseSensitive()

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Specifies if tag names are case sensitive.


isIgnoreComments

public boolean isIgnoreComments()

setIgnoreComments

public void setIgnoreComments(boolean ignoreComments)
Specifies if comments should be ignored in DOM tree.


getVoidTags

public java.lang.String[] getVoidTags()

setVoidTags

public void setVoidTags(java.lang.String... voidTags)
Sets void tags. If null, void tags are not used.


hasVoidTags

public boolean hasVoidTags()
Returns true if void tags are used. Using void tags makes parsing a different.


isVoidTag

public boolean isVoidTag(java.lang.String tagName)
Returns true if tag name is void. If void tags are not defined, returns false for any input.


isSelfCloseVoidTags

public boolean isSelfCloseVoidTags()

setSelfCloseVoidTags

public void setSelfCloseVoidTags(boolean selfCloseVoidTags)
Specifies if void tags should be self closed.


isCollectErrors

public boolean isCollectErrors()

setCollectErrors

public void setCollectErrors(boolean collectErrors)
Enables error collection during parsing.


getConditionalCommentExpression

public java.lang.String getConditionalCommentExpression()

setConditionalCommentExpression

public void setConditionalCommentExpression(java.lang.String conditionalCommentExpression)

enableHtmlMode

public LagartoDOMBuilder enableHtmlMode()
Enables HTML5 parsing mode.


enableXhtmlMode

public LagartoDOMBuilder enableXhtmlMode()
Enables XHTML mode.


enableXmlMode

public LagartoDOMBuilder enableXmlMode()
Enables XML parsing mode.


parse

public Document parse(java.lang.CharSequence content)
Creates DOM tree from provided content.


parse

public Document parse(java.nio.CharBuffer content)
Creates DOM tree from the provided content.


doParse

protected Document doParse()
Parses the content.


createDOMDomBuilderTagVisitor

protected DOMBuilderTagVisitor createDOMDomBuilderTagVisitor()
Creates DOMBuilderTagVisitor.



Copyright © 2003-2012 Jodd Team