Wiki source for FunctionStAXnewStreamWriter

Show raw source

=====Function newStreamWriter=====

This function is part of the [[FunctionsStAX StAX]] support.

**newStreamWriter** creates a new ""StAX"" [[ XMLStreamWriter]] Object

newStreamWriter( [file] )


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 [[FunctionsStAX StAX Functions]].
This object is actually a real instance of the ""XMLStreamWriter"" interface, and you can use the [[JavaObjects Java Objects]] method call syntax to access it,
it is easier and more efficient to use the functions in the [[FunctionsStAX StAX Functions]] which provide a higher level interface.

To use the ""StAX"" functions you need to [[CommandImport 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.

import commands stax=stax

stax:writeStartDocument $w
stax:writeStartElement $w QName( xmlsh test )
stax:writeNamespace $w xmlsh2
stax:writeAttribute $w QName( xmlsh2 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


[[FunctionsStAX StAX Functions]]
[[JavaObjects Java Objects]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki