|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.ispsoft.jaxme.XMLSerializer
A simple serializer for XML documents.
| Field Summary | |
static int |
EMPTY_ELEMENT_STYLE_HTML
Constant for serializing empty elements in HTML style, like this: <elem/> |
static int |
EMPTY_ELEMENT_STYLE_XML
Constant for serializing empty elements in XML style, like this: <elem/> |
| Constructor Summary | |
XMLSerializer()
Creates a new XmlSerializer |
|
XMLSerializer(java.io.Writer pWriter)
Creates a new XMLSerializer using the given Writer. |
|
XMLSerializer(java.io.Writer pWriter,
int pIndent)
Creates a new XMLSerializer using the given Writer and indentation. |
|
| Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Inserts a string of characters into the document. |
void |
endDocument()
This method finishs the handlers action. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
Terminates an element. |
void |
endPrefixMapping(java.lang.String prefix)
Terminates use of a namespace prefix. |
org.xml.sax.Locator |
getDocumentLocator()
Returns the locator |
int |
getEmptyElementStyle()
Returns how empty elements will be serialized. |
int |
getIndent()
Returns the indent for XML formating. |
java.lang.String |
getLineFeed()
Returns the line feed string for XML formating. |
java.io.Writer |
getWriter()
Returns the Writer. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Calls the character method with the same arguments. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Inserts a processing instruction. |
void |
setDocumentLocator(org.xml.sax.Locator l)
Sets the locator. |
void |
setEmptyElementStyle(int pStyle)
Sets how empty elements will be serialized. |
void |
setIndent(int pIndent)
Sets the indent for XML formating. |
void |
setLineFeed(java.lang.String pLineFeed)
Sets the line feed string for XML formating. |
void |
setWriter(java.io.Writer w)
Sets the writer. |
void |
skippedEntity(java.lang.String ent)
Not actually implemented, because I don't know how to skip entities. |
void |
startDocument()
Starts a document. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attr)
Starts a new element. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String namespaceURI)
Starts use of a namespace prefix. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int EMPTY_ELEMENT_STYLE_XML
Constant for serializing empty elements in XML style, like this:
<elem/>
getEmptyElementStyle(),
setEmptyElementStyle(int),
EMPTY_ELEMENT_STYLE_HTML,
Constant Field Valuespublic static final int EMPTY_ELEMENT_STYLE_HTML
Constant for serializing empty elements in HTML style, like this:
<elem/>
getEmptyElementStyle(),
setEmptyElementStyle(int),
EMPTY_ELEMENT_STYLE_XML,
Constant Field Values| Constructor Detail |
public XMLSerializer()
public XMLSerializer(java.io.Writer pWriter)
pWriter - A Writer for which setWriter is being called.setWriter(java.io.Writer)
public XMLSerializer(java.io.Writer pWriter,
int pIndent)
pWriter - A Writer for which setWriter is being called.pIndent - The indent level to use for elements.| Method Detail |
public int getIndent()
Returns the indent for XML formating. The ident is the number of blanks being added in front of every opening element, preceded by a line feed. The behavior more or less resembles standard XML formating.
A special value is 0, which disables indentation.
setIndent(int),
getLineFeed()public void setIndent(int pIndent)
Sets the indent for XML formating. The ident is the number of blanks being added in front of every opening element, preceded by a line feed. The behavior more or less resembles standard XML formating.
A special value is 0, which disables indentation.
pIndent - The indentation level being usedsetIndent(int),
getLineFeed()public java.lang.String getLineFeed()
Returns the line feed string for XML formating. Any closing tag will be followed by this String in order to provide human readable output. Examples: "\r" (Unix line terminator, default) or "\r\n" (Windows line terminator).
A special value is 0, which disables indentation.
setLineFeed(java.lang.String),
getIndent()public void setLineFeed(java.lang.String pLineFeed)
Sets the line feed string for XML formating. Any closing tag will be followed by this String in order to provide human readable output. Examples: "\r" (Unix line terminator, default) or "\r\n" (Windows line terminator).
A special value is 0, which disables indentation.
pLineFeed - The new line feed StringgetLineFeed(),
setIndent(int)public void setDocumentLocator(org.xml.sax.Locator l)
setDocumentLocator in interface org.xml.sax.ContentHandlerl - A locator for use in case of errorsgetDocumentLocator()public org.xml.sax.Locator getDocumentLocator()
setDocumentLocator(org.xml.sax.Locator)public void setWriter(java.io.Writer w)
w - The destination WritergetWriter()public java.io.Writer getWriter()
setWriter(java.io.Writer)
public void startPrefixMapping(java.lang.String prefix,
java.lang.String namespaceURI)
throws org.xml.sax.SAXException
Starts use of a namespace prefix.
startPrefixMapping in interface org.xml.sax.ContentHandlernamespaceURI - The namespace URIprefix - The prefix
org.xml.sax.SAXException - Not actually thrown, just for compliance to the interface specification.
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
Terminates use of a namespace prefix.
endPrefixMapping in interface org.xml.sax.ContentHandlerprefix - The prefix being abandoned.
org.xml.sax.SAXException - Not actually thrown, just for compliance to the interface specification.
public void startDocument()
throws org.xml.sax.SAXException
Starts a document.
startDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - Not actually thrown, just for compliance to the interface specification.
public void endDocument()
throws org.xml.sax.SAXException
This method finishs the handlers action. After calling endDocument you may start a new action by calling startDocument again.
endDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - Not actually thrown, just for compliance to the
interface specification.
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerch - A string of whitespace characters being inserted into the document.start - The index of the first character.length - The number of characters.
org.xml.sax.SAXException - Thrown in case of an IOException.
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlerch - The characters being inserted. A substring, to be precise.start - Index of the first characterlength - Number of characters being inserted
org.xml.sax.SAXException - Thrown in case of an IOException
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
Terminates an element.
endElement in interface org.xml.sax.ContentHandlernamespaceURI - The namespace URI, if any, or nulllocalName - The local name, without prefix, or nullqName - The qualified name, including a prefix, or null
org.xml.sax.SAXException - Thrown in case of an IOException.
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attr)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlernamespaceURI - The namespace URI, if any, or nulllocalName - The local name, without prefix, or nullqName - The qualified name, including a prefix, or nullattr - The element attributes
org.xml.sax.SAXException - Thrown in case of an IOException.
public void skippedEntity(java.lang.String ent)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlerent - The entity being skipped.
org.xml.sax.SAXException - Not actually thrown, just for compliance to the interface specification.
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlertarget - The PI targetdata - The PI data
org.xml.sax.SAXException - Thrown in case of an IOExceptionpublic int getEmptyElementStyle()
Returns how empty elements will be serialized.
setEmptyElementStyle(int)public void setEmptyElementStyle(int pStyle)
Sets how empty elements will be serialized.
pStyle - Either of EMPTY_ELEMENT_STYLE_XML or EMPTY_ELEMENT_STYLE_HTML.getEmptyElementStyle()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||