pilot.xmlparser
Class XMLparser
java.lang.Object
|
+--pilot.xmlparser.XMLparser
- public class XMLparser
- extends java.lang.Object
|
Method Summary |
static java.lang.String |
getAttribute(pilot.xmlparser.Element e,
java.lang.String attribute,
java.lang.String defaultValue)
The method getAttribute returns the given attribute of the XML
element, or the default value if the attribute is not specified or the
element is null. |
static java.util.List |
getMatchingElements(pilot.xmlparser.Element e,
java.lang.String name)
The method getMatchingElements returns a list of child elements
that match the specified name. |
static pilot.xmlparser.Element |
loadXMLFile(java.lang.String source,
java.lang.String path)
The method loadXMLFile takes an xml file, parses it to a DOM, and
returns the root element of the xml. |
static pilot.xmlparser.Element |
loadXMLtext(java.lang.String source)
The method loadXMLtext parses a string with xml code to a DOM and
returns the root element. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLparser
public XMLparser()
loadXMLFile
public static pilot.xmlparser.Element loadXMLFile(java.lang.String source,
java.lang.String path)
- The method loadXMLFile takes an xml file, parses it to a DOM, and
returns the root element of the xml.
- Parameters:
source - The xml filenamepath - The path of the xml file- Returns:
- The root element od the DOM tree
loadXMLtext
public static pilot.xmlparser.Element loadXMLtext(java.lang.String source)
- The method loadXMLtext parses a string with xml code to a DOM and
returns the root element.
- Parameters:
source - The string with xml code- Returns:
- The root element of the DOM
getMatchingElements
public static java.util.List getMatchingElements(pilot.xmlparser.Element e,
java.lang.String name)
- The method getMatchingElements returns a list of child elements
that match the specified name.
- Parameters:
e - The parent elementname - The name of the child elements- Returns:
- A list with the appropriate child elements.
getAttribute
public static java.lang.String getAttribute(pilot.xmlparser.Element e,
java.lang.String attribute,
java.lang.String defaultValue)
- The method getAttribute returns the given attribute of the XML
element, or the default value if the attribute is not specified or the
element is null.
- Parameters:
e - The element containing the attribute.attribute - The name of the attribute.defaultValue - The default value.- Returns:
- The value of the attribute.