|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.attoparser.markup.MarkupParsingConfiguration.PrologParsingConfiguration
public static class MarkupParsingConfiguration.PrologParsingConfiguration
Class encapsulating the configuration parameters used for parsing and validating the "prolog" section of a markup document. The prolog is the section of an XML/HTML document containing the XML declaration and the DOCTYPE clause (if these exist).
If validateProlog is set to false, all other parameters should be ignored.
If validateProlog is true, then the rest of the parameters will be considered.
Not all combinations of values of the tt>getPrologPresence()
,
getXmlDeclarationPresence()
and getDoctypePresence()
are considered valid. See validateConfiguration()
for details.
Constructor Summary | |
---|---|
protected |
MarkupParsingConfiguration.PrologParsingConfiguration()
Creates a MarkupParsingConfiguration.PrologParsingConfiguration instance with
a default configuration. |
Method Summary | |
---|---|
MarkupParsingConfiguration.PrologParsingConfiguration |
clone()
|
MarkupParsingConfiguration.PrologPresence |
getDoctypePresence()
This flag indicates the level of presence desired for the DOCTYPE clause (a part of the prolog) in the document, in case isValidateProlog()
has been set to true. |
MarkupParsingConfiguration.PrologPresence |
getPrologPresence()
This flag indicates the level of presence desired for the prolog in the document, in case isValidateProlog() has been set
to true. |
MarkupParsingConfiguration.PrologPresence |
getXmlDeclarationPresence()
This flag indicates the level of presence desired for the XML Declaration (a part of the prolog) in the document, in case isValidateProlog()
has been set to true. |
boolean |
isRequireDoctypeKeywordsUpperCase()
This configuration parameter allows to check that all keywords in a DOCTYPE clause ('DOCTYPE', 'SYSTEM', 'PUBLIC') are in upper-case as required by the XML specification (and not by the HTML5 one, for example). |
boolean |
isValidateProlog()
This flag indicates whether the document's prolog should be validated at all or not. |
void |
setDoctypePresence(MarkupParsingConfiguration.PrologPresence doctypePresence)
|
void |
setPrologPresence(MarkupParsingConfiguration.PrologPresence prologPresence)
|
void |
setRequireDoctypeKeywordsUpperCase(boolean requireDoctypeKeywordsUpperCase)
|
void |
setValidateProlog(boolean validateProlog)
|
void |
setXmlDeclarationPresence(MarkupParsingConfiguration.PrologPresence xmlDeclarationPresence)
|
void |
validateConfiguration()
Checks that the combination of values in the getPrologPresence() ,
getXmlDeclarationPresence() and getDoctypePresence()
parameters makes sense. |
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MarkupParsingConfiguration.PrologParsingConfiguration()
Creates a MarkupParsingConfiguration.PrologParsingConfiguration
instance with
a default configuration.
Default values are:
isValidateProlog()
= falsegetPrologPresence()
= MarkupParsingConfiguration.PrologPresence.ALLOWED
getXmlDeclarationPresence()
= MarkupParsingConfiguration.PrologPresence.ALLOWED
getDoctypePresence()
= MarkupParsingConfiguration.PrologPresence.ALLOWED
isRequireDoctypeKeywordsUpperCase()
= true
Method Detail |
---|
public boolean isValidateProlog()
This flag indicates whether the document's prolog should be validated at all or not.
If not validated, prolog-specific structures (XML Declaration and DOCTYPE) will be allowed to appear anywhere in the document. All other configuration paramters in this object will be ignored.
If validated, prolog-specific structures will only be allowed to
appear (under the conditions established in this object) at the
beginning of the document, before the element root. Or if
getPrologPresence()
is set to MarkupParsingConfiguration.PrologPresence.FORBIDDEN
,
it will be validated that such structures do not appear at all.
Also, if validated and a DOCTYPE is present, it will be checked that there is only one root element in the document and its name matches the root element name in the DOCTYPE clause.
Default value is false.
public void setValidateProlog(boolean validateProlog)
public MarkupParsingConfiguration.PrologPresence getPrologPresence()
This flag indicates the level of presence desired for the prolog
in the document, in case isValidateProlog()
has been set
to true.
public void setPrologPresence(MarkupParsingConfiguration.PrologPresence prologPresence)
public MarkupParsingConfiguration.PrologPresence getXmlDeclarationPresence()
This flag indicates the level of presence desired for the XML Declaration
(a part of the prolog) in the document, in case isValidateProlog()
has been set to true.
public void setXmlDeclarationPresence(MarkupParsingConfiguration.PrologPresence xmlDeclarationPresence)
public MarkupParsingConfiguration.PrologPresence getDoctypePresence()
This flag indicates the level of presence desired for the DOCTYPE clause
(a part of the prolog) in the document, in case isValidateProlog()
has been set to true.
public void setDoctypePresence(MarkupParsingConfiguration.PrologPresence doctypePresence)
public boolean isRequireDoctypeKeywordsUpperCase()
This configuration parameter allows to check that all keywords in a DOCTYPE clause ('DOCTYPE', 'SYSTEM', 'PUBLIC') are in upper-case as required by the XML specification (and not by the HTML5 one, for example).
Default value is true, but it will apply only if
isValidateProlog()
is true.
public void setRequireDoctypeKeywordsUpperCase(boolean requireDoctypeKeywordsUpperCase)
public void validateConfiguration()
Checks that the combination of values in the getPrologPresence()
,
getXmlDeclarationPresence()
and getDoctypePresence()
parameters makes sense.
getPrologPresence()
is MarkupParsingConfiguration.PrologPresence.FORBIDDEN
, then
getXmlDeclarationPresence()
and getDoctypePresence()
must
be MarkupParsingConfiguration.PrologPresence.FORBIDDEN
too.getXmlDeclarationPresence()
or
getDoctypePresence()
is MarkupParsingConfiguration.PrologPresence.REQUIRED
, the
configuration is considered valid.getPrologPresence()
is MarkupParsingConfiguration.PrologPresence.ALLOWED
,
the configuration is considered valid as long as not both
getXmlDeclarationPresence()
and getDoctypePresence()
are MarkupParsingConfiguration.PrologPresence.FORBIDDEN
.
IllegalArgumentException
- if the combination of values is not correct.public MarkupParsingConfiguration.PrologParsingConfiguration clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |