Develop Regular Processors
To develop your own SAX processor, implement a regular SAX ContentHandler
but extend PAPISAXProcessor
, instead of
DefaultHandler
.
For example:
package com.exalead.papi.connectors.filesystem.xml.processors; import com.exalead.papi.connectors.filesystem.xml.processors.common.PAPISAXProcessor; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class CustomSAXProcessor extends PAPISAXProcessor { @Override public void startDocument() throws SAXException { /* TODO */ } @Override public void endDocument() throws SAXException { /* TODO */ } @Override public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException { /* TODO */ } @Override public void endElement(String arg0, String localName, String arg2) throws SAXException { /* TODO */ } @Override public void characters(char[] arg0, int arg1, int arg2) throws SAXException { /* TODO */ } }
If you want to develop a DOM processor, extend PAPIDOMProcessor
, and implement
the process(org.w3c.dom.Document)
method.
package com.exalead.papi.connectors.filesystem.xml.processors; import com.exalead.papi.connectors.filesystem.xml.processors.common.PAPIDOMProcessor; import org.w3c.dom.Document; public class CustomDOMProcessor extends PAPIDOMProcessor { @Override public void process(Document domDocument) throws Exception { /* TODO */ } }