|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.n52.security.common.xml.DOMParser
public abstract class DOMParser
Encapsulates the common usage of the DocumentBuilder class within a helpful DOMParser class.
At first it is designed for performance, such as you can discover a pooling DomParser, what is recommended. Only in very few situations you need a non pooling DOMParser. Best is to use the DOMParser.createNew() method. At next the DOMParser class uses a ClasspathEntityResolver, which ensures that the wrapped DocumentBuilder can always parse an XMLFile and entities are only discovered within the classpath. The DOMParser class uses the factory method pattern, there with you can create DOMParsers by using the static methodscreatePoolingParser()
and createNonPoolingParser()
.
For fast creation of empty xml documents, or for in memory creation of DOM documents use the
createEmptyDocument()
method.
Constructor Summary | |
---|---|
DOMParser()
|
Method Summary | |
---|---|
protected static DocumentBuilder |
createDocumentBuilder(DOMParserOptions parseroptions)
Creates a new DocumentBuilder with the given attributes. |
static Document |
createEmptyDocument()
|
static Document |
createEmptyDocument(DOMParserOptions options)
|
static DOMParser |
createNew()
Creates a new DOMParser. |
static DOMParser |
createNew(DOMParserOptions options)
Creates a new DOMParser. |
static DOMParser |
createNonPoolingParser()
Creates a non pooling Parser, with default options. |
static DOMParser |
createNonPoolingParser(DOMParserOptions options)
Creates a non pooling Parser, with the given options. |
static DOMParser |
createPoolingParser()
Creates a pooling Parser with default options and using the global DocumentBuilder pool. |
static DOMParser |
createPoolingParser(DOMParserOptions options)
Creates a pooling Parser with the given options, using the global DocumentBuilder pool. |
static DOMParser |
createPoolingParser(DOMParserOptions options,
DocumentBuilderPool pool)
Creates a pooling Parser with the given options, which uses the given document builder pool. |
static EntityResolver |
getDefaultEntityResolver()
By default this method creates a ClasspathEntityResolver in quite mode, which means the parsing will
never fail because of non existing entities (e.g. |
static DocumentBuilderPool |
getDocumentBuilderPool()
Gets the documentBuilderPool used by pooled parsers. |
Document |
parse(InputSource inputSource)
Parses the inputsource. |
Document |
parse(InputSource inputSource,
ErrorHandler errorhandler)
Parses the inputsource and informs the error handler about errors. |
abstract Document |
parse(InputSource source,
ErrorHandler errorhandler,
EntityResolver entityResolver)
Parses the inputsource using the errorhandler and entityresolver. |
static void |
setDefaultEntityResolver(EntityResolver defaultresolver)
Sets the defaultEntityResolver. |
static void |
setDocumentBuilderPool(DocumentBuilderPool builderPool)
Sets the documentBuilderPool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DOMParser()
Method Detail |
---|
public static EntityResolver getDefaultEntityResolver()
ClasspathEntityResolver
in quite mode, which means the parsing will
never fail because of non existing entities (e.g. dtd's).
public static void setDefaultEntityResolver(EntityResolver defaultresolver)
public static DocumentBuilderPool getDocumentBuilderPool()
public static void setDocumentBuilderPool(DocumentBuilderPool builderPool)
builderPool
- the documentBuilderPool.protected static DocumentBuilder createDocumentBuilder(DOMParserOptions parseroptions)
parseroptions
- options for the new parser.
public static Document createEmptyDocument()
public static Document createEmptyDocument(DOMParserOptions options)
public static DOMParser createNew()
public static DOMParser createNew(DOMParserOptions options)
options
- the options.
public static DOMParser createNonPoolingParser()
public static DOMParser createNonPoolingParser(DOMParserOptions options)
options
- the options.
public static DOMParser createPoolingParser()
public static DOMParser createPoolingParser(DOMParserOptions options)
options
- the options.
public static DOMParser createPoolingParser(DOMParserOptions options, DocumentBuilderPool pool)
public Document parse(InputSource inputSource, ErrorHandler errorhandler) throws DOMParserException
DOMParserException
- if an SAXException or IOException occurs.public abstract Document parse(InputSource source, ErrorHandler errorhandler, EntityResolver entityResolver) throws DOMParserException
DOMParserException
- if an SAXException or IOException occurs.public Document parse(InputSource inputSource) throws DOMParserException
DOMParserException
- if an SAXException or IOException occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |