file2xliff4j
Class MifParser

java.lang.Object
  extended by file2xliff4j.MifParser
All Implemented Interfaces:
org.xml.sax.XMLReader

public class MifParser
extends java.lang.Object
implements org.xml.sax.XMLReader

Our implementation of a SAX/like parser for Maker Interchange Format (MIF), a representation of the content of Adobe FrameMaker files.

Although MIF isn't XML, this parser handles it as if it were. It

  1. Calls startElement for tokens immediately following an open angle bracket (<)
  2. Calls endElement when the corresponding closing angle bracket (>) is encountered
  3. Calls characters when the characters of a quoted character stream are found in the input
  4. Calls startDocument and endDocument at the beginning and end of the input

Author:
Weldon Whipple <weldon@lingotek.com>

Constructor Summary
MifParser()
           
 
Method Summary
 org.xml.sax.ContentHandler getContentHandler()
           
 org.xml.sax.DTDHandler getDTDHandler()
           
 org.xml.sax.EntityResolver getEntityResolver()
           
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean getFeature(java.lang.String name)
           
 java.lang.Object getProperty(java.lang.String name)
           
 void parse(org.xml.sax.InputSource input)
          This is the class that actually parses the MIF file.
 void parse(java.lang.String systemId)
           
 void setContentHandler(org.xml.sax.ContentHandler contentHandler)
           
 void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
           
 void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
          Some token implementations that we don't need ...
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
           
 void setFeature(java.lang.String name, boolean value)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MifParser

public MifParser()
Method Detail

parse

public void parse(org.xml.sax.InputSource input)
           throws java.io.IOException,
                  org.xml.sax.SAXException
This is the class that actually parses the MIF file. (It is the only method we care about in this parser.)

The caller should have created the InputSource using the correct encoding before calling ... by checking for the MIFEncoding tag (for CJK encodings).

Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
input - Where to read input from.
Throws:
java.io.IOException - If a problem is encountered while reading input
org.xml.sax.SAXException - If invalid MIF input is encountered.

parse

public void parse(java.lang.String systemId)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
java.io.IOException
org.xml.sax.SAXException

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Specified by:
getFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Specified by:
getProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException
Specified by:
setProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Some token implementations that we don't need ... yet :-)

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Specified by:
getEntityResolver in interface org.xml.sax.XMLReader

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface org.xml.sax.XMLReader

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler contentHandler)
Specified by:
setContentHandler in interface org.xml.sax.XMLReader

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Specified by:
getContentHandler in interface org.xml.sax.XMLReader

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader