org.objectweb.asm.xml
Class Processor.SAXWriter
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.objectweb.asm.xml.Processor.SAXWriter
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler
- Enclosing class:
- Processor
private static final class Processor.SAXWriter
- extends org.xml.sax.helpers.DefaultHandler
- implements org.xml.sax.ext.LexicalHandler
A ContentHandler and
LexicalHandler that serializes XML
from SAX 2.0 events into Writer.
This implementation does not support namespaces, entity
definitions (uncluding DTD), CDATA and text elements.
|
Constructor Summary |
Processor.SAXWriter(java.io.Writer w,
boolean optimizeEmptyElements)
Creates SAXWriter. |
|
Method Summary |
private void |
closeElement()
|
void |
comment(char[] ch,
int off,
int len)
|
void |
endCDATA()
|
void |
endDocument()
|
void |
endDTD()
|
void |
endElement(java.lang.String ns,
java.lang.String localName,
java.lang.String qName)
|
void |
endEntity(java.lang.String arg0)
|
private java.lang.String |
esc(java.lang.String str)
Encode string with escaping. |
void |
startCDATA()
|
void |
startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
|
void |
startElement(java.lang.String ns,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
void |
startEntity(java.lang.String arg0)
|
private void |
writeAttributes(org.xml.sax.Attributes atts)
|
private void |
writeIdent()
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OFF
private static final char[] OFF
w
private java.io.Writer w
optimizeEmptyElements
private boolean optimizeEmptyElements
openElement
private boolean openElement
ident
private int ident
Processor.SAXWriter
public Processor.SAXWriter(java.io.Writer w,
boolean optimizeEmptyElements)
- Creates
SAXWriter.
- Parameters:
w - writeroptimizeEmptyElements - if set to true, short
XML syntax will be used for empty elements
startElement
public final void startElement(java.lang.String ns,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
- Specified by:
startElement in interface org.xml.sax.ContentHandler- Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
endElement
public final void endElement(java.lang.String ns,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
- Specified by:
endElement in interface org.xml.sax.ContentHandler- Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
endDocument
public final void endDocument()
throws org.xml.sax.SAXException
- Specified by:
endDocument in interface org.xml.sax.ContentHandler- Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
comment
public final void comment(char[] ch,
int off,
int len)
throws org.xml.sax.SAXException
- Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
startDTD
public final void startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
throws org.xml.sax.SAXException
- Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
endDTD
public final void endDTD()
throws org.xml.sax.SAXException
- Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
startEntity
public final void startEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
endEntity
public final void endEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
startCDATA
public final void startCDATA()
throws org.xml.sax.SAXException
- Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
endCDATA
public final void endCDATA()
throws org.xml.sax.SAXException
- Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
- Throws:
org.xml.sax.SAXException
writeAttributes
private final void writeAttributes(org.xml.sax.Attributes atts)
throws java.io.IOException
- Throws:
java.io.IOException
esc
private final java.lang.String esc(java.lang.String str)
- Encode string with escaping.
- Parameters:
str - string to encode.
- Returns:
- encoded string
writeIdent
private final void writeIdent()
throws java.io.IOException
- Throws:
java.io.IOException
closeElement
private final void closeElement()
throws java.io.IOException
- Throws:
java.io.IOException