org.simBio.serialize.xml
Class XMLSerializer

java.lang.Object
  extended by org.simBio.serialize.xml.XMLSerializer
All Implemented Interfaces:
Serializer

public class XMLSerializer
extends java.lang.Object
implements Serializer

XML serializer. It constructs models from XML, and writes them to XML.
モデルをXMLから構築し、書き出す。

Version:
$Id: XMLSerializer.java,v 1.7 2006/12/07 02:11:28 nsarai Exp $
Author:
Nobuaki Sarai

Constructor Summary
XMLSerializer(org.xml.sax.InputSource source)
          An XMLSerializer constructor which takes an XML input source as a parameter.
XMLSerializer(org.xml.sax.InputSource source, java.lang.ClassLoader loader)
          An XMLSerializer constructor which takes an XML input source and a class loader as parameters.
XMLSerializer(java.io.Reader input)
          An XMLSerializer constructor which takes an XML file Reader as a parameter.
XMLSerializer(java.lang.String uri)
          Set location of the xml file and set default tags.
 
Method Summary
 java.net.URL[] getCodebases()
          This returns the search path of URLs for loading classes
 Component getComponent(java.lang.String className)
          Return Class instance designated by the complete class name.
 Component read()
          Deserialize from xml file.
 void setEncoding(java.lang.String encoding)
          Set source encoding.
 void update(Component component, java.io.OutputStream stream, org.xml.sax.InputSource original)
          Updates an XML file.
 void update(Component component, java.lang.String uri, java.io.Reader reference)
          Updates an XML file.
 void write(Component component)
          Serialize to the xml file.
 void write(Component component, java.lang.String uri)
          Serializes a component to the xml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLSerializer

public XMLSerializer(org.xml.sax.InputSource source,
                     java.lang.ClassLoader loader)
An XMLSerializer constructor which takes an XML input source and a class loader as parameters.

Parameters:
source - an xml of a model
loader - where to find a class

XMLSerializer

public XMLSerializer(org.xml.sax.InputSource source)
An XMLSerializer constructor which takes an XML input source as a parameter.

Parameters:
source - model xml

XMLSerializer

public XMLSerializer(java.lang.String uri)
Set location of the xml file and set default tags. (URI:Uniform Resource Identifier)

Parameters:
uri - the location of the xml file

XMLSerializer

public XMLSerializer(java.io.Reader input)
An XMLSerializer constructor which takes an XML file Reader as a parameter.

Parameters:
input - Reader of the xml file
Method Detail

write

public void write(Component component)
           throws java.io.IOException
Serialize to the xml file.
componentをXML形式で書き出す。

Parameters:
component - component node of the model tree
Throws:
java.io.IOException

write

public void write(Component component,
                  java.lang.String uri)
           throws java.io.IOException
Serializes a component to the xml file. (writes it in XML format)

Specified by:
write in interface Serializer
Parameters:
component - component node of the model tree
uri - location of the xml file
Throws:
java.io.IOException

read

public Component read()
               throws java.lang.InstantiationException
Deserialize from xml file.
XML形式のmodelを解釈してmodelインスタンスを作成する。

Specified by:
read in interface Serializer
Returns:
root component of the model instance tree
Throws:
java.lang.InstantiationException
See Also:
Serializer.read()

setEncoding

public void setEncoding(java.lang.String encoding)
Set source encoding.

Parameters:
encoding - character encoding of the XML source

getComponent

public Component getComponent(java.lang.String className)
                       throws java.lang.InstantiationException
Return Class instance designated by the complete class name. child nodes are created.

Parameters:
className - complete class name
Returns:
instance of the class.
Throws:
java.lang.InstantiationException

update

public void update(Component component,
                   java.lang.String uri,
                   java.io.Reader reference)
            throws java.io.IOException
Updates an XML file.

Parameters:
component - component node of the model tree
uri - system identifier for an input source
reference - Reader for an XML input source
Throws:
java.io.IOException
See Also:
Serializer

update

public void update(Component component,
                   java.io.OutputStream stream,
                   org.xml.sax.InputSource original)
Updates an XML file.

Specified by:
update in interface Serializer
Parameters:
component - component node of the model tree
stream - output stream which will be written to
original - original XML input source

getCodebases

public java.net.URL[] getCodebases()
This returns the search path of URLs for loading classes

Specified by:
getCodebases in interface Serializer


Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.