public abstract class XmlSerializer extends Serializer
Abstract XML serializer - contains common logic for descendants.
Modifier and Type | Field and Description |
---|---|
static String |
XMLNS_NAMESPACE |
props
Modifier | Constructor and Description |
---|---|
protected |
XmlSerializer(CleanerProperties props) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
dontEscape(TagNode tagNode) |
protected String |
escapeXml(String xmlContent) |
String |
getXmlAsString(TagNode tagNode)
Deprecated.
Use getAsString() instead.
|
String |
getXmlAsString(TagNode tagNode,
String charset)
Deprecated.
Use getAsString() instead.
|
boolean |
isCreatingHtmlDom() |
protected boolean |
isForbiddenAttribute(TagNode tagNode,
String attName,
String value)
Override to add additional conditions.
|
protected boolean |
isForbiddenTag(TagNode tagNode) |
protected boolean |
isHeadOrBody(String tagName) |
protected boolean |
isMinimizedTagSyntax(TagNode tagNode) |
protected void |
serializeAttribute(TagNode tagNode,
Writer writer,
String attName,
String attValue)
This allows overriding to eliminate forbidden attributes (for example javascript attributes onclick, onblur, etc.
|
protected void |
serializeCData(CData item,
TagNode tagNode,
Writer writer)
Serialize a CDATA section.
|
protected void |
serializeContentToken(ContentNode item,
TagNode tagNode,
Writer writer)
Serialize a content token, escaping where necessary.
|
protected void |
serializeEndTag(TagNode tagNode,
Writer writer) |
protected void |
serializeEndTag(TagNode tagNode,
Writer writer,
boolean newLine) |
protected void |
serializeOpenTag(TagNode tagNode,
Writer writer) |
protected void |
serializeOpenTag(TagNode tagNode,
Writer writer,
boolean newLine) |
void |
setCreatingHtmlDom(boolean creatingHtmlDom) |
void |
writeXml(TagNode tagNode,
Writer writer,
String charset)
Deprecated.
Use write() instead.
|
void |
writeXmlToFile(TagNode tagNode,
String fileName)
Deprecated.
Use writeToFile() instead.
|
void |
writeXmlToFile(TagNode tagNode,
String fileName,
String charset)
Deprecated.
Use writeToFile() instead.
|
void |
writeXmlToStream(TagNode tagNode,
OutputStream out)
Deprecated.
Use writeToStream() instead.
|
void |
writeXmlToStream(TagNode tagNode,
OutputStream out,
String charset)
Deprecated.
Use writeToStream() instead.
|
getAsString, getAsString, getAsString, getAsString, getAsString, isScriptOrStyle, serialize, write, write, writeToFile, writeToFile, writeToFile, writeToFile, writeToStream, writeToStream, writeToStream, writeToStream
public static final String XMLNS_NAMESPACE
protected XmlSerializer(CleanerProperties props)
public void setCreatingHtmlDom(boolean creatingHtmlDom)
creatingHtmlDom
- the creatingHtmlDom to setpublic boolean isCreatingHtmlDom()
@Deprecated public void writeXmlToStream(TagNode tagNode, OutputStream out, String charset) throws IOException
IOException
@Deprecated public void writeXmlToStream(TagNode tagNode, OutputStream out) throws IOException
IOException
@Deprecated public void writeXmlToFile(TagNode tagNode, String fileName, String charset) throws IOException
IOException
@Deprecated public void writeXmlToFile(TagNode tagNode, String fileName) throws IOException
IOException
@Deprecated public String getXmlAsString(TagNode tagNode, String charset)
@Deprecated public String getXmlAsString(TagNode tagNode)
@Deprecated public void writeXml(TagNode tagNode, Writer writer, String charset) throws IOException
IOException
protected boolean dontEscape(TagNode tagNode)
protected boolean isMinimizedTagSyntax(TagNode tagNode)
protected void serializeOpenTag(TagNode tagNode, Writer writer) throws IOException
IOException
protected void serializeCData(CData item, TagNode tagNode, Writer writer) throws IOException
item
- the CDATA instancetagNode
- the TagNode within which the CDATA appearswriter
- the writer to output toIOException
protected void serializeContentToken(ContentNode item, TagNode tagNode, Writer writer) throws IOException
item
- the content token to serializetagNode
- the TagNode within which the content token appearswriter
- the writer to output toIOException
protected void serializeOpenTag(TagNode tagNode, Writer writer, boolean newLine) throws IOException
IOException
protected boolean isForbiddenTag(TagNode tagNode)
tagNode
- protected boolean isHeadOrBody(String tagName)
protected void serializeAttribute(TagNode tagNode, Writer writer, String attName, String attValue) throws IOException
writer
- attName
- attValue
- IOException
protected boolean isForbiddenAttribute(TagNode tagNode, String attName, String value)
tagNode
- attName
- value
- protected void serializeEndTag(TagNode tagNode, Writer writer) throws IOException
IOException
protected void serializeEndTag(TagNode tagNode, Writer writer, boolean newLine) throws IOException
IOException
Copyright © 2006–2018. All rights reserved.