Class XMLSerializer
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.xml.serialize.BaseMarkupSerializer
-
- org.apache.jackrabbit.vault.util.xml.serialize.XMLSerializer
-
- All Implemented Interfaces:
DOMSerializer
,Serializer
,ContentHandler
,DocumentHandler
,DTDHandler
,DeclHandler
,LexicalHandler
@Deprecated(since="2021-09-01") public class XMLSerializer extends BaseMarkupSerializer
Deprecated.Util Classes related to Xerces are removed in subsequent releases causing a major version change. As these utils are for internal use in Filevault the API is getting deprecated from public API surface.ASF Note: This class and dependencies were copied from the sun jdk1.5 source base. The original serializer is extended by a new OutputFormat setting that allows to break the line for each attribute. additionally, all attribute names are sorted alphabetically. Some Features were removed to limit the number of dependent classes:- dom filter support
- all text nodes as CDATA feature
- skip attribute default values feature
- entity node reference feature
Implements an XML serializer supporting both DOM and SAX pretty serializing. For usage instructions see
Serializer
.If an output stream is used, the encoding is taken from the output format (defaults to UTF-8). If a writer is used, make sure the writer uses the same encoding (if applies) as specified in the output format.
The serializer supports both DOM and SAX. SAX serializing is done by firing SAX events and using the serializer as a document handler. DOM serializing is done by calling
BaseMarkupSerializer.serialize(Document)
or by using DOM Level 3If an I/O exception occurs while serializing, the serializer will not throw an exception directly, but only throw it at the end of serializing (either DOM or SAX's
DocumentHandler.endDocument()
.For elements that are not specified as whitespace preserving, the serializer will potentially break long text lines at space boundaries, indent lines, and serialize elements on separate lines. Line terminators will be regarded as spaces, and spaces at beginning of line will be stripped.
- See Also:
Serializer
-
-
Constructor Summary
Constructors Constructor Description XMLSerializer()
Deprecated.Constructs a new serializer.XMLSerializer(OutputStream output, OutputFormat format)
Deprecated.Constructs a new serializer that writes to the specified output stream using the specified output format.XMLSerializer(Writer writer, OutputFormat format)
Deprecated.Constructs a new serializer that writes to the specified writer using the specified output format.XMLSerializer(OutputFormat format)
Deprecated.Constructs a new serializer.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
endElement(String tagName)
Deprecated.void
endElement(String namespaceURI, String localName, String rawName)
Deprecated.void
endElementIO(String namespaceURI, String localName, String rawName)
Deprecated.boolean
reset()
Deprecated.void
setNamespaces(boolean namespaces)
Deprecated.This methods turns on namespace fixup algorithm during DOM serialization.void
setOutputFormat(OutputFormat format)
Deprecated.Specifies an output format for this serializer.void
startElement(String namespaceURI, String localName, String rawName, Attributes attrs)
Deprecated.void
startElement(String tagName, AttributeList attrs)
Deprecated.-
Methods inherited from class org.apache.jackrabbit.vault.util.xml.serialize.BaseMarkupSerializer
asContentHandler, asDocumentHandler, asDOMSerializer, attributeDecl, characters, comment, comment, elementDecl, endCDATA, endDocument, endDTD, endEntity, endNonEscaping, endPrefixMapping, endPreserving, externalEntityDecl, ignorableWhitespace, internalEntityDecl, notationDecl, processingInstruction, processingInstructionIO, serialize, serialize, serialize, setDocumentLocator, setOutputByteStream, setOutputCharStream, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startNonEscaping, startPrefixMapping, startPreserving, unparsedEntityDecl
-
-
-
-
Constructor Detail
-
XMLSerializer
public XMLSerializer()
Deprecated.Constructs a new serializer. The serializer cannot be used without callingBaseMarkupSerializer.setOutputCharStream(java.io.Writer)
orBaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
first.
-
XMLSerializer
public XMLSerializer(OutputFormat format)
Deprecated.Constructs a new serializer. The serializer cannot be used without callingBaseMarkupSerializer.setOutputCharStream(java.io.Writer)
orBaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
first.
-
XMLSerializer
public XMLSerializer(Writer writer, OutputFormat format)
Deprecated.Constructs a new serializer that writes to the specified writer using the specified output format. If format is null, will use a default output format.The specified writer will not be closed by this class.
- Parameters:
writer
- The writer to useformat
- The output format to use, null for the default
-
XMLSerializer
public XMLSerializer(OutputStream output, OutputFormat format)
Deprecated.Constructs a new serializer that writes to the specified output stream using the specified output format. If format is null, will use a default output format.The specified stream will not be closed by this class.
- Parameters:
output
- The output stream to useformat
- The output format to use, null for the default
-
-
Method Detail
-
setOutputFormat
public void setOutputFormat(OutputFormat format)
Deprecated.Description copied from interface:Serializer
Specifies an output format for this serializer. It the serializer has already been associated with an output format, it will switch to the new format. This method should not be called while the serializer is in the process of serializing a document.- Specified by:
setOutputFormat
in interfaceSerializer
- Overrides:
setOutputFormat
in classBaseMarkupSerializer
- Parameters:
format
- The output format to use
-
setNamespaces
public void setNamespaces(boolean namespaces)
Deprecated.This methods turns on namespace fixup algorithm during DOM serialization.- Parameters:
namespaces
-
-
startElement
public void startElement(String namespaceURI, String localName, String rawName, Attributes attrs) throws SAXException
Deprecated.- Throws:
SAXException
-
endElement
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
Deprecated.- Throws:
SAXException
-
endElementIO
public void endElementIO(String namespaceURI, String localName, String rawName) throws IOException
Deprecated.- Throws:
IOException
-
startElement
public void startElement(String tagName, AttributeList attrs) throws SAXException
Deprecated.- Throws:
SAXException
-
endElement
public void endElement(String tagName) throws SAXException
Deprecated.- Throws:
SAXException
-
reset
public boolean reset()
Deprecated.- Overrides:
reset
in classBaseMarkupSerializer
-
-