public class XMLOptions extends Object implements RevisionHandler
Modifier and Type | Field and Description |
---|---|
static String |
ATT_NAME
the name attribute.
|
static String |
ATT_TYPE
the type attribute.
|
static String |
ATT_VALUE
the value attribute.
|
static String |
DOCTYPE
the DTD for the XML file.
|
static String |
ROOT_NODE
the root node.
|
static String |
TAG_OPTION
tag for a single option.
|
static String |
TAG_OPTIONS
tag for a list of options.
|
static String |
VAL_TYPE_CLASSIFIER
a value of the type attribute.
|
static String |
VAL_TYPE_FLAG
a value of the type attribute.
|
static String |
VAL_TYPE_HYPHENS
a value of the type attribute.
|
static String |
VAL_TYPE_OPTIONHANDLER
a value of the type attribute.
|
static String |
VAL_TYPE_QUOTES
a value of the type attribute.
|
static String |
VAL_TYPE_SINGLE
a value of the type attribute.
|
Constructor and Description |
---|
XMLOptions()
Creates a new instance of XMLOptions.
|
XMLOptions(File file)
Creates a new instance of XMLOptions.
|
XMLOptions(InputStream stream)
Creates a new instance of XMLOptions.
|
XMLOptions(Reader reader)
Creates a new instance of XMLOptions.
|
XMLOptions(String xml)
Creates a new instance of XMLOptions.
|
Modifier and Type | Method and Description |
---|---|
Document |
getDocument()
returns the parsed DOM document.
|
String |
getRevision()
Returns the revision string.
|
boolean |
getValidating()
returns whether a validating parser is used.
|
XMLDocument |
getXMLDocument()
returns the handler of the XML document.
|
static void |
main(String[] args)
for testing only.
|
void |
setValidating(boolean validating)
sets whether to use a validating parser or not.
|
String[] |
toArray()
returns the current DOM document as string array.
|
String |
toCommandLine()
returns the given DOM document as command line.
|
String |
toString()
returns the object in a string representation (as indented XML output).
|
public static final String TAG_OPTION
public static final String TAG_OPTIONS
public static final String ATT_NAME
public static final String ATT_TYPE
public static final String ATT_VALUE
public static final String VAL_TYPE_FLAG
public static final String VAL_TYPE_SINGLE
public static final String VAL_TYPE_HYPHENS
public static final String VAL_TYPE_QUOTES
public static final String VAL_TYPE_CLASSIFIER
public static final String VAL_TYPE_OPTIONHANDLER
public static final String ROOT_NODE
public static final String DOCTYPE
public XMLOptions() throws Exception
Exception
- if the construction of the DocumentBuilder failssetValidating(boolean)
public XMLOptions(String xml) throws Exception
xml
- the xml to parse (if "
Exception
- if the construction of the DocumentBuilder failssetValidating(boolean)
public XMLOptions(File file) throws Exception
file
- the XML file to parseException
- if the construction of the DocumentBuilder failssetValidating(boolean)
public XMLOptions(InputStream stream) throws Exception
stream
- the XML stream to parseException
- if the construction of the DocumentBuilder failssetValidating(boolean)
public XMLOptions(Reader reader) throws Exception
reader
- the XML reader to parseException
- if the construction of the DocumentBuilder failssetValidating(boolean)
public boolean getValidating()
public void setValidating(boolean validating) throws Exception
validating
- whether to use a validating parserException
- if the instantiating of the DocumentBuilder failspublic Document getDocument()
public XMLDocument getXMLDocument()
getDocument()
method.getDocument()
public String toCommandLine() throws Exception
Exception
- if anything goes wrong initializing the parsingpublic String[] toArray() throws Exception
Exception
- if anything goes wrong initializing the parsingpublic String toString()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2019 University of Waikato, Hamilton, NZ. All rights reserved.