com.simonstl.moe.factory
Class SAXFactory
java.lang.Object
|
+--org.xml.sax.helpers.XMLFilterImpl
|
+--com.simonstl.moe.factory.SAXFactory
- All Implemented Interfaces:
- ComponentOutputI, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader
- Direct Known Subclasses:
- SAXFactoryTree
- public class SAXFactory
- extends org.xml.sax.helpers.XMLFilterImpl
- implements org.xml.sax.ext.LexicalHandler, ComponentOutputI
The SAXFactory class provides a relatively simple mechanism for creating new MOE components, hardwired to the components provided in the com.simonstl.moe package. It in turn relies on the ComponentFactory
class.
This class extends XMLFilterImpl rather than DefaultHandler so that it can be used as a pass-through if appropriate.
- Version:
- 0.01 29 August 2001
- Author:
- Simon St.Laurent
Constructor Summary |
SAXFactory(org.xml.sax.XMLReader parent)
|
Method Summary |
void |
characters(char[] ch,
int offset,
int len)
|
void |
comment(char[] ch,
int offset,
int len)
|
void |
endCDATA()
|
void |
endDTD()
|
void |
endElement(java.lang.String uri,
java.lang.String localname,
java.lang.String qname)
|
void |
endEntity(java.lang.String name)
|
void |
endPrefixMapping(java.lang.String prefix)
|
CoreComponentI |
getCurrentComponent()
Not sure I'll keep this. |
org.xml.sax.XMLReader |
getEventSource()
|
org.xml.sax.InputSource |
getSource()
|
int |
getStatus()
getStatus allows impatient listeners to find out what's going on. |
void |
ignorableWhitespace(char[] ch,
int offset,
int len)
|
static void |
main(java.lang.String[] args)
FilterTester's main method requires two arguments - a rules file and then a target XML file. |
static void |
printHelp()
printHelp() lists options if the user doesn't specify any files. |
void |
setEventSource(org.xml.sax.XMLReader _eventSource)
|
void |
setListener(ComponentInputI _listener)
It's all gotta go someplace. |
boolean |
setReport(int typeReport)
setReport tells the outputter whether to report content as the largest objects it knows (0), a SAX-like view of content(1), or some other view (other numbers.) If an outputter doesn't understand a request, it should return false. |
void |
setSource(org.xml.sax.InputSource _source)
|
void |
startCDATA()
|
void |
startDTD(java.lang.String root,
java.lang.String publicId,
java.lang.String systemId)
|
void |
startElement(java.lang.String uri,
java.lang.String localname,
java.lang.String qname,
org.xml.sax.Attributes atts)
|
void |
startEntity(java.lang.String name)
|
void |
startEvents()
startEvents starts the reading, much like parse() in SAX. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
|
java.lang.String |
toString()
|
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
targetFile
protected java.lang.String targetFile
eventSource
protected org.xml.sax.XMLReader eventSource
source
protected org.xml.sax.InputSource source
status
protected int status
listener
protected ComponentInputI listener
cqf
protected ComponentQFactory cqf
SAXFactory
public SAXFactory(org.xml.sax.XMLReader parent)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getStatus
public int getStatus()
- Description copied from interface:
ComponentOutputI
- getStatus allows impatient listeners to find out what's going on. A status of 0 means that no information has been retrieved yet, a status of 1 means that it's collecting information locally, and maybe I'll come up with other useful bits. 2 means it's done.
- Specified by:
getStatus
in interface ComponentOutputI
setReport
public boolean setReport(int typeReport)
- Description copied from interface:
ComponentOutputI
- setReport tells the outputter whether to report content as the largest objects it knows (0), a SAX-like view of content(1), or some other view (other numbers.) If an outputter doesn't understand a request, it should return false.
- Specified by:
setReport
in interface ComponentOutputI
getCurrentComponent
public CoreComponentI getCurrentComponent()
- Not sure I'll keep this.
- Specified by:
getCurrentComponent
in interface ComponentOutputI
setListener
public void setListener(ComponentInputI _listener)
- It's all gotta go someplace.
- Specified by:
setListener
in interface ComponentOutputI
startEvents
public void startEvents()
throws MOEException
- Description copied from interface:
ComponentOutputI
- startEvents starts the reading, much like parse() in SAX.
- Specified by:
startEvents
in interface ComponentOutputI
setEventSource
public void setEventSource(org.xml.sax.XMLReader _eventSource)
getEventSource
public org.xml.sax.XMLReader getEventSource()
getSource
public org.xml.sax.InputSource getSource()
setSource
public void setSource(org.xml.sax.InputSource _source)
startElement
public void startElement(java.lang.String uri,
java.lang.String localname,
java.lang.String qname,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
- Overrides:
startElement
in class org.xml.sax.helpers.XMLFilterImpl
endElement
public void endElement(java.lang.String uri,
java.lang.String localname,
java.lang.String qname)
throws org.xml.sax.SAXException
- Overrides:
endElement
in class org.xml.sax.helpers.XMLFilterImpl
characters
public void characters(char[] ch,
int offset,
int len)
throws org.xml.sax.SAXException
- Overrides:
characters
in class org.xml.sax.helpers.XMLFilterImpl
ignorableWhitespace
public void ignorableWhitespace(char[] ch,
int offset,
int len)
throws org.xml.sax.SAXException
- Overrides:
ignorableWhitespace
in class org.xml.sax.helpers.XMLFilterImpl
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
- Overrides:
startPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
- Overrides:
endPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
comment
public void comment(char[] ch,
int offset,
int len)
throws org.xml.sax.SAXException
- Specified by:
comment
in interface org.xml.sax.ext.LexicalHandler
startCDATA
public void startCDATA()
throws org.xml.sax.SAXException
- Specified by:
startCDATA
in interface org.xml.sax.ext.LexicalHandler
endCDATA
public void endCDATA()
throws org.xml.sax.SAXException
- Specified by:
endCDATA
in interface org.xml.sax.ext.LexicalHandler
startDTD
public void startDTD(java.lang.String root,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
- Specified by:
startDTD
in interface org.xml.sax.ext.LexicalHandler
endDTD
public void endDTD()
throws org.xml.sax.SAXException
- Specified by:
endDTD
in interface org.xml.sax.ext.LexicalHandler
startEntity
public void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
- Specified by:
startEntity
in interface org.xml.sax.ext.LexicalHandler
endEntity
public void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
- Specified by:
endEntity
in interface org.xml.sax.ext.LexicalHandler
printHelp
public static void printHelp()
- printHelp() lists options if the user doesn't specify any files.
main
public static void main(java.lang.String[] args)
throws org.xml.sax.SAXException,
java.io.IOException,
java.io.FileNotFoundException,
MOEException
- FilterTester's main method requires two arguments - a rules file and then a target XML file.
Options may appear before those arguments:
-p [parser wrapper class name] - specifies a SAX2 parser for use with this tool
/>