|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.attoparser.markup.MarkupParsingConfiguration
public final class MarkupParsingConfiguration
Models a series of markup parsing parameterizations that can be applied during document parsing
by AbstractDetailedMarkupAttoHandler
(and its subclasses).
For example, a this parameterizations can be used for checking the well-formedness (from an XML/XHTML standpoint) of a document.
Nested Class Summary | |
---|---|
static class |
MarkupParsingConfiguration.ElementBalancing
|
static class |
MarkupParsingConfiguration.PrologParsingConfiguration
Class encapsulating the configuration parameters used for parsing and validating the "prolog" section of a markup document. |
static class |
MarkupParsingConfiguration.PrologPresence
|
static class |
MarkupParsingConfiguration.UniqueRootElementPresence
|
Constructor Summary | |
---|---|
MarkupParsingConfiguration()
Creates a HtmlParsingConfiguration instance with
a default configuration. |
Method Summary | |
---|---|
MarkupParsingConfiguration |
clone()
|
MarkupParsingConfiguration.ElementBalancing |
getElementBalancing()
Determines the level of element balancing required at the document being parsed, enabling auto-closing of elements if needed. |
MarkupParsingConfiguration.PrologParsingConfiguration |
getPrologParsingConfiguration()
A MarkupParsingConfiguration.PrologParsingConfiguration object determining the way
in which prolog (XML Declaration, DOCTYPE) will be dealt with during parsing. |
boolean |
getRequireUniqueAttributesInElement()
Determines whether attributes should never appear duplicated in elements. |
boolean |
getRequireXmlWellFormedAttributeValues()
Determine whether element attributes will be required to be well-formed from the XML standpoint. |
MarkupParsingConfiguration.UniqueRootElementPresence |
getUniqueRootElementPresence()
This value determines whether it will be required that the document has a unique root element. |
boolean |
isCaseSensitive()
Determines whether validations performed on the parsed document should be case sensitive or not (e.g. attribute names, document root element name, element open vs close elements, etc.) |
static MarkupParsingConfiguration |
noRestrictions()
Creates a HtmlParsingConfiguration instance enforcing no restrictions at all. |
void |
setCaseSensitive(boolean caseSensitive)
|
void |
setElementBalancing(MarkupParsingConfiguration.ElementBalancing elementBalancing)
|
void |
setRequireUniqueAttributesInElement(boolean requireUniqueAttributesInElement)
|
void |
setRequireXmlWellFormedAttributeValues(boolean requireXmlWellFormedAttributeValues)
|
void |
setUniqueRootElementPresence(MarkupParsingConfiguration.UniqueRootElementPresence uniqueRootElementPresence)
|
protected static void |
validateNotNull(Object obj,
String message)
|
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarkupParsingConfiguration()
Creates a HtmlParsingConfiguration
instance with
a default configuration.
Default values are the same as created by noRestrictions()
:
isCaseSensitive()
= truegetElementBalancing()
= MarkupParsingConfiguration.ElementBalancing.NO_BALANCING
getRequireXmlWellFormedAttributeValues()
= falsegetRequireUniqueAttributesInElement()
= falsegetPrologParsingConfiguration()
= new MarkupParsingConfiguration.PrologParsingConfiguration
()getUniqueRootElementPresence()
= MarkupParsingConfiguration.UniqueRootElementPresence.DEPENDS_ON_PROLOG_DOCTYPE
Method Detail |
---|
public static MarkupParsingConfiguration noRestrictions()
Creates a HtmlParsingConfiguration
instance enforcing no restrictions at all.
This is the setup:
isCaseSensitive()
= truegetElementBalancing()
= MarkupParsingConfiguration.ElementBalancing.NO_BALANCING
getRequireXmlWellFormedAttributeValues()
= falsegetRequireUniqueAttributesInElement()
= falsegetPrologParsingConfiguration()
= new MarkupParsingConfiguration.PrologParsingConfiguration
()getUniqueRootElementPresence()
= MarkupParsingConfiguration.UniqueRootElementPresence.DEPENDS_ON_PROLOG_DOCTYPE
public boolean isCaseSensitive()
Determines whether validations performed on the parsed document should be case sensitive or not (e.g. attribute names, document root element name, element open vs close elements, etc.)
Default is true.
public void setCaseSensitive(boolean caseSensitive)
public MarkupParsingConfiguration.ElementBalancing getElementBalancing()
Determines the level of element balancing required at the document being parsed, enabling auto-closing of elements if needed.
Possible values are:
MarkupParsingConfiguration.ElementBalancing.NO_BALANCING
(default): means no corrections and/or
validations of any kind will be performed. Artifacts will be reported by the
corresponding events without further interpretation.MarkupParsingConfiguration.ElementBalancing.REQUIRE_BALANCED
: will require that all elements
are perfectly balanced, raising an exception if this does not happen.MarkupParsingConfiguration.ElementBalancing.AUTO_CLOSE
: Parser will emit autoclose events
for those elements that are left unclosed, in order to provide a complete XML-style
tag balance.MarkupParsingConfiguration.ElementBalancing.AUTO_CLOSE_REQUIRE_NO_UNMATCHED_CLOSE
: Same as
MarkupParsingConfiguration.ElementBalancing.AUTO_CLOSE
but validating that there are no unmatched
close element artifacts (without a corresponding open element artifact),
raising an exception if any are found.MarkupParsingConfiguration.ElementBalancing.REQUIRE_NO_UNMATCHED_CLOSE
: Will not require complete
balancing nor perform autoclose, but will require that there are no unmatched
close element artifacts (without a corresponding open element artifact),
raising an exception if any are found.
public void setElementBalancing(MarkupParsingConfiguration.ElementBalancing elementBalancing)
public MarkupParsingConfiguration.PrologParsingConfiguration getPrologParsingConfiguration()
A MarkupParsingConfiguration.PrologParsingConfiguration
object determining the way
in which prolog (XML Declaration, DOCTYPE) will be dealt with during parsing.
public boolean getRequireXmlWellFormedAttributeValues()
Determine whether element attributes will be required to be well-formed from the XML standpoint. This means:
public void setRequireXmlWellFormedAttributeValues(boolean requireXmlWellFormedAttributeValues)
public boolean getRequireUniqueAttributesInElement()
Determines whether attributes should never appear duplicated in elements.
public void setRequireUniqueAttributesInElement(boolean requireUniqueAttributesInElement)
public MarkupParsingConfiguration.UniqueRootElementPresence getUniqueRootElementPresence()
This value determines whether it will be required that the document has a unique root element.
If set to MarkupParsingConfiguration.UniqueRootElementPresence.REQUIRED_ALWAYS
, then a document with
more than one elements at the root level will never be considered valid. And if
MarkupParsingConfiguration.PrologParsingConfiguration.isValidateProlog()
is true and there is a DOCTYPE
clause, it will be checked that the root name established at the DOCTYPE clause
is the same as the document's element root.
If set to MarkupParsingConfiguration.UniqueRootElementPresence.DEPENDS_ON_PROLOG_DOCTYPE
, then:
MarkupParsingConfiguration.PrologParsingConfiguration.isValidateProlog()
is false, multiple
document root elements will be allowed.MarkupParsingConfiguration.PrologParsingConfiguration.isValidateProlog()
is true:
Default value is MarkupParsingConfiguration.UniqueRootElementPresence.DEPENDS_ON_PROLOG_DOCTYPE
.
public void setUniqueRootElementPresence(MarkupParsingConfiguration.UniqueRootElementPresence uniqueRootElementPresence)
public MarkupParsingConfiguration clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
protected static void validateNotNull(Object obj, String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |