public class SaxEventHandlerDelegate extends org.xml.sax.helpers.DefaultHandler
XmlInputTransformer
to delegate SAX Parse events to the
relevant handlers. Its primary method is read(java.io.InputStream)
which takes in an
InputStream
returns a Metacard
, populated with all the Attribute
s parsed
by the eventHandlers
Constructor and Description |
---|
SaxEventHandlerDelegate() |
SaxEventHandlerDelegate(List<SaxEventHandler> eventHandlers) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Takes in a sax event from
parser and passes it to the eventHandlers |
void |
endDocument()
Takes in a sax event from
parser and passes it to the eventHandlers |
void |
endElement(String namespaceURI,
String localName,
String qName)
Takes in a sax event from
parser and passes it to the eventHandlers |
void |
endPrefixMapping(String prefix) |
Metacard |
getMetacard(String id) |
MetacardType |
getMetacardType(String id)
Defines and returns a
DynamicMetacardType based on component Sax Event Handlers and
what attributes they populate |
org.apache.commons.io.input.TeeInputStream |
getMetadataStream(InputStream inputStream,
OutputStream outputStream) |
SaxEventHandlerDelegate |
read(InputStream inputStream)
Takes in an
InputStream returns a Metacard , populated with all the Attribute s parsed by the eventHandlers |
void |
startDocument()
Takes in a sax event from
parser and passes it to the eventHandlers |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
Takes in a sax event from
parser and passes it to the eventHandlers |
void |
startPrefixMapping(String prefix,
String uri)
Takes in a sax event from
parser and passes it to the eventHandlers |
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
public SaxEventHandlerDelegate()
public SaxEventHandlerDelegate(List<SaxEventHandler> eventHandlers)
public SaxEventHandlerDelegate read(InputStream inputStream) throws CatalogTransformerException
InputStream
returns a Metacard
, populated with all the Attribute
s parsed by the eventHandlers
inputStream
- an XML document that can be parsed into a MetacardMetacard
, populated with all the Attribute
s parsed by the eventHandlers
CatalogTransformerException
public void startDocument() throws SAXException
parser
and passes it to the eventHandlers
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endDocument() throws SAXException
parser
and passes it to the eventHandlers
endDocument
in interface ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
parser
and passes it to the eventHandlers
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- the URI that is passed in by SaxEventHandlerDelegate
localName
- the localName that is passed in by SaxEventHandlerDelegate
qName
- the qName that is passed in by SaxEventHandlerDelegate
attributes
- the attributes that are passed in by SaxEventHandlerDelegate
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
parser
and passes it to the eventHandlers
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- the ch that is passed in by SaxEventHandlerDelegate
start
- the start that is passed in by SaxEventHandlerDelegate
length
- the length that is passed in by SaxEventHandlerDelegate
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
parser
and passes it to the eventHandlers
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
namespaceURI
- the namespaceURI that is passed in by SaxEventHandlerDelegate
localName
- the localName that is passed in by SaxEventHandlerDelegate
qName
- the qName that is passed in by SaxEventHandlerDelegate
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
parser
and passes it to the eventHandlers
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
prefix
- the prefix that is passed in by SaxEventHandlerDelegate
uri
- the uri that is passed in by SaxEventHandlerDelegate
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
SAXException
public org.apache.commons.io.input.TeeInputStream getMetadataStream(InputStream inputStream, OutputStream outputStream)
public MetacardType getMetacardType(String id)
DynamicMetacardType
based on component Sax Event Handlers and
what attributes they populateThis work is licensed under a Creative Commons Attribution 4.0 International License.