|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.inria.ns.reflex.xml.ParserConfiguration.Impl
public static class ParserConfiguration.Impl
A standard configuration contains a set of flags and a set of attributes (features and properties) to set to a DOM or SAX parser.
When attributes are not used, the configuration is said to be static (because at runtime, the flags are the same but the attributes may differ).
The parser will use getAttributes()
for its
configuration, thus subclasses may override this method
(and surely, other methods relative to attributes won't
have any effect).
The getAttributes()
method will be
invoked as late as possible.
In SAX terminology, a parser can be configured with features and properties. Boolean attributes will be set as SAX features, non-boolean attributes as SAX properties.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.ParserConfiguration |
---|
ParserConfiguration.Impl |
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Configurable |
---|
Configurable.Impl |
Field Summary |
---|
Fields inherited from interface org.inria.ns.reflex.xml.ParserConfiguration |
---|
NAMESPACEAWARE_PARSER_CONFIGURATION |
Constructor Summary | |
---|---|
ParserConfiguration.Impl(boolean isValidating,
boolean isNamespaceAware,
boolean isCoalescing,
boolean isExpandingEntityReferences,
boolean isIgnoringComments,
boolean isIgnoringWhitespace)
Create a new instance of ParserConfiguration.Impl . |
|
ParserConfiguration.Impl(ParserConfiguration.Impl staticConfiguration)
Create a new instance of ParserConfiguration.Impl . |
Method Summary | |
---|---|
boolean |
containsAttribute(Object key)
Indicates if a key is contains in the attributes of this configuration. |
boolean |
containsAttribute(String key)
Indicates if a key is contains in the attributes of this configuration. |
Object |
getAttribute(Object key)
Return an attribute. |
Object |
getAttribute(String key)
Return an attribute. |
Map |
getAttributes()
Get the attributes to set to the parser. |
boolean |
isCoalescing()
Indicates whether the parser will coalesce CDATA nodes or not. |
boolean |
isExpandingEntityReferences()
Indicates whether the parser will expand entity references or not. |
boolean |
isIgnoringComments()
Indicates whether the parser will ignore comments or not. |
boolean |
isIgnoringWhitespace()
Indicates whether the parser will ignore whitespaces or not. |
boolean |
isNamespaceAware()
Indicates whether the parser will recognize namespaces or not. |
boolean |
isValidating()
Indicates whether the parser will validate documents or not. |
void |
mergeAttributes(Map attributes)
Adds an attribute set to the current one. |
DocumentBuilder |
newDocumentBuilder()
Return a configured DocumentBuilderFactory ; if attributes have been previously set, the parser will use them. |
XMLReader |
newXMLReader()
Return a configured XMLReader ; if attributes have been previously set, the parser will use them. |
void |
setAttribute(Object name,
Object value)
Adds an attribute to the current set of attributes. |
void |
setAttribute(String name,
Object value)
Adds an attribute to the current set of attributes. |
void |
setAttributes(Map attributes)
Replace the current attributes set with a new one. |
void |
setCoalescing(boolean isCoalescing)
Indicates to the parser whether it must coalesce CDATA nodes or not. |
void |
setExpandingEntityReferences(boolean isExpandingEntityReferences)
Indicates to the parser whether it must expand entity references or not. |
void |
setIgnoringComments(boolean isIgnoringComments)
Indicates to the parser whether it must ignore comments or not. |
void |
setIgnoringWhitespace(boolean isIgnoringWhitespace)
Indicates to the parser whether it must ignore whitespace or not. |
void |
setNamespaceAware(boolean isNamespaceAware)
Indicates to the parser whether it must recognize namespaces or not. |
void |
setValidating(boolean isValidating)
Indicates to the parser whether it must validate documents or not. |
String |
toString()
Return this configuration as a detailed message. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ParserConfiguration.Impl(boolean isValidating, boolean isNamespaceAware, boolean isCoalescing, boolean isExpandingEntityReferences, boolean isIgnoringComments, boolean isIgnoringWhitespace)
ParserConfiguration.Impl
.
isValidating
- true
if the parser will validate documents as
they are parsed, false
otherwise.isNamespaceAware
- true
if the parser will provide support for XML
namespaces, false
otherwise.isCoalescing
- true
if the parser will convert CDATA nodes to
Text nodes and append it to the adjacent (if any) text node,
false
otherwise.isExpandingEntityReferences
- true
if the parser will expand entity reference
nodes, false
otherwise.isIgnoringComments
- true
if the parser will ignore comments,
false
otherwise.isIgnoringWhitespace
- true
if the parser must eliminate whitespace in
element content (sometimes known loosely as 'ignorable
whitespace') when parsing, false
otherwise.public ParserConfiguration.Impl(ParserConfiguration.Impl staticConfiguration)
ParserConfiguration.Impl
.
staticConfiguration
- A static configuration to copy.
All fields are copied except the attributes.Method Detail |
---|
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
newDocumentBuilder
in interface ParserConfiguration
ParserConfigurationException
- If a parser with this
settings can't be created.setAttributes(Map)
,
mergeAttributes(Map)
,
ParserConfiguration#newDocumentBuilderFactory()
public XMLReader newXMLReader() throws SAXException
newXMLReader
in interface ParserConfiguration
SAXException
- When a SAX parser with such a
configuration can't be get.setAttributes(Map)
,
mergeAttributes(Map)
,
ParserConfiguration.newXMLReader()
public Map getAttributes()
getAttributes
in interface Configurable
null
attributes to set to the parser.
By default, the map returned is the
immutable empty map.setAttributes(Map)
,
mergeAttributes(Map)
,
setAttribute(String, Object)
,
Collections.EMPTY_MAP
,
Configurable.getAttributes()
public void setAttributes(Map attributes)
setAttributes
in interface Configurable
attributes
- The new attributes to set to the parser.Configurable.setAttributes(Map)
public void mergeAttributes(Map attributes)
mergeAttributes
in interface Configurable
attributes
- The attributes to add.Configurable.mergeAttributes(Map)
public void setAttribute(Object name, Object value)
setAttribute
in interface Configurable
name
- The name of the attribute to add.value
- The value of the attribute to add.Configurable.setAttribute(Object, Object)
,
setAttribute(String, Object)
public void setAttribute(String name, Object value)
name
- The name of the attribute to add.value
- The value of the attribute to add.public Object getAttribute(Object key)
getAttribute
in interface Configurable
key
- The key of the attribute.
null
if it doesn't exists.Configurable.getAttribute(java.lang.Object)
,
getAttribute(String)
public Object getAttribute(String key)
key
- The key of the attribute.
null
if it doesn't exists.Configurable.getAttribute(java.lang.Object)
public boolean containsAttribute(Object key)
containsAttribute
in interface Configurable
key
- The key to retrieve.
true
if the key exists, false
otherwise.Configurable.containsAttribute(java.lang.Object)
,
containsAttribute(String)
public boolean containsAttribute(String key)
key
- The key to retrieve.
true
if the key exists, false
otherwise.Configurable.containsAttribute(java.lang.Object)
public boolean isCoalescing()
true
if the parser will convert CDATA nodes to Text nodes
and append it to the adjacent (if any) text node, false
otherwise.public void setCoalescing(boolean isCoalescing)
isCoalescing
- true
to coalesce CDATA nodes,
false
otherwise.public boolean isExpandingEntityReferences()
true
if the parser will expand entity reference nodes,
false
otherwise.public void setExpandingEntityReferences(boolean isExpandingEntityReferences)
isExpandingEntityReferences
- true
to expand entity references,
false
otherwise.public boolean isIgnoringComments()
true
if the parser will ignore comments,
false
otherwise.public void setIgnoringComments(boolean isIgnoringComments)
isIgnoringComments
- true
to ignore comments,
false
otherwise.public boolean isIgnoringWhitespace()
true
if the parser must eliminate whitespace in element
content (sometimes known loosely as 'ignorable whitespace') when parsing,
false
otherwise.public void setIgnoringWhitespace(boolean isIgnoringWhitespace)
isIgnoringWhitespace
- true
to ignore whitespaces,
false
otherwise.public boolean isNamespaceAware()
true
if the parser will provide support for XML
namespaces, false
otherwise.public void setNamespaceAware(boolean isNamespaceAware)
isNamespaceAware
- true
to recognize namespaces,
false
otherwise.public boolean isValidating()
true
if the parser will validate documents as they are
parsed, false
otherwise.public void setValidating(boolean isValidating)
isValidating
- true
to validate documents,
false
otherwise.public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |