Package mondrian.xmla.impl
Class DefaultSaxWriter
- java.lang.Object
-
- mondrian.xmla.impl.DefaultSaxWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultSaxWriter.StringAttributesList 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 aSAXWriterwriting to aWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(String s)voidcompleteBeforeElement(String tagName)voidelement(String tagName, Object... attributes)voidendDocument()voidendElement()voidendSequence()Informs the writer that a sequence of elements of the same name has ended.voidflush()Flushes any unwritten output.voidstartDocument()voidstartElement(String tagName)voidstartElement(String tagName, Object... attributes)voidstartSequence(String name, String subName)Informs the writer that a sequence of elements of the same name is starting.voidtextElement(String name, Object data)Generates a text-only element,<name>data</name>.voidverbatim(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 aSAXWriterwriting to aWriter.If
writeris 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:
charactersin interfaceSaxWriter
-
startSequence
public void startSequence(String name, String subName)
Description copied from interface:SaxWriterInforms 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:
startSequencein interfaceSaxWriter- Parameters:
name- Element namesubName- Child element name
-
endSequence
public void endSequence()
Description copied from interface:SaxWriterInforms the writer that a sequence of elements of the same name has ended.- Specified by:
endSequencein interfaceSaxWriter
-
textElement
public final void textElement(String name, Object data)
Description copied from interface:SaxWriterGenerates 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:
textElementin interfaceSaxWriter- Parameters:
name- Name of elementdata- Text content of element
-
startElement
public void startElement(String tagName)
- Specified by:
startElementin interfaceSaxWriter
-
startElement
public void startElement(String tagName, Object... attributes)
- Specified by:
startElementin interfaceSaxWriter
-
endElement
public void endElement()
- Specified by:
endElementin interfaceSaxWriter
-
startDocument
public void startDocument()
- Specified by:
startDocumentin interfaceSaxWriter
-
endDocument
public void endDocument()
- Specified by:
endDocumentin interfaceSaxWriter
-
completeBeforeElement
public void completeBeforeElement(String tagName)
- Specified by:
completeBeforeElementin interfaceSaxWriter
-
verbatim
public void verbatim(String text)
Description copied from interface:SaxWriterSends a piece of text verbatim through the writer. It must be a piece of well-formed XML.
-
-