|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.marsching.flexiparse.parser.SimpleParser
public class SimpleParser
Simple implementation of the Parser
interface. Parses a
XML document using the parsers manually attached to this parser.
Field Summary | |
---|---|
protected DocumentBuilder |
documentBuilder
Document builder instance used for XML operations by this parser |
protected LinkedHashSet<ElementMappingConfiguration> |
mappingConfigurations
Stores the XML to object mapping configurations for this parser |
protected LinkedHashSet<NodeHandler> |
nodeHandlers
Stores node handlers configured for this parser |
Constructor Summary | |
---|---|
SimpleParser()
Creates a parser without any handlers. |
Method Summary | |
---|---|
void |
addElementMappingConfiguration(ElementMappingConfiguration configuration)
Adds an element mapping configuration to this parser. |
void |
addNodeHandler(NodeHandler nodeHandler)
Adds a node handler to this parser. |
Collection<? extends ElementMappingConfiguration> |
getElementMappingConfigurations()
Returns all element mapping configurations that are active for this parser. |
protected Collection<NodeHandler> |
getHandlerOrder(Collection<NodeHandler> handlers)
Determines the order in which the handlers should be called. |
Collection<? extends NodeHandler> |
getNodeHandlers()
Returns all node handlers configured for this parser. |
ObjectTreeElement |
parse(Document doc,
Object... rootObjects)
Parses a DOM document. |
ObjectTreeElement |
parse(File file,
Object... rootObjects)
Parses a DOM document. |
ObjectTreeElement |
parse(InputSource inputSource,
Object... rootObjects)
Parses a XML document obtained from an input source. |
ObjectTreeElement |
parse(InputStream inputStream,
Object... rootObjects)
Parses a XML document provided by a input stream. |
boolean |
removeElementMappingConfiguration(ElementMappingConfiguration configuration)
Removes an element mapping configuration from this parser. |
boolean |
removeNodeHandler(NodeHandler nodeHandler)
Removes a handler from this parser. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LinkedHashSet<NodeHandler> nodeHandlers
protected LinkedHashSet<ElementMappingConfiguration> mappingConfigurations
protected DocumentBuilder documentBuilder
Constructor Detail |
---|
public SimpleParser()
Method Detail |
---|
public ObjectTreeElement parse(Document doc, Object... rootObjects) throws ParserException
Parser
parse
in interface Parser
doc
- DOM documentrootObjects
- objects that should be attached to the root node
of the object tree before parsing the document
ParserException
- if an error occurs during the parsing processprotected Collection<NodeHandler> getHandlerOrder(Collection<NodeHandler> handlers) throws ParserConfigurationException
handlers
- Handlers to determine order for
ParserConfigurationException
- if handlers have a cyclic
dependencypublic void addNodeHandler(NodeHandler nodeHandler)
Parser
addNodeHandler
in interface Parser
nodeHandler
- handler to add to the parserpublic Collection<? extends NodeHandler> getNodeHandlers()
Parser
getNodeHandlers
in interface Parser
public boolean removeNodeHandler(NodeHandler nodeHandler)
Parser
removeNodeHandler
in interface Parser
nodeHandler
- handler to remove from this parser
true
if the handler was removed,
false
otherwisepublic ObjectTreeElement parse(File file, Object... rootObjects) throws ParserException
Parser
parse
in interface Parser
file
- file containing the xml document to be parsedrootObjects
- objects that should be attached to the root node
of the object tree before parsing the document
ParserException
- if an error occurs during the parsing processpublic ObjectTreeElement parse(InputStream inputStream, Object... rootObjects) throws ParserException
Parser
parse
in interface Parser
inputStream
- stream to read fromrootObjects
- objects that should be attached to the root node
of the object tree before parsing the document
ParserException
- if an error occurs during the parsing processpublic ObjectTreeElement parse(InputSource inputSource, Object... rootObjects) throws ParserException
Parser
parse
in interface Parser
inputSource
- source providing the XML documentrootObjects
- objects that should be attached to the root node
of the object tree before parsing the document
ParserException
- if an error occurs during the parsing processpublic void addElementMappingConfiguration(ElementMappingConfiguration configuration)
Parser
addElementMappingConfiguration
in interface Parser
configuration
- mapping configuration that is going to be
used by this parserpublic Collection<? extends ElementMappingConfiguration> getElementMappingConfigurations()
Parser
getElementMappingConfigurations
in interface Parser
public boolean removeElementMappingConfiguration(ElementMappingConfiguration configuration)
Parser
removeElementMappingConfiguration
in interface Parser
configuration
- mapping configuration that should be removed
true
if the mapping configuration has been removed,
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |