|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bsd.x2svg.parsers.PropertiesParser
public class PropertiesParser
Simple example of a InputParser for Property files. This is mostly here to show what is needed to accomplish a simple parsing task.
Field Summary | |
---|---|
private static java.lang.String |
FILE_SUFFIX_STRING
|
private static java.lang.String |
MODE_STRING
|
private java.io.File |
pFile
Properties file to use |
private java.util.Properties |
properties
|
Constructor Summary | |
---|---|
PropertiesParser()
|
Method Summary | |
---|---|
java.lang.String |
getFileSuffix()
We react on .properties |
java.lang.String |
getMode()
Our mode is 'props' |
java.lang.String |
getSpecificHelp()
We have no options so far ... |
private void |
loadPropertiesFile()
Load the properties that we want to display from the file set via setInputFile(File) and store it in the variable properties |
Container |
parseInput()
Parse the input an construct a Tree of Containers. |
void |
setDebug()
Tells the parer to set the debug mode. |
void |
setInputFile(java.io.File inputFile)
Sets the input file to work on |
void |
setParserOptions(java.lang.String[] options)
Pass in options to this parser. |
void |
setWithAttributes(boolean value)
Tells the parser that parsing attributes of elements is wanted. |
void |
setWithElementComments(boolean value)
Tells the parser that parsing comments for elements (and possibly attributes) is desired. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String FILE_SUFFIX_STRING
private static final java.lang.String MODE_STRING
private java.io.File pFile
private java.util.Properties properties
Constructor Detail |
---|
public PropertiesParser()
Method Detail |
---|
public Container parseInput() throws java.lang.Exception
parseInput
in interface InputParser
java.lang.Exception
- if anything goes wrong.Container
private void loadPropertiesFile() throws ParserProblemException
setInputFile(File)
and store it in the variable properties
ParserProblemException
- if the input file is not acessiblepublic void setInputFile(java.io.File inputFile)
setInputFile
in interface InputParser
inputFile
- a vaild file object to work onpublic void setParserOptions(java.lang.String[] options)
setParserOptions
in interface InputParser
options
- array of individual option parts as passed on the command line.public java.lang.String getSpecificHelp()
getSpecificHelp
in interface InputParser
InputParser.getSpecificHelp()
public java.lang.String getFileSuffix()
getFileSuffix
in interface InputParser
public java.lang.String getMode()
getMode
in interface InputParser
public void setDebug()
InputParser
setDebug
in interface InputParser
public void setWithAttributes(boolean value)
InputParser
DtdParser
is able to do this, while the PropertiesParser
is not.
setWithAttributes
in interface InputParser
value
- The value to set this to.public void setWithElementComments(boolean value)
InputParser
setWithElementComments
in interface InputParser
value
- The value to set this to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |