|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.jscience.io.openmath.OMXMLReader
public class OMXMLReader
Constructs an OpenMath Object (OMObject) from the XML-input.
Field Summary | |
---|---|
protected java.util.Vector |
mElementStack
Stores an vector with the last active element as the last in the vector. |
protected org.xml.sax.InputSource |
mInputSource
Stores the input-source. |
protected OMObject |
mOMObject
Stores the OMObject for this reader. |
protected static java.lang.String[] |
sOMObjects
Stores a static array with all the OpenMath element-names in use. |
Constructor Summary | |
---|---|
OMXMLReader()
Constructor. |
|
OMXMLReader(org.xml.sax.InputSource fInputSource)
Constructor. |
|
OMXMLReader(java.lang.String fString)
Constructor taking a String as the InputSource. |
Method Summary | |
---|---|
void |
characters(char[] fCharacters,
int fStart,
int fLength)
We've encountered a PCDATA section. |
void |
endDocument()
End the document. |
void |
endElement(java.lang.String fNamespaceURI,
java.lang.String fLocalName,
java.lang.String fRawName)
End a XML element. |
OMObject |
getObject()
Get the OpenMath object. |
void |
ignorableWhitespace(char[] tCharacter,
int tStart,
int tLength)
Process ignorable whitespace. |
void |
processingInstruction(java.lang.String fTarget,
java.lang.String fData)
Process the processing instruction. |
OMObject |
readObject()
Read an OpenMath object. |
void |
setDocumentLocator(org.xml.sax.Locator fLocator)
Set the document-locator. |
void |
startDocument()
Signals the start of the document. |
void |
startElement(java.lang.String fNamespaceURI,
java.lang.String fLocalName,
java.lang.String fRawName,
org.xml.sax.Attributes fAttributes)
Start a XML element. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.lang.String[] sOMObjects
protected OMObject mOMObject
protected java.util.Vector mElementStack
protected org.xml.sax.InputSource mInputSource
Constructor Detail |
---|
public OMXMLReader()
public OMXMLReader(org.xml.sax.InputSource fInputSource)
fInputSource
- the InputSource to read from.public OMXMLReader(java.lang.String fString)
fString
- the string to read from.Method Detail |
---|
public void characters(char[] fCharacters, int fStart, int fLength) throws org.xml.sax.SAXException
Check if we have an enclosing OMInteger or OMString and set the data-members accordingly.
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
fCharacters
- the characters to handle.fStart
- the start index into the characters array.fLength
- the number of characters to read from the start.
org.xml.sax.SAXException
- when something is seriously wrong.public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
public void endElement(java.lang.String fNamespaceURI, java.lang.String fLocalName, java.lang.String fRawName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
fNamespaceURI
- the URI of the namespace.fLocalName
- the locale name of the element.fRawName
- the raw name of the element.
org.xml.sax.SAXException
- when something is seriously wrong.public void ignorableWhitespace(char[] tCharacter, int tStart, int tLength)
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.DefaultHandler
tCharacter
- the characters that can be ignored.tStart
- the start index into the characters array.tLength
- the number of characters to ignore.public void processingInstruction(java.lang.String fTarget, java.lang.String fData)
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
fTarget
- the target of the processing instruction.fData
- the data of the processing instruction.public OMObject readObject() throws java.io.IOException
java.io.IOException
- when reading failed.public OMObject getObject()
Note: if you didn't set this reader up from an input-source nor from a String, you will need this method to get the actual object at the end of reading. This method will only garantuee the proper result if you call it after 'endDocument' has be recognized.
public void setDocumentLocator(org.xml.sax.Locator fLocator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
fLocator
- the document locator to use.public void startDocument()
We reinitiliaze all the data-structures used during parsing, note that this parser is not reentrant and should only be used sequentially.
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String fNamespaceURI, java.lang.String fLocalName, java.lang.String fRawName, org.xml.sax.Attributes fAttributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
fNamespaceURI
- the namespace URI.fLocalName
- the local name of the element.fRawName
- the raw name of the element.fAttributes
- the attributes of the element.
org.xml.sax.SAXException
- when something is seriously wrong.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |