|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.persistence.XMLStreamReader
Class XMLStreamReader loads an XML file, parses its contents
and creates a runtime AttributeList instance containing
Attribute or AttributeSet objects or both.
Constraint objects may be assigned to all these objects
in the list.
The following seven basic types are explicitly converted by class
XMLStreamReader.
StringDoubleFloatIntegerLongBooleanColorAttribute
with a value of type String is created.
Structure of XML-file:
- LIST:
<list name=NAME>
(LIST | SET | ATTRIBUTE)*
(constraint)+
</list>
NAME: Name of list (in a set this has to be unique)
- SET:
<set name=NAME>
(SET | ATTRIBUTE)*
</set>
NAME: String name of this set (in a set this has to be unique)
- ATTRIBUTE:
<attribute name=NAME type=TYPE value=VALUE>
(CONSTRAINT)+
</attribute>
NAME: String name of this attribute (in a set this has to be unique)
TYPE: Full classname of the value of this attribute
VALUE: Initial value of the instance of this valueobject
- CONSTRAINT:
<constraint>
<![cdata[(EXPR)]]>
</constraint>
(Instead of the cdata-Part a text node is allowed, too:
<constraint>value==0</constraint>
But concerning the special characters (">", ...) it should not be used.)
- EXPR:
String expression that can be parsed by a ConstraintParser.
Structure of AttributeList:
- LIST:
AttributeList, containing attributes of following types:
(LIST-ATTRIBUTE | SET-ATTRIBUTE | ATTRIBUTE)*
May contain a valid constraint of any type.
- LIST-ATTRIBUTE:
Attribute with name and value. In a set the name has to be unique.
The name will be stored as name of the list.
The value is of type AttributeList.
Must not contain a Constraint, as this is ignored when writing to XML.
Instead the Constraint should be assigned to the AttributeList directly.
The list itself may contain the following attributes:
(LIST-ATTRIBUTE | SET-ATTRIBUTE | ATTRIBUTE)*
- SET-ATTRIBUTE:
Attribute with name and value. In a set the name has to be unique.
The name will be stored as name of the set.
The value is of type AttributeSet.
Must not contain a Constraint, as this is ignored when writing to XML.
Instead the Constraint should be assigned to the AttributeSet directly.
The set itself may contain the following attributes:
(SET-ATTRIBUTE | ATTRIBUTE)*
- ATTRIBUTE:
Any Attribute with a name and value. In a set the name has to be unique.
The value may be of any type that can be recreated/stored by
parseToObject() (or storeToString() of XMLWriter).
| Constructor Summary | |
XMLStreamReader(java.io.InputStream inStream)
Constructor specifying the InputStream to use. |
|
| Method Summary | |
AttributeList |
read()
This method reads the information available in the data source and returns them in form of an AttributeList. |
void |
setInput(java.io.InputStream inStream)
Sets the input stream for a second use for this class instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XMLStreamReader(java.io.InputStream inStream)
InputStream to use.
inStream - the InputStream to use.| Method Detail |
public void setInput(java.io.InputStream inStream)
inStream - the InputStream that method
read() will use.
public AttributeList read()
throws ReadException
ReaderAttributeList.
read in interface ReaderAttributeList with the read information.
ReadException - is thrown whenever an error occurs
while reading the informationReader.read()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||