de.bsd.x2svg.parsers
Class BuildXmlParser

java.lang.Object
  extended by de.bsd.x2svg.parsers.BuildXmlParser
All Implemented Interfaces:
InputParser

public class BuildXmlParser
extends java.lang.Object
implements InputParser


Field Summary
private  org.w3c.dom.Document doc
           
private static java.lang.String FILE_SUFFIX_STRING
           
private  boolean forest
           
private  java.io.File inputFile
           
private static java.lang.String MODE_STRING
           
private  java.lang.String rootElement
           
 
Constructor Summary
BuildXmlParser()
           
 
Method Summary
private  void findChildren(java.lang.String rootName, Container rootCont)
          Find the children of the target with name rootName and fill them into the passed container.
 java.lang.String getFileSuffix()
          Out suffix is 'build.xml' - whole string
 java.lang.String getMode()
          Our mode is 'ant'
 java.lang.String getSpecificHelp()
          Return a String that gives help for this specific parser.
private  org.w3c.dom.Element getTargetByName(java.lang.String rootName)
          Get a <target> by its 'name' attribute
 Container parseInput()
          Parse the passed build file.
 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

MODE_STRING

private static final java.lang.String MODE_STRING
See Also:
Constant Field Values

FILE_SUFFIX_STRING

private static final java.lang.String FILE_SUFFIX_STRING
See Also:
Constant Field Values

inputFile

private java.io.File inputFile

doc

private org.w3c.dom.Document doc

forest

private boolean forest

rootElement

private java.lang.String rootElement
Constructor Detail

BuildXmlParser

public BuildXmlParser()
Method Detail

parseInput

public Container parseInput()
                     throws java.lang.Exception
Parse the passed build file. First we try to see which element is the root from the <project> tag, then we recursively walk the tree of the targets and build the tree of containers.

Specified by:
parseInput in interface InputParser
Returns:
at least one initialized container.
Throws:
java.lang.Exception - if anything goes wrong.
See Also:
Container

findChildren

private void findChildren(java.lang.String rootName,
                          Container rootCont)
                   throws ParserProblemException
Find the children of the target with name rootName and fill them into the passed container.

Parameters:
rootName - Name of the <target> to work on
rootCont - The container to fill with children.
Throws:
ParserProblemException - If a target with the passed name can not be found.

getTargetByName

private org.w3c.dom.Element getTargetByName(java.lang.String rootName)
Get a <target> by its 'name' attribute

Parameters:
rootName - the name to look for
Returns:
a target element or null

setInputFile

public void setInputFile(java.io.File inputFile)
Sets the input file to work on

Specified by:
setInputFile in interface InputParser
Parameters:
inputFile - a vaild file object to work on

setParserOptions

public void setParserOptions(java.lang.String[] options)
Pass in options to this parser. So far there is nothing to do.

Specified by:
setParserOptions in interface InputParser
Parameters:
options - array of individual option parts as passed on the command line.

getSpecificHelp

public java.lang.String getSpecificHelp()
Description copied from interface: InputParser
Return a String that gives help for this specific parser. This string should list valid command line options.

Specified by:
getSpecificHelp in interface InputParser
Returns:
a help string or null if no help is available.

getFileSuffix

public java.lang.String getFileSuffix()
Out suffix is 'build.xml' - whole string

Specified by:
getFileSuffix in interface InputParser
Returns:
the file suffix

getMode

public java.lang.String getMode()
Our mode is 'ant'

Specified by:
getMode in interface InputParser
Returns:
the mode string

setDebug

public void setDebug()
Description copied from interface: InputParser
Tells the parer to set the debug mode. It depends on the individual parser if it actually has a debug mode.

Specified by:
setDebug in interface InputParser

setWithAttributes

public void setWithAttributes(boolean value)
Description copied from interface: InputParser
Tells the parser that parsing attributes of elements is wanted. It depends on the individual parser if it acutally can parse them. For example the DtdParser is able to do this, while the PropertiesParser is not.

Specified by:
setWithAttributes in interface InputParser
Parameters:
value - The value to set this to.

setWithElementComments

public void setWithElementComments(boolean value)
Description copied from interface: InputParser
Tells the parser that parsing comments for elements (and possibly attributes) is desired.
It depends on the individual parser if it actually can parse them

Specified by:
setWithElementComments in interface InputParser
Parameters:
value - The value to set this to.


x2svg version 1.2.1