|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.util.xml.XmlSerializer
public class XmlSerializer
XmlSerializer is an utility class, that simplifies creation of XML files. It is designed to be similar to the XML Pull API serializer.
| Constructor Summary | |
|---|---|
XmlSerializer()
|
|
| Method Summary | |
|---|---|
XmlSerializer |
attribute(java.lang.String localName,
java.lang.String value)
Write an attribute out for the current entity. |
XmlSerializer |
cdsect(java.lang.String text)
Writes raw, CDATA section |
XmlSerializer |
comment(java.lang.String text)
Writes XML comment code |
XmlSerializer |
docdecl(java.lang.String text)
Writes DOCTYPE declaration. |
void |
endDocument()
Close this writer. |
XmlSerializer |
endTag()
Deprecated. see endTag(String) |
XmlSerializer |
endTag(java.lang.String aName)
End the current entity. |
int |
getDepth()
Returns the current depth of the element. |
void |
setIndent(boolean indent)
Enables/disables indentation |
void |
setOutput(java.io.OutputStream os,
java.lang.String encoding)
Set to use binary output stream with given encoding. |
XmlSerializer |
setOutput(java.io.Writer writer)
Opens and initializes XML output on top of existing Writer. |
XmlSerializer |
startDocument(java.lang.String encoding,
java.lang.Boolean standalone)
Writes XML prolog code: |
XmlSerializer |
startTag(java.lang.String name)
Begin to output an entity. |
XmlSerializer |
text(java.lang.String text)
Output body text. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlSerializer()
| Method Detail |
|---|
public XmlSerializer setOutput(java.io.Writer writer)
writer - the output writer
public void setOutput(java.io.OutputStream os,
java.lang.String encoding)
throws java.io.IOException
os - the output streamencoding - the output encoding
java.io.IOException
java.lang.NullPointerException - is output stream is nullsetOutput(Writer)
public XmlSerializer startDocument(java.lang.String encoding,
java.lang.Boolean standalone)
throws java.io.IOException
<?xml version="1.0"?>
encoding - the selected encoding. If null encoding
attribute is not written.standalone - if the XML is stand-alone, no DTD or schema
java.io.IOException - on I/O error
java.lang.IllegalStateException - if prolog code is already writtenpublic void endDocument()
java.lang.IllegalStateException - if tags are not closedpublic int getDepth()
<!-- outside --> 0
<root> 1
sometext 1
<foobar> 2
</foobar> 2
</root> 1
<!-- outside --> 0
public XmlSerializer startTag(java.lang.String name)
throws java.io.IOException
name - name of entity.
java.io.IOException - on I/O error
public XmlSerializer endTag()
throws java.io.IOException
endTag(String)
java.io.IOException
public XmlSerializer endTag(java.lang.String aName)
throws java.io.IOException
aName - tag to close. This is used mostly for validation
java.io.IOException - on I/O error
java.lang.IllegalStateException - if no entity waits to be closed
java.lang.IllegalArgumentException - if expected element name is not the same
public XmlSerializer attribute(java.lang.String localName,
java.lang.String value)
throws java.io.IOException
localName - name of attribute.value - value of attribute.
java.io.IOException - on I/O error
java.lang.IllegalStateException - if opening tag is closed
public XmlSerializer text(java.lang.String text)
throws java.io.IOException
text - the body text
java.io.IOException - on I/O error
public XmlSerializer cdsect(java.lang.String text)
throws java.io.IOException
text - the data
java.io.IOException - on I/O error
public XmlSerializer comment(java.lang.String text)
throws java.io.IOException
text - the comment
java.io.IOException - on I/O error
public XmlSerializer docdecl(java.lang.String text)
throws java.io.IOException
text - declaration
java.io.IOException - on I/O error
java.lang.IllegalStateException - if document is not open or start tag is
already startedpublic void setIndent(boolean indent)
indent - an indentation string or null to disable
indentation.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||