Package mondrian.xmla.impl
Class DefaultSaxWriter
java.lang.Object
mondrian.xmla.impl.DefaultSaxWriter
- All Implemented Interfaces:
SaxWriter
Default implementation of
SaxWriter
.- Since:
- 27 April, 2003
- Author:
- jhyde, Gang Chen
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
List of SAX attributes based upon a string array. -
Constructor Summary
ConstructorDescriptionDefaultSaxWriter
(OutputStream stream) Creates a DefaultSaxWriter writing to anOutputStream
.DefaultSaxWriter
(OutputStream stream, String xmlEncoding) DefaultSaxWriter
(PrintWriter writer, int initialIndent) Creates a DefaultSaxWriter writing to aPrintWriter
.DefaultSaxWriter
(Writer writer) Creates aSAXWriter
writing to aWriter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(String s) void
completeBeforeElement
(String tagName) void
void
void
void
Informs the writer that a sequence of elements of the same name has ended.void
flush()
Flushes any unwritten output.void
void
startElement
(String tagName) void
startElement
(String tagName, Object... attributes) void
startSequence
(String name, String subName) Informs the writer that a sequence of elements of the same name is starting.final void
textElement
(String name, Object data) Generates a text-only element,<name>data</name>
.void
Sends a piece of text verbatim through the writer.
-
Constructor Details
-
DefaultSaxWriter
Creates a DefaultSaxWriter writing to anOutputStream
. -
DefaultSaxWriter
public DefaultSaxWriter(OutputStream stream, String xmlEncoding) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
DefaultSaxWriter
Creates aSAXWriter
writing to aWriter
.If
writer
is aPrintWriter
,DefaultSaxWriter(java.io.OutputStream)
is preferred. -
DefaultSaxWriter
Creates a DefaultSaxWriter writing to aPrintWriter
.- Parameters:
writer
- WriterinitialIndent
- Initial indent
-
-
Method Details
-
characters
- Specified by:
characters
in interfaceSaxWriter
-
startSequence
Description copied from interface:SaxWriter
Informs the writer that a sequence of elements of the same name is starting.For XML, is equivalent to
startElement(name)
.For JSON, initiates the array construct:
"name" : [
{ ... },
{ ... }
]- Specified by:
startSequence
in interfaceSaxWriter
- Parameters:
name
- Element namesubName
- Child element name
-
endSequence
public void endSequence()Description copied from interface:SaxWriter
Informs the writer that a sequence of elements of the same name has ended.- Specified by:
endSequence
in interfaceSaxWriter
-
textElement
Description copied from interface:SaxWriter
Generates a text-only element,<name>data</name>
.For XML, this is equivalent to
but for JSON, generatesstartElement(name);
characters(data);
endElement();"name": "data"
.- Specified by:
textElement
in interfaceSaxWriter
- Parameters:
name
- Name of elementdata
- Text content of element
-
element
-
startElement
- Specified by:
startElement
in interfaceSaxWriter
-
startElement
- Specified by:
startElement
in interfaceSaxWriter
-
endElement
public void endElement()- Specified by:
endElement
in interfaceSaxWriter
-
startDocument
public void startDocument()- Specified by:
startDocument
in interfaceSaxWriter
-
endDocument
public void endDocument()- Specified by:
endDocument
in interfaceSaxWriter
-
completeBeforeElement
- Specified by:
completeBeforeElement
in interfaceSaxWriter
-
verbatim
Description copied from interface:SaxWriter
Sends a piece of text verbatim through the writer. It must be a piece of well-formed XML. -
flush
public void flush()Description copied from interface:SaxWriter
Flushes any unwritten output.
-