Wiki source for FunctionStAXcloseWriter


Show raw source

=====Command closeWriter=====

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

====Name====
**closeReader** Closes a ""StAX Writer"" created with [[FunctionStAXnewStreamWriter newStreamWriter]]


====Synopsis====
closeReader $reader


====Description====
closeWriter closes the writer created with [[FunctionStAXnewStreamWriter newStreamWriter]]. If you do not close the writer when you are through it may cause open file handles to stay open until the shell exits the current scope and garbage collection occurs.

Note that unlike many of the ""StAX"" functions this is a command not a function. You use the Command syntax to invoke it.


Example
%%
import commands stax=stax

w=stax:newStreamWriter()
stax:writeStartDocument $w
stax:writeStartElement $w foo
stax:writeAttribute $w a1 value1
stax:writeCharacters $w "Some Characters"
stax:writeEndElement $w
stax:writeEndDocument $w


stax:closeWriter $w


%%

Result
%%
<foo a1="value1">Some Characters</foo>
%%


----
[[Commands]]
[[FunctionsStAX StAX Functions]]
[[FunctionStAXnewStreamWriter newStreamWriter]]

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