org.jscience.ml.openmath.io
Class OMDOMReader

java.lang.Object
  extended by org.jscience.ml.openmath.io.OMDOMReader

public class OMDOMReader
extends java.lang.Object

An OpenMath DOM reader.


Field Summary
protected  org.xml.sax.InputSource mInputSource
          Stores the input-source if we use one.
protected  org.w3c.dom.Node mNode
          Stores the node we want to read the OMObject from.
protected static java.lang.String[] sOMObjects
          Stores a static array with all the OpenMath element-names in use.
 
Constructor Summary
OMDOMReader(org.w3c.dom.Document document)
          Constructor.
OMDOMReader(org.w3c.dom.DocumentFragment fragment)
          Constructor.
OMDOMReader(org.xml.sax.InputSource inputSource)
          Constructor.
OMDOMReader(org.w3c.dom.Node node)
          Constructor.
OMDOMReader(java.lang.String string)
          Constructor.
 
Method Summary
 OMObject readObject()
          Read an OpenMath object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sOMObjects

protected static java.lang.String[] sOMObjects
Stores a static array with all the OpenMath element-names in use.


mInputSource

protected org.xml.sax.InputSource mInputSource
Stores the input-source if we use one.


mNode

protected org.w3c.dom.Node mNode
Stores the node we want to read the OMObject from.

Constructor Detail

OMDOMReader

public OMDOMReader(org.w3c.dom.Document document)
Constructor.

Parameters:
document - the document to read using the reader.

OMDOMReader

public OMDOMReader(org.w3c.dom.DocumentFragment fragment)
Constructor.

Parameters:
fragment - the document fragment to read using the reader.

OMDOMReader

public OMDOMReader(org.w3c.dom.Node node)
Constructor.

Parameters:
node - the node to read using the reader.

OMDOMReader

public OMDOMReader(org.xml.sax.InputSource inputSource)
Constructor.

Parameters:
inputSource - the InputSource to read from using this reader.

OMDOMReader

public OMDOMReader(java.lang.String string)
Constructor.

Parameters:
string - the string to read from using this reader.
Method Detail

readObject

public OMObject readObject()
                    throws java.io.IOException
Read an OpenMath object.

1. If we are a document then get the nodelist that contains an OMOBJ. Take the first of the list and read that object.

2. Or if we are a document fragment assume the first child is the OMObject.

3. Or just assume the node contains the OMObject.

Returns:
the OpenMath object.
Throws:
java.io.IOException - when a problem arises while reading.