net.kolls.railworld.io
Class XMLReader

java.lang.Object
  extended by net.kolls.railworld.io.XMLReader

public class XMLReader
extends java.lang.Object

Reads RWM files in the XML format.

Author:
Steve Kollmansberger

Nested Class Summary
protected static class XMLReader.XMLHandler
          The workhorse.
 
Constructor Summary
XMLReader()
           
 
Method Summary
static RailSegment[] read(java.io.File f, MetaData toBeFilled)
          Reads from an RWM file and returns the rail segments.
static RailSegment[] read(java.net.URL f, MetaData toBeFilled)
          Reads from an RWM file and returns the rail segments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReader

public XMLReader()
Method Detail

read

public static RailSegment[] read(java.net.URL f,
                                 MetaData toBeFilled)
                          throws org.xml.sax.SAXException,
                                 java.io.IOException
Reads from an RWM file and returns the rail segments. Uses two passes.

Parameters:
f - URL of the RWM file
toBeFilled - An instance of MetaData to fill.
Returns:
An array of RailSegment representing all segments.
Throws:
org.xml.sax.SAXException - If the parser encounters an error.
java.io.IOException - If the URL cannot be read.

read

public static RailSegment[] read(java.io.File f,
                                 MetaData toBeFilled)
                          throws org.xml.sax.SAXException,
                                 java.io.IOException
Reads from an RWM file and returns the rail segments. Uses two passes.

Parameters:
f - File of the RWM file
toBeFilled - An instance of MetaData to fill.
Returns:
An array of RailSegment representing all segments.
Throws:
org.xml.sax.SAXException - If the parser encounters an error.
java.io.IOException - If the URL cannot be read.