Constructor and Description |
---|
XMLWriter(OutputStream out)
Create a XMLWriter with an output stream.
|
XMLWriter(OutputStreamWriter out)
Create a XMLWriter with an existing Writer.
|
XMLWriter(OutputStreamWriter out,
String docType)
Create a XMLWriter with an existing Writer.
|
XMLWriter(String filename)
Create a XMLWriter with the path to a file.
|
XMLWriter(String filename,
String docType)
Create a XMLWriter with the path to a file.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttr(String name,
Color color)
Add a color attribute to the opened tag.
|
void |
addAttr(String name,
String value)
add an attribute to the opened tag.
|
void |
addComplexContent(String s,
boolean b)
add a complex "text child", it will be enclosed into CDATA markers
|
void |
addContent(String s)
add a "text child"
|
void |
addFormatedContent(String s,
boolean b)
add a "text child", already formated: should _NOT_ be escaped
|
void |
addTag(String name)
add (i.e.
|
void |
addTag(String name,
String[] attributes)
add (i.e.
|
void |
addTag(String name,
String[] attributes,
String content)
add (i.e.
|
void |
addTagWithContent(String tag,
Object content)
add (i.e.
|
void |
addTagWithContent(String tag,
String content)
add (i.e.
|
void |
close()
Close the writer: all open tags and the underlying outputstream.
|
void |
closeTag()
close the currently opened tag.
|
static String |
deriveValidId(String id) |
String |
getBuffer()
If
toBuffer has previously been called, stop saving to buffer. |
static boolean |
isValidId(String id)
Indicates if the given string is a valid GINsim ID (contains only a-z, A-Z, 0-9, "_" or "-" characters)
|
void |
openTag(String name)
open a tag in the XML output file
|
void |
openTag(String name,
String[] attributes)
open a tag and add it the specified attributes.
|
void |
toBuffer()
ask to store the next calls into a string buffer.
|
void |
write(char c) |
void |
write(String s) |
void |
writeEsc(String s,
boolean isAttVal) |
public XMLWriter(String filename) throws IOException
filename
- IOException
public XMLWriter(String filename, String docType) throws IOException
filename
- docType
- IOException
public XMLWriter(OutputStreamWriter out) throws IOException
out
- IOException
public XMLWriter(OutputStreamWriter out, String docType) throws IOException
out
- docType
- IOException
public XMLWriter(OutputStream out) throws IOException
out
- IOException
public static boolean isValidId(String id)
id
- the string to testpublic void toBuffer() throws IOException
getBuffer()
to stop it and get the content of the buffer.IOException
public String getBuffer()
toBuffer
has previously been called, stop saving to buffer.public void writeEsc(String s, boolean isAttVal) throws IOException
s
- isAttVal
- IOException
public void write(String s) throws IOException
s
- IOException
public void write(char c) throws IOException
c
- IOException
public void openTag(String name) throws IOException
name
- IOException
public void addTag(String name) throws IOException
name
- IOException
public void addTag(String name, String[] attributes, String content) throws IOException
name
- attributes
- content
- IOException
public void openTag(String name, String[] attributes) throws IOException
name
- attributes
- IOException
public void addTag(String name, String[] attributes) throws IOException
name
- attributes
- IOException
public void addTagWithContent(String tag, Object content) throws IOException
tag
- content
- IOException
public void addTagWithContent(String tag, String content) throws IOException
tag
- content
- IOException
public void closeTag() throws IOException
IOException
public void addAttr(String name, Color color) throws IOException
name
- color
- IOException
public void addAttr(String name, String value) throws IOException
name
- value
- IOException
public void addContent(String s) throws IOException
s
- IOException
public void addFormatedContent(String s, boolean b) throws IOException
s
- b
- if true, then the file might get indentedIOException
public void addComplexContent(String s, boolean b) throws IOException
s
- b
- if true, then the file might get indentedIOException
public void close() throws IOException
IOException
Copyright © 2005–2020. All rights reserved.