org.attoparser.markup
Class MarkupParsingConfiguration

Object
  extended by org.attoparser.markup.MarkupParsingConfiguration
All Implemented Interfaces:
Serializable

public final class MarkupParsingConfiguration
extends Object
implements Serializable

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.

Since:
1.1
Author:
Daniel Fernández
See Also:
Serialized Form

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

MarkupParsingConfiguration

public MarkupParsingConfiguration()

Creates a HtmlParsingConfiguration instance with a default configuration.

Default values are the same as created by noRestrictions():

Method Detail

noRestrictions

public static MarkupParsingConfiguration noRestrictions()

Creates a HtmlParsingConfiguration instance enforcing no restrictions at all.

This is the setup:

Returns:
the new instance.

isCaseSensitive

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.

Returns:
whether validations should be case sensitive or not.

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)

getElementBalancing

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:

Returns:
the level of element balancing.

setElementBalancing

public void setElementBalancing(MarkupParsingConfiguration.ElementBalancing elementBalancing)

getPrologParsingConfiguration

public MarkupParsingConfiguration.PrologParsingConfiguration getPrologParsingConfiguration()

A MarkupParsingConfiguration.PrologParsingConfiguration object determining the way in which prolog (XML Declaration, DOCTYPE) will be dealt with during parsing.

Returns:
the configuration object.

getRequireXmlWellFormedAttributeValues

public boolean getRequireXmlWellFormedAttributeValues()

Determine whether element attributes will be required to be well-formed from the XML standpoint. This means:

Returns:
whether attributes should be XML-well-formed or not.

setRequireXmlWellFormedAttributeValues

public void setRequireXmlWellFormedAttributeValues(boolean requireXmlWellFormedAttributeValues)

getRequireUniqueAttributesInElement

public boolean getRequireUniqueAttributesInElement()

Determines whether attributes should never appear duplicated in elements.

Returns:
whether attributes should never appear duplicated in elements.

setRequireUniqueAttributesInElement

public void setRequireUniqueAttributesInElement(boolean requireUniqueAttributesInElement)

getUniqueRootElementPresence

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:

Default value is MarkupParsingConfiguration.UniqueRootElementPresence.DEPENDS_ON_PROLOG_DOCTYPE.

Returns:
the configuration value for validating the presence of a unique root element.

setUniqueRootElementPresence

public void setUniqueRootElementPresence(MarkupParsingConfiguration.UniqueRootElementPresence uniqueRootElementPresence)

clone

public MarkupParsingConfiguration clone()
                                 throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

validateNotNull

protected static void validateNotNull(Object obj,
                                      String message)


Copyright © 2013 The ATTOPARSER team. All Rights Reserved.