|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.sahits.codegen.input.XMLJDomParser
public class XMLJDomParser
This XML parser is based on JDom. This is a basic parser that only retrieves the parser class. This class is intended to be extended by the parser class.
| Field Summary | |
|---|---|
protected Document |
document
This is the document representation of the XML file |
protected Element |
root
This is the root tag of the XML document |
| Constructor Summary | |
|---|---|
XMLJDomParser()
Default constructor |
|
XMLJDomParser(java.lang.String inputFile)
Initialize the parser with the input file |
|
| Method Summary | |
|---|---|
java.util.List<Attribute> |
getAllAttributes(Element e)
Retrieve all attributes of an Element |
java.util.List<Element> |
getAllElements(java.lang.String elementName)
Retrieve all elements elementName in the XML document. |
java.lang.String |
getAttributeValue(Element e,
java.lang.String attributName)
Retrieve the attribute value for the attribute attributeName |
java.lang.String |
getFileExtension()
This parser parses XML files |
Element |
getFirstElement(java.lang.String elementName)
Retrieve the first element elementName in the XML document. |
java.lang.String |
getParserName()
Retrieve the fully qualified class name of the parser that is specified in the XML tag <modelgenerator>. |
protected Content |
getPredecessor(Element elem)
Retrieve the predecessor of an element |
int |
getRanking()
The ranking for xml input parsers is ignored since each xml file must specify the parser |
boolean |
hasChild(Element elem)
Check whether an element has at least one child |
boolean |
hasChild(Element elem,
java.lang.String childName)
Check whether an element has at least on child of a given name |
boolean |
hasText(Element elem)
Check whether the element has textual value |
void |
init(java.lang.String inputFile)
Initialize the parser |
protected java.util.List<Element> |
lookup(Element parent,
java.lang.String elementName)
Find all elements with the name elementName that are children to parent or the parent itself |
IGeneratedObject |
parse()
This method is depricated use the appropriate generateModel method instead. |
void |
setNamespace(java.lang.String namespace)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Document document
protected Element root
| Constructor Detail |
|---|
public XMLJDomParser(java.lang.String inputFile)
throws JDOMException,
java.io.IOException
inputFile - input XML file
java.io.IOException
JDOMExceptionpublic XMLJDomParser()
| Method Detail |
|---|
public void init(java.lang.String inputFile)
throws java.lang.Exception
inputFile - Input parser
java.lang.Exception - one of the following
JDOMException - Could not create a SAX parser
java.io.IOException - Could not read from input file
java.net.MalformedURLException - malformed input filepublic java.lang.String getParserName()
public final Element getFirstElement(java.lang.String elementName)
elementName in the XML document.
This neglects the structure of the document. All tags are searched recursively
from the root tag.
elementName - name of the XML tag
elementName or null if no element was foundpublic final java.util.List<Element> getAllElements(java.lang.String elementName)
elementName in the XML document.
This neglects the structure of the document. All tags are searched recursievly
from the root tag.
elementName - name of the XML tag
elementName or empty list if no element was found
public final java.lang.String getAttributeValue(Element e,
java.lang.String attributName)
attributeName
e - Element of the AttributeattributName - name of the attribute
public final java.util.List<Attribute> getAllAttributes(Element e)
e - Element of the Attributes
protected final java.util.List<Element> lookup(Element parent,
java.lang.String elementName)
elementName that are children to parent or the parent itself
parent - Element to start the lookupelementName - name of the element
public final boolean hasText(Element elem)
elem - Element to be checked
public final boolean hasChild(Element elem)
elem - element to be checked
public final boolean hasChild(Element elem,
java.lang.String childName)
elem - element to be checkedchildName - type of the child
public final void setNamespace(java.lang.String namespace)
namespace - the namespace to setprotected final Content getPredecessor(Element elem)
elem - whose predecessor is searched
public java.lang.String getFileExtension()
public IGeneratedObject parse()
public int getRanking()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||