|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dtolabs.shared.resources.ResourceXMLParser
public class ResourceXMLParser
ResourceXMLParser parses a resources.xml formatted file, and provides several interfaces for using the result data.
Theparse()
method parses the configured File as a sequence of ResourceXMLParser.Entity
objects, one for each entry in the file. It passes these objects to any configured ResourceXMLReceiver
object. One should be set using setReceiver(ResourceXMLReceiver)
to receive parsed entities or the entire entity set.
The default entityXpath property value is set to match all entity types in the resource xml
(node|setting|package|deployment)
, but this can be set to any Xpath to limit the entities that are
parsed from the document. (e.g. "node|package
" or "node[@name='mynode']
").
See #setEntityXpath(String)
.
Nested Class Summary | |
---|---|
static class |
ResourceXMLParser.Entity
Represents a parsed resource entity in the xml, which consists of a name property, a type property, and a set of name/value properties. |
static class |
ResourceXMLParser.EntitySet
Contains the set of parsed entities from the document. |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_ENTITY_XPATH
|
Constructor Summary | |
---|---|
ResourceXMLParser(java.io.File file)
Constructor for the ResourceXMLParser |
|
ResourceXMLParser(java.io.InputStream input)
Constructor for the ResourceXMLParser |
Method Summary | |
---|---|
static org.xml.sax.EntityResolver |
createEntityResolver()
|
ResourceXMLReceiver |
getReceiver()
Return the ResourceXMLReceiver |
void |
parse()
Parse the document, applying the configured Receiver to the parsed entities |
protected static java.lang.String |
reportNodeErrorLocation(org.dom4j.Node e)
Return a String describing the DOM node's location and parent type name |
void |
setReceiver(ResourceXMLReceiver receiver)
Set the ResourceXMLReceiver to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_ENTITY_XPATH
Constructor Detail |
---|
public ResourceXMLParser(java.io.File file)
file
- source filepublic ResourceXMLParser(java.io.InputStream input)
input
- source fileMethod Detail |
---|
public void parse() throws ResourceXMLParserException, java.io.IOException
ResourceXMLParserException
java.io.FileNotFoundException
java.io.IOException
public static org.xml.sax.EntityResolver createEntityResolver()
protected static java.lang.String reportNodeErrorLocation(org.dom4j.Node e)
e
- the node
public ResourceXMLReceiver getReceiver()
public void setReceiver(ResourceXMLReceiver receiver)
ResourceXMLParser.Entity
objects created during the parse()
method,
and will also receive the complete ResourceXMLParser.EntitySet
at the
end of the sequence. It can govern whether parsing should continue or not, see ResourceXMLReceiver
receiver
- the new ResourceXMLReceiver
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |