|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.rubato.xml.XMLReader
public final class XMLReader
A reader for the XML-based Rubato file format.
Constructor Summary | |
---|---|
XMLReader(java.io.File file)
Creates an XMLReader from the given file . |
|
XMLReader(java.io.Reader reader)
Creates an XMLReader using the global repository. |
|
XMLReader(java.io.Reader reader,
Repository repository)
Creates an XMLReader using the specified repository. |
Method Summary | |
---|---|
void |
addDenoToBeResolved(Denotator d)
Adds the given denotator to the list of denotators that have to be resolved later. |
void |
addFormToBeResolved(Form f)
Adds the given form to the list of forms that have to be resolved later. |
static boolean |
getBooleanAttribute(org.w3c.dom.Element element,
java.lang.String attr)
Returns the boolean value of the given attribute in the specified element. |
static org.w3c.dom.Element |
getChild(org.w3c.dom.Element element,
java.lang.String name)
Returns the first child of the specified element that has the given name. |
Denotator |
getDenotator(java.lang.String name)
Returns the denotator with the given name. |
java.util.List<Denotator> |
getDenotators()
Returns a list of all denotators parsed from XML. |
static double[] |
getDoubleArrayAttribute(org.w3c.dom.Element element,
java.lang.String attr)
|
static java.util.List<java.lang.Double> |
getDoubleListAttribute(org.w3c.dom.Element element,
java.lang.String attr)
|
java.util.List<java.lang.String> |
getErrors()
Returns the list of errors occurred during parsing. |
Form |
getForm(java.lang.String name)
Returns the form with the given name. |
java.util.List<Form> |
getForms()
Returns a list of all forms parsed from XML. |
static int[] |
getIntArrayAttribute(org.w3c.dom.Element element,
java.lang.String attr)
|
static int |
getIntAttribute(org.w3c.dom.Element element,
java.lang.String attr,
int def)
Returns the integer value of the given attribute in the specified element. |
static int |
getIntAttribute(org.w3c.dom.Element element,
java.lang.String attr,
int min,
int max,
int def)
Returns the integer value of the given attribute in the specified element. |
static java.util.List<java.lang.Integer> |
getIntListAttribute(org.w3c.dom.Element element,
java.lang.String attr)
|
Module |
getModule(java.lang.String name)
Returns the module for the given name. |
ModuleElement |
getModuleElement(java.lang.String name)
Returns the module element for the given name. |
java.util.Set<java.lang.String> |
getModuleElementNames()
Returns the names of all parsed module elements. |
java.util.Map<java.lang.String,ModuleElement> |
getModuleElements()
Returns the parsed module elements as a map from names to elements. |
ModuleMorphism |
getModuleMorphism(java.lang.String name)
Returns the module morphism for the given name. |
java.util.Set<java.lang.String> |
getModuleMorphismNames()
Returns the names of all parsed module morphisms. |
java.util.Map<java.lang.String,ModuleMorphism> |
getModuleMorphisms()
Returns the parsed module morphisms as a map from names to morphisms. |
java.util.Set<java.lang.String> |
getModuleNames()
Returns the names of all parsed modules. |
java.util.Map<java.lang.String,Module> |
getModules()
Returns the parsed modules as a map from names to modules. |
java.util.List<NetworkModel> |
getNetworks()
Returns the parsed networks as a list. |
static org.w3c.dom.Element |
getNextSibling(org.w3c.dom.Element element,
java.lang.String name)
Returns the next (sibling) element after the specified element that has the given name. |
static double |
getRealAttribute(org.w3c.dom.Element element,
java.lang.String attr,
double def)
Returns the double value of the given attribute in the specified element. |
java.util.List<Rubette> |
getRubettes()
Returns the parsed rubettes as a list. |
java.lang.String |
getSchemeCode()
Returns the Scheme code. |
static java.lang.String |
getStringAttribute(org.w3c.dom.Element element,
java.lang.String attr)
Returns the string value of the given attribute in the specified element. |
static java.lang.String |
getText(org.w3c.dom.Element element)
Returns the text content of element . |
boolean |
hasError()
Returns true if parsing produced any error. |
void |
parse()
Parses an XML file. |
Form |
parseAndResolveForm(org.w3c.dom.Element formNode)
Parses the form starting from the given XML element, then, if the form is a reference, resolve the reference. |
Denotator |
parseDenotator(org.w3c.dom.Element denotatorNode)
Parses the denotator starting from the given XML element. |
void |
parseFile(java.lang.String fileName)
Parses an XML file with the specified file name. |
Form |
parseForm(org.w3c.dom.Element formNode)
Parses the form starting from the given XML element. |
Module |
parseModule(org.w3c.dom.Element moduleNode)
Parses the module starting from the given XML element. |
ModuleElement |
parseModuleElement(org.w3c.dom.Element elementNode)
Parses the module element starting from the given XML element. |
ModuleMorphism |
parseModuleMorphism(org.w3c.dom.Element morphismNode)
Parses the module morphism starting from the given XML element. |
MorphismMap |
parseMorphismMap(org.w3c.dom.Element morphismMapNode)
Parses the morphism map starting from the given XML element. |
void |
parseString(java.lang.String string)
Parses an XML file contained in the specified string. |
void |
printDenotators()
Displays the denotators that have been parsed. |
void |
printElements()
Displays the module elements that have been parsed. |
void |
printForms()
Displays the forms that have been parsed. |
void |
printModules()
Displays the modules that have been parsed. |
void |
setError(java.lang.Exception e)
Appends the error contained in the given exception to the list of errors. |
void |
setError(java.lang.String string)
Appends the specified error string to the list of errors. |
void |
setError(java.lang.String string,
java.lang.Object... objects)
Appends the specified error string to the list of errors. |
java.lang.String |
toAbsolutePath(java.lang.String path)
Returns an absolute path based on the specified (relative) path. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLReader(java.io.File file) throws java.io.IOException
file
.
java.io.IOException
public XMLReader(java.io.Reader reader)
public XMLReader(java.io.Reader reader, Repository repository)
Method Detail |
---|
public void parse()
public void parseFile(java.lang.String fileName) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void parseString(java.lang.String string)
public boolean hasError()
public java.util.List<java.lang.String> getErrors()
public void setError(java.lang.String string)
public void setError(java.lang.String string, java.lang.Object... objects)
public void setError(java.lang.Exception e)
public Module parseModule(org.w3c.dom.Element moduleNode)
public ModuleElement parseModuleElement(org.w3c.dom.Element elementNode)
public ModuleMorphism parseModuleMorphism(org.w3c.dom.Element morphismNode)
public MorphismMap parseMorphismMap(org.w3c.dom.Element morphismMapNode)
public Denotator parseDenotator(org.w3c.dom.Element denotatorNode)
public Form parseForm(org.w3c.dom.Element formNode)
forms
hashtable
immediately as they are parsed.
In an XML file, only one form definition per name
must occur.
public Form parseAndResolveForm(org.w3c.dom.Element formNode)
public static org.w3c.dom.Element getChild(org.w3c.dom.Element element, java.lang.String name)
public static org.w3c.dom.Element getNextSibling(org.w3c.dom.Element element, java.lang.String name)
public static java.lang.String getText(org.w3c.dom.Element element)
element
.
public static int getIntAttribute(org.w3c.dom.Element element, java.lang.String attr, int def)
element
- the element containing the attributeattr
- the attribute whose value is to be returneddef
- the default value to return if the attribute has wrong formatpublic static int getIntAttribute(org.w3c.dom.Element element, java.lang.String attr, int min, int max, int def)
element
- the element containing the attributeattr
- the attribute whose value is to be returnedmin
- the minimum value allowedmax
- the maximum value alloweddef
- the default value to return if the attribute has wrong formatpublic static boolean getBooleanAttribute(org.w3c.dom.Element element, java.lang.String attr)
element
- the element containing the attributeattr
- the attribute whose value is to be returnedpublic static java.lang.String getStringAttribute(org.w3c.dom.Element element, java.lang.String attr)
element
- the element containing the attributeattr
- the attribute whose value is to be returnedpublic static double getRealAttribute(org.w3c.dom.Element element, java.lang.String attr, double def)
element
- the element containing the attributeattr
- the attribute whose value is to be returneddef
- the default value to return if the attribute has wrong formatpublic static int[] getIntArrayAttribute(org.w3c.dom.Element element, java.lang.String attr)
public static java.util.List<java.lang.Integer> getIntListAttribute(org.w3c.dom.Element element, java.lang.String attr)
public static double[] getDoubleArrayAttribute(org.w3c.dom.Element element, java.lang.String attr)
public static java.util.List<java.lang.Double> getDoubleListAttribute(org.w3c.dom.Element element, java.lang.String attr)
public void printModules()
public void printElements()
public void printForms()
public void printDenotators()
public java.util.Map<java.lang.String,ModuleElement> getModuleElements()
public java.util.Set<java.lang.String> getModuleElementNames()
public ModuleElement getModuleElement(java.lang.String name)
getModuleElement
in interface RubatoDictionary
public java.util.Map<java.lang.String,Module> getModules()
public java.util.Set<java.lang.String> getModuleNames()
public Module getModule(java.lang.String name)
getModule
in interface RubatoDictionary
public java.util.Map<java.lang.String,ModuleMorphism> getModuleMorphisms()
public java.util.Set<java.lang.String> getModuleMorphismNames()
public ModuleMorphism getModuleMorphism(java.lang.String name)
getModuleMorphism
in interface RubatoDictionary
public java.util.List<Denotator> getDenotators()
getDenotators
in interface RubatoDictionary
public Denotator getDenotator(java.lang.String name)
getDenotator
in interface RubatoDictionary
public java.util.List<Form> getForms()
getForms
in interface RubatoDictionary
public Form getForm(java.lang.String name)
getForm
in interface RubatoDictionary
public java.util.List<NetworkModel> getNetworks()
public java.util.List<Rubette> getRubettes()
public java.lang.String getSchemeCode()
public void addFormToBeResolved(Form f)
public void addDenoToBeResolved(Denotator d)
public java.lang.String toAbsolutePath(java.lang.String path)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |