|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.xml.DOMElementWriter
public class DOMElementWriter
Writes a DOM tree to a given Writer.
Utility class used by XMLUtils and
net.java.sip.communicator.slick.runner.SipCommunicatorSlickRunner.
| Field Summary | |
|---|---|
protected String[] |
knownEntities
Don't try to be too smart but at least recognize the predefined entities. |
| Constructor Summary | |
|---|---|
DOMElementWriter()
|
|
| Method Summary | |
|---|---|
static String |
decodeName(String name)
Decodes an XML (element) name according to http://www.w3.org/TR/xml/#NT-Name. |
String |
encode(String value)
Escape <, > & ', " as their entities and drop characters that are illegal in XML documents. |
String |
encodedata(String value)
Drop characters that are illegal in XML documents. |
static String |
encodeName(String value)
Encodes a specific String so that it is a valid XML (element) name according to http://www.w3.org/TR/xml/#NT-Name. |
boolean |
isLegalCharacter(char c)
Is the given character allowed inside an XML document? |
boolean |
isReference(String ent)
Is the given argument a character or entity reference? |
void |
write(Element root,
OutputStream out)
Writes a DOM tree to a stream in UTF8 encoding. |
void |
write(Node element,
Writer out,
int indent,
String indentWith)
Writes a DOM tree to a stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String[] knownEntities
| Constructor Detail |
|---|
public DOMElementWriter()
| Method Detail |
|---|
public static String decodeName(String name)
name - the XML (element) name to be decoded
public static String encodeName(String value)
value - the String to be encoded so that it is a valid XML
name
public void write(Element root,
OutputStream out)
throws IOException
root - the root element of the DOM tree.out - the outputstream to write to.
IOException - if an error happens while writing to the stream.
public void write(Node element,
Writer out,
int indent,
String indentWith)
throws IOException
element - the Root DOM element of the treeout - where to send the outputindent - number ofindentWith - string that should be used to indent the corresponding tag.
IOException - if an error happens while writing to the stream.public String encode(String value)
value - the value to encode
public String encodedata(String value)
Also ensure that we are not including an ]]> marker by replacing that sequence with ]]>.
See XML 1.0 2.2 http://www.w3.org/TR/1998/REC-xml-19980210#charsets and 2.7 http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect.
value - the value to encode
public boolean isReference(String ent)
ent - the string whose nature we need to determine.
public boolean isLegalCharacter(char c)
See XML 1.0 2.2 http://www.w3.org/TR/1998/REC-xml-19980210#charsets.
c - the character whose nature we'd like to determine.
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||