Package org.basex.io.serial
Class XMLSerializer
java.lang.Object
org.basex.io.serial.Serializer
org.basex.io.serial.OutputSerializer
org.basex.io.serial.StandardSerializer
org.basex.io.serial.XMLSerializer
- All Implemented Interfaces:
Closeable,AutoCloseable
This class serializes items as XML.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.io.serial.StandardSerializer
atomic, form, sepFields inherited from class org.basex.io.serial.OutputSerializer
encoding, itemsep, out, sopts -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSerializes an atomic value.protected voidattribute(byte[] name, byte[] value, boolean standalone) Serializes an attribute.protected voidcomment(byte[] value) Serializes a comment.protected voiddoctype(byte[] type) Prints the document type declaration.protected voidCloses an element.protected voidCloses an empty element.protected voidFinishes an opening element node.protected voidindent()Prints indentation whitespaces.protected voidnamespace(byte[] prefix, byte[] uri, boolean standalone) Serializes a namespace.protected voidopenDoc(byte[] name) Opens a document.protected voidpi(byte[] name, byte[] value) Serializes a processing instruction.protected voidprint(int cp) Prints a single character.protected final booleanprintCT(boolean empty, boolean html) Prints the content type declaration.protected final voidprintDoctype(byte[] type, String pub, String sys) Prints the document type declaration.protected booleanskipElement(ANode node) Checks if an element should be skipped.protected voidStarts an element.protected voidSerializes a text.Methods inherited from class org.basex.io.serial.StandardSerializer
characterMap, function, node, norm, printChar, reset, serializeMethods inherited from class org.basex.io.serial.OutputSerializer
close, finished, printChars, printHex, separateMethods inherited from class org.basex.io.serial.Serializer
closeDoc, closeElement, get, get, nsUri, openElement, sc, value
-
Method Details
-
doctype
Prints the document type declaration.- Parameters:
type- document type- Throws:
IOException- I/O exception
-
namespace
Description copied from class:SerializerSerializes a namespace.- Overrides:
namespacein classSerializer- Parameters:
prefix- prefixuri- namespace URIstandalone- standalone flag- Throws:
IOException- I/O exception
-
attribute
Description copied from class:SerializerSerializes an attribute.- Overrides:
attributein classSerializer- Parameters:
name- namevalue- valuestandalone- standalone flag- Throws:
IOException- I/O exception
-
text
Description copied from class:SerializerSerializes a text.- Overrides:
textin classSerializer- Parameters:
value- valueftp- full-text positions, used for visualization highlighting- Throws:
IOException- I/O exception
-
comment
Description copied from class:SerializerSerializes a comment.- Overrides:
commentin classSerializer- Parameters:
value- value- Throws:
IOException- I/O exception
-
pi
Description copied from class:SerializerSerializes a processing instruction.- Overrides:
piin classSerializer- Parameters:
name- namevalue- value- Throws:
IOException- I/O exception
-
openDoc
protected void openDoc(byte[] name) Description copied from class:SerializerOpens a document.- Overrides:
openDocin classSerializer- Parameters:
name- name
-
startOpen
Description copied from class:SerializerStarts an element.- Overrides:
startOpenin classSerializer- Parameters:
name- element name- Throws:
IOException- I/O exception
-
finishOpen
Description copied from class:SerializerFinishes an opening element node.- Overrides:
finishOpenin classSerializer- Throws:
IOException- I/O exception
-
finishEmpty
Description copied from class:SerializerCloses an empty element.- Overrides:
finishEmptyin classSerializer- Throws:
IOException- I/O exception
-
finishClose
Description copied from class:SerializerCloses an element.- Overrides:
finishClosein classSerializer- Throws:
IOException- I/O exception
-
atomic
Description copied from class:SerializerSerializes an atomic value.- Overrides:
atomicin classStandardSerializer- Parameters:
item- item- Throws:
IOException- I/O exception
-
print
Description copied from class:StandardSerializerPrints a single character.- Overrides:
printin classStandardSerializer- Parameters:
cp- codepoint- Throws:
IOException- I/O exception
-
skipElement
Description copied from class:SerializerChecks if an element should be skipped.- Overrides:
skipElementin classSerializer- Parameters:
node- node to be serialized- Returns:
- result of check
-
printDoctype
Prints the document type declaration.- Parameters:
type- document typepub- doctype-public parametersys- doctype-system parameter- Throws:
IOException- I/O exception
-
indent
Description copied from class:OutputSerializerPrints indentation whitespaces.- Overrides:
indentin classOutputSerializer- Throws:
IOException- I/O exception
-
printCT
Prints the content type declaration.- Parameters:
empty- empty flaghtml- method- Returns:
trueif declaration was printed- Throws:
IOException- I/O exception
-