Function newStreamWriter
This function is part of the StAX support.
Name
newStreamWriter creates a new StAX XMLStreamWriter ObjectSynopsis
newStreamWriter( [file] )Description
newStreamWritercreates an instance of a StAX XMLStreamWriter object initialized to write to the standard output port, or if supplied, a file.
The result object should be stored in a variable for use by other StAX Functions.
This object is actually a real instance of the XMLStreamWriter interface, and you can use the Java Objects method call syntax to access it,
it is easier and more efficient to use the functions in the StAX Functions which provide a higher level interface.
To use the StAX functions you need to import them into either the global namespace or a local namespace.
Its recommended that you use a local namespace so that there is less chance of name collisions.
Example
import commands stax=stax w=stax:newStreamWriter() stax:writeStartDocument $w stax:writeStartElement $w QName( xmlsh http://www.xmlsh.org/test1 test ) stax:writeNamespace $w xmlsh2 http://www.xmlsh.org/test2 stax:writeAttribute $w QName( xmlsh2 http://www.xmlsh.org/test2 a1) value1 stax:writeCharacters $w "Some Characters" stax:writeComment $w "This is a comment" stax:writeStartElement $w inner stax:writeCData $w "This is CData" stax:writeEndElement $w stax:writeEndElement $w stax:writeEndDocument $w stax:closeWriter $w
Commands
StAX Functions
Java Objects