edu.harvard.hul.ois.jhove.module.xml
Class XmlLexicalHandler

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.xml.XmlLexicalHandler
All Implemented Interfaces:
org.xml.sax.ext.LexicalHandler

public class XmlLexicalHandler
extends java.lang.Object
implements org.xml.sax.ext.LexicalHandler

This implementation of LexicalHandler takes care of comments, DTD's, entities and other stuff for XmlModule. The caller has to make sure the LexicalHandler property is supported by the SAX implementation, and set that property to this class.

Author:
Gary McGath

Constructor Summary
XmlLexicalHandler()
           
 
Method Summary
 void comment(char[] text, int start, int length)
          Gathers comments into the comments list.
 void endCDATA()
          Report the end of a CDATA section.
 void endDTD()
          Report the end of DTD declarations.
 void endEntity(java.lang.String name)
          Report the end of an entity.
 java.util.List<java.lang.String> getComments()
          Returns the value of the comments list, which is a List of Strings.
 java.util.Set<java.lang.String> getEntityNames()
          Returns the Set of entity names.
 void startCDATA()
          Report the start of a CDATA section.
 void startDTD(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
          Report the start of DTD declarations, if any.
 void startEntity(java.lang.String name)
          Accumulates entity names into the entity set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlLexicalHandler

public XmlLexicalHandler()
Method Detail

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Report the end of a CDATA section. Does nothing.

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.endCDATA()

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Report the end of DTD declarations. Does nothing.

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.endDTD()

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Report the start of a CDATA section. Does nothing.

Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.startCDATA()

comment

public void comment(char[] text,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Gathers comments into the comments list.

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.comment(char[], int, int)

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Accumulates entity names into the entity set. This will be used for determining which entities are actually used.

Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.startEntity(java.lang.String)

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Report the end of an entity. Does nothing.

Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.endEntity(java.lang.String)

startDTD

public void startDTD(java.lang.String arg0,
                     java.lang.String arg1,
                     java.lang.String arg2)
              throws org.xml.sax.SAXException
Report the start of DTD declarations, if any. Does nothing.

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)

getComments

public java.util.List<java.lang.String> getComments()
Returns the value of the comments list, which is a List of Strings.


getEntityNames

public java.util.Set<java.lang.String> getEntityNames()
Returns the Set of entity names.