dk.brics.xmlgraph.converter
Class Serializer

java.lang.Object
  extended by dk.brics.xmlgraph.converter.Serializer

public class Serializer
extends Object

Production of serialized XML representation of XML graphs.


Constructor Summary
Serializer()
          Constructs a new converter.
 
Method Summary
 Document convert(XMLGraph xg, boolean store_origins)
          Returns JDOM representation of this XML graph.
 Map<String,Automaton> getAutomata()
          Returns automata constructed by convert(XMLGraph,boolean).
 void store(XMLGraph xg, String dir, boolean store_origins)
          Stores XML graph in XML file xg.xml and serialized automata in .aut files.
 void store(XMLGraph xg, ZipOutputStream zip, boolean store_origins)
          Stores XML graph (including automata) in ZIP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Serializer

public Serializer()
Constructs a new converter.

Method Detail

convert

public Document convert(XMLGraph xg,
                        boolean store_origins)
Returns JDOM representation of this XML graph. String type automata are obtained subsequently using getAutomata(). Only the reachable part of the XML graph is included.

Parameters:
xg - XML graph to convert
store_origins - if true, node origins are stored as strings (and ignored otherwise)
Returns:
XML document

getAutomata

public Map<String,Automaton> getAutomata()
Returns automata constructed by convert(XMLGraph,boolean).

Returns:
map from file names to Automaton objects

store

public void store(XMLGraph xg,
                  String dir,
                  boolean store_origins)
           throws IOException
Stores XML graph in XML file xg.xml and serialized automata in .aut files.

Parameters:
xg - XML graph
dir - directory where files are stored
store_origins - if true, node origins are stored as strings (and ignored otherwise)
Throws:
IOException - if files cannot be written

store

public void store(XMLGraph xg,
                  ZipOutputStream zip,
                  boolean store_origins)
           throws IOException
Stores XML graph (including automata) in ZIP.

Parameters:
xg - XML graph
zip - zip output stream where files are stored
store_origins - if true, node origins are stored as strings (and ignored otherwise)
Throws:
IOException - if files cannot be written


Copyright © 2005-2010 Anders Møller.