Class XMLDataHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.nomagic.magicreport.engine.xml.XMLDataHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
XML Data handler.
- Since:
- May 23, 2008
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) /** Receive notification of character data inside an element.voidReceive notification of the end of the document.voidendElement(String uri, String localName, String qName) Receive notification of the end of an element.voidReceive notification of the beginning of the document.voidstartElement(String uri, String localName, String qName, Attributes attributes) Receive notification of the start of an element.protected voidwrite(char c) Write a single character.protected voidwrite(char[] cbuf, int off, int len) Write a portion of an array of characters.protected voidWrite a string.protected voidwrite(StringBuffer buffer) Write a StringBuffer.protected voidwrite(StringBuilder buffer) protected voidwriteAttributes(Attributes attributes) Write all attributes to writer.protected voidwriteText(char chr) Filter the specified character that are sensitive to XML interpreters and write into the writer.protected voidwriteText(char[] cbuf, int off, int len) Filter the specified character that are sensitive to XML interpreters and write a portion of an array of characters into the writer.protected voidwriteText(CharSequence buffer) Filter the specified character that are sensitive to XML interpreters and write a StringBuffer into the writer.Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
writer
Contains writer for this handler.
-
-
Constructor Details
-
XMLDataHandler
Create SAX handler.- Parameters:
writer- output writer
-
-
Method Details
-
write
Write a string.- Parameters:
string- String to be written- Throws:
SAXException- If an I/O error occurs
-
write
Write a StringBuffer.- Parameters:
buffer- StringBuffer to be written.- Throws:
SAXException- If an I/O error occurs
-
write
- Throws:
SAXException
-
write
Write a single character.- Parameters:
c- int specifying a character to be written.- Throws:
SAXException- If an I/O error occurs
-
write
Write a portion of an array of characters.- Parameters:
cbuf- Array of charactersoff- Offset from which to start writing characterslen- Number of characters to write- Throws:
SAXException- If an I/O error occurs
-
writeText
Filter the specified character that are sensitive to XML interpreters and write into the writer.- Parameters:
chr- int specifying a character to be written.- Throws:
SAXException- If an I/O error occurs
-
writeText
Filter the specified character that are sensitive to XML interpreters and write a portion of an array of characters into the writer.- Parameters:
cbuf- Array of charactersoff- Offset from which to start writing characterslen- Number of characters to write- Throws:
SAXException- If an I/O error occurs
-
writeText
Filter the specified character that are sensitive to XML interpreters and write a StringBuffer into the writer.- Parameters:
buffer- StringBuffer- Throws:
SAXException- If an I/O error occurs
-
writeAttributes
Write all attributes to writer.- Parameters:
attributes- XML attributes- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-
startDocument
Receive notification of the beginning of the document.By default, write a XML document header.
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-
endDocument
Receive notification of the end of the document.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalizing a tree or closing an output file).
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Receive notification of the start of an element.By default, write a XML start tag and attributes.
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The qualified name (with prefix), or the empty string if qualified names are not available.attributes- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-
characters
/** Receive notification of character data inside an element.By default, write a XML text content
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- The characters.start- The start position in the character array.length- The number of characters to use from the character array.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-
endElement
Receive notification of the end of an element.By default, write a XML end tag
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The qualified name (with prefix), or the empty string if qualified names are not available.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.
-