|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dautelle.xml.Constructor
This class restores objects which have been serialized in XML
format using an ObjectWriter
.
When the XML document is parsed, each elements are recursively
processed and Java objects are created using the factory method
static Object valueOf(XmlElement)
of the class identified
by the name of the XML element. The final object constructed
(and returned) is always the root element of the XML input source.
Processing instructions are ignored, but namespaces may be used to specify package names (java addressing scheme).
For example, the following XML representation can be used to create a matrix composed of complex elements:
<?xml version='1.0'?> <Matrix xmlns="java:com.dautelle.math" row='2' column='2'> <Complex real='0.0' imaginary='0.0'/> <Complex real='0.0' imaginary='1.0'/> <Complex real='0.0' imaginary='1.0'/> <Complex real='0.0' imaginary='0.0'/> </Matrix>
The following code segment creates the matrix from a file.
Constructor constructor = new Constructor(); Matrix M = (Matrix) constructor.create(file);
ObjectWriter
Constructor Summary | |
Constructor()
Default constructor (use RealtimeParser to parse XML document). |
Method Summary | |
java.lang.Object |
create(java.io.File file)
Creates an object from its XML representation read from the specified File . |
java.lang.Object |
create(org.xml.sax.InputSource xmlSource)
Creates an object from its XML representation read from the specified InputSource . |
java.lang.Object |
create(java.io.InputStream in)
Creates an object from its XML representation read from the specified InputStream . |
java.lang.Object |
create(java.io.Reader reader)
Creates an object from its XML representation read from the specified Reader . |
java.lang.Object |
create(java.net.URL url)
Creates an object from its XML representation read from the specified URL . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Constructor()
RealtimeParser
to parse XML document).
Method Detail |
public java.lang.Object create(java.io.InputStream in) throws ConstructorException
InputStream
.
in
- the input stream containing the XML representation of the
object being created.
ConstructorException
- if the object cannot be created.public java.lang.Object create(java.io.Reader reader) throws ConstructorException
Reader
.
reader
- the reader containing the XML representation of the
object being created.
ConstructorException
- if the object cannot be created.public java.lang.Object create(java.io.File file) throws ConstructorException
File
.
file
- the file containing the XML representation of the
object being created.
ConstructorException
- if the object cannot be created.public java.lang.Object create(java.net.URL url) throws ConstructorException
URL
.
url
- the url containing the XML representation of the
object being created.
ConstructorException
- if the object cannot be created.public java.lang.Object create(org.xml.sax.InputSource xmlSource) throws ConstructorException
InputSource
.
xmlSource
- the input source to read from.
ConstructorException
- if the object cannot be created.
|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |