Package mondrian.xmla.impl
Class DefaultSaxWriter
- java.lang.Object
-
- mondrian.xmla.impl.DefaultSaxWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultSaxWriter.StringAttributes
List of SAX attributes based upon a string array.
-
Constructor Summary
Constructors Constructor Description DefaultSaxWriter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(String s)
void
completeBeforeElement(String tagName)
void
element(String tagName, Object... attributes)
void
endDocument()
void
endElement()
void
endSequence()
Informs the writer that a sequence of elements of the same name has ended.void
flush()
Flushes any unwritten output.void
startDocument()
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.void
textElement(String name, Object data)
Generates a text-only element,<name>data</name>
.void
verbatim(String text)
Sends a piece of text verbatim through the writer.
-
-
-
Constructor Detail
-
DefaultSaxWriter
public DefaultSaxWriter(OutputStream stream)
Creates a DefaultSaxWriter writing to anOutputStream
.
-
DefaultSaxWriter
public DefaultSaxWriter(OutputStream stream, String xmlEncoding) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
DefaultSaxWriter
public DefaultSaxWriter(Writer writer)
Creates aSAXWriter
writing to aWriter
.If
writer
is aPrintWriter
,DefaultSaxWriter(java.io.OutputStream)
is preferred.
-
DefaultSaxWriter
public DefaultSaxWriter(PrintWriter writer, int initialIndent)
Creates a DefaultSaxWriter writing to aPrintWriter
.- Parameters:
writer
- WriterinitialIndent
- Initial indent
-
-
Method Detail
-
characters
public void characters(String s)
- Specified by:
characters
in interfaceSaxWriter
-
startSequence
public void startSequence(String name, String subName)
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
public final void textElement(String name, Object data)
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
-
startElement
public void startElement(String tagName)
- Specified by:
startElement
in interfaceSaxWriter
-
startElement
public void startElement(String tagName, Object... attributes)
- 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
public void completeBeforeElement(String tagName)
- Specified by:
completeBeforeElement
in interfaceSaxWriter
-
verbatim
public void verbatim(String text)
Description copied from interface:SaxWriter
Sends a piece of text verbatim through the writer. It must be a piece of well-formed XML.
-
-