|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bsd.x2svg.parsers.DtdParser
public class DtdParser
A parser that reads Document Type Descriptions (DTDs)
Field Summary | |
---|---|
private boolean |
alsoAttributes
|
private java.io.File |
dtdFile
|
private java.lang.String |
dtdRootName
|
private static java.lang.String |
FILE_SUFFIX_STRING
|
private static java.lang.String |
MODE_STRING
|
private boolean |
shouldGuessDtdRootName
|
private int |
treeDepth
|
Constructor Summary | |
---|---|
DtdParser()
|
Method Summary | |
---|---|
private void |
addAttributes(Container cont,
com.wutka.dtd.DTDElement element)
Extract the attributes from the element. |
java.lang.String |
getFileSuffix()
Return the file suffix this parser reacts upon |
java.lang.String |
getMode()
Our mode is 'dtd' |
java.lang.String |
getSpecificHelp()
Additional help for this parser |
private Container |
parse(Container parent,
com.wutka.dtd.DTD dtd,
com.wutka.dtd.DTDElement root,
int level)
Recursively pare the DTD and fill its data into containers. |
private Container |
parse(Container parent,
com.wutka.dtd.DTD dtd,
com.wutka.dtd.DTDItem root,
int level)
Recursively parse the DTD and fill its data into containers (This method deals with DTDItem, rather than DTDElement). |
Container |
parseInput()
Parse the input. |
private void |
setCardinality(Container cont,
com.wutka.dtd.DTDCardinal cardinal)
Set the cardinality of the container depending on the DTD cardinality |
private void |
setContentModel(Container cont,
com.wutka.dtd.DTDItem item)
Set the content model in the container from the passed item |
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)
Set the parser specific options. |
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 MODE_STRING
private static final java.lang.String FILE_SUFFIX_STRING
private java.io.File dtdFile
private java.lang.String dtdRootName
private boolean shouldGuessDtdRootName
private int treeDepth
private boolean alsoAttributes
Constructor Detail |
---|
public DtdParser()
Method Detail |
---|
public Container parseInput() throws java.io.IOException, ParserProblemException
parseInput
in interface InputParser
ParserProblemException
- If a problem with the passed DTD is found
java.io.IOException
- if the underlying DTDParser
encounters a problem.Container
private Container parse(Container parent, com.wutka.dtd.DTD dtd, com.wutka.dtd.DTDItem root, int level) throws ParserProblemException
parent
- The parent container where our stuff will be appended todtd
- The DTD to useroot
- The 'current' root item of this part of the DTD treelevel
- How deep do we want the generated tree to be? 0=root element only
ParserProblemException
- If a DTD element that is referred to can not be found.private Container parse(Container parent, com.wutka.dtd.DTD dtd, com.wutka.dtd.DTDElement root, int level) throws ParserProblemException
parent
- the parent container of those that will be created on this round. null if it is the parent is the tree root.dtd
- The DTD to useroot
- The 'current' root element of this part of the DTD treelevel
- How deep do we want the generated tree to be? 0=root element only
ParserProblemException
- If a DTD element that is referred to can not be found.private void addAttributes(Container cont, com.wutka.dtd.DTDElement element)
cont
- Container to put the attributes intoelement
- The element from where the attributes get pulled.private void setCardinality(Container cont, com.wutka.dtd.DTDCardinal cardinal)
cont
- The container to fillcardinal
- The cardinality of the DTDprivate void setContentModel(Container cont, com.wutka.dtd.DTDItem item)
cont
- The container to fillitem
- The DTDitem from where information is obtainedpublic void setInputFile(java.io.File inputFile)
setInputFile
in interface InputParser
inputFile
- a valid 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
public java.lang.String getFileSuffix()
InputParser
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 |