Package org.apache.fop.util
Class GenerationHelperContentHandler
- java.lang.Object
-
- org.apache.fop.util.DelegatingContentHandler
-
- org.apache.fop.util.GenerationHelperContentHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.ext.LexicalHandler
public class GenerationHelperContentHandler extends DelegatingContentHandler
This class is a delegating SAX ContentHandler which has the purpose to provide a few handy methods that make life easier when generating SAX events.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
contentHandlerContext
private static org.xml.sax.Attributes
EMPTY_ATTS
private java.lang.String
mainNamespace
-
Constructor Summary
Constructors Constructor Description GenerationHelperContentHandler(org.xml.sax.ContentHandler handler, java.lang.String mainNamespace, java.lang.Object contentHandlerContext)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
element(java.lang.String localName, org.xml.sax.Attributes atts)
Convenience method to generate an empty element with attributes.void
element(org.apache.xmlgraphics.util.QName qName, org.xml.sax.Attributes atts)
Convenience method to generate an empty element with attributes.void
endElement(java.lang.String localName)
Convenience method to generate a endElement SAX event.void
endElement(org.apache.xmlgraphics.util.QName qName)
Convenience method to generate a startElement SAX event.java.lang.Object
getContentHandlerContext()
Returns the context object (may be null).java.lang.String
getMainNamespace()
Returns the main namespace used for generated XML content.void
setMainNamespace(java.lang.String namespaceURI)
Sets the main namespace used for generated XML content when abbreviated ContentHandler calls are used.void
startElement(java.lang.String localName)
Convenience method to generate a startElement SAX event.void
startElement(java.lang.String localName, org.xml.sax.Attributes atts)
Convenience method to generate a startElement SAX event.void
startElement(org.apache.xmlgraphics.util.QName qName)
Convenience method to generate a startElement SAX event.void
startElement(org.apache.xmlgraphics.util.QName qName, org.xml.sax.Attributes atts)
Convenience method to generate a startElement SAX event.-
Methods inherited from class org.apache.fop.util.DelegatingContentHandler
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, error, fatalError, getDelegateContentHandler, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDelegateContentHandler, setDelegateDTDHandler, setDelegateEntityResolver, setDelegateErrorHandler, setDelegateLexicalHandler, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
GenerationHelperContentHandler
public GenerationHelperContentHandler(org.xml.sax.ContentHandler handler, java.lang.String mainNamespace, java.lang.Object contentHandlerContext)
Main constructor. If the given handler also implements any of the EntityResolver, DTDHandler, LexicalHandler or ErrorHandler interfaces, these are set automatically.- Parameters:
handler
- the SAX content handler to delegate all calls tomainNamespace
- the main namespace used for generated XML content when abbreviated ContentHandler calls are used.contentHandlerContext
- additional content handler context state
-
-
Method Detail
-
getMainNamespace
public java.lang.String getMainNamespace()
Returns the main namespace used for generated XML content.- Returns:
- the main namespace
-
setMainNamespace
public void setMainNamespace(java.lang.String namespaceURI)
Sets the main namespace used for generated XML content when abbreviated ContentHandler calls are used.- Parameters:
namespaceURI
- the new main namespace URI
-
getContentHandlerContext
public java.lang.Object getContentHandlerContext()
Returns the context object (may be null).- Returns:
- the context object
-
startElement
public void startElement(java.lang.String localName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Convenience method to generate a startElement SAX event.- Parameters:
localName
- the local name of the elementatts
- the attributes- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
startElement
public void startElement(java.lang.String localName) throws org.xml.sax.SAXException
Convenience method to generate a startElement SAX event.- Parameters:
localName
- the local name of the element- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
startElement
public void startElement(org.apache.xmlgraphics.util.QName qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Convenience method to generate a startElement SAX event.- Parameters:
qName
- the qualified name of the elementatts
- the attributes- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
startElement
public void startElement(org.apache.xmlgraphics.util.QName qName) throws org.xml.sax.SAXException
Convenience method to generate a startElement SAX event.- Parameters:
qName
- the qualified name of the element- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
endElement
public void endElement(java.lang.String localName) throws org.xml.sax.SAXException
Convenience method to generate a endElement SAX event.- Parameters:
localName
- the local name of the element- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
endElement
public void endElement(org.apache.xmlgraphics.util.QName qName) throws org.xml.sax.SAXException
Convenience method to generate a startElement SAX event.- Parameters:
qName
- the qualified name of the element- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
element
public void element(java.lang.String localName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Convenience method to generate an empty element with attributes.- Parameters:
localName
- the local name of the elementatts
- the attributes- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
element
public void element(org.apache.xmlgraphics.util.QName qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Convenience method to generate an empty element with attributes.- Parameters:
qName
- the qualified name of the elementatts
- the attributes- Throws:
org.xml.sax.SAXException
- if a SAX exception occurs
-
-