public class DOMElementWriter extends Object
| Constructor and Description |
|---|
DOMElementWriter() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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(Element element,
Writer out,
int indent,
String indentWith)
Writes a DOM tree to a stream.
|
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(Element 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)
public String encodedata(String value)
See XML 1.0 2.2 http://www.w3.org/TR/1998/REC-xml-19980210#charsets.
public boolean isReference(String ent)
public boolean isLegalCharacter(char c)
See XML 1.0 2.2 http://www.w3.org/TR/1998/REC-xml-19980210#charsets.
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries