Command write

This command is part of the StAX support.


write writes an XML node or characters to a StAX Writer created with newStreamWriter


write writer value [value ...]


write writes XML nodes or charactor dta to a writer created with newStreamWriter.

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

Typically the write command is used instead of the other StAX write commands when you want to write an XML node which was previously created instead of constructing the XML manually using individual StAX commands. This is particularly useful when you want to create large XML documents via streaming but want to create parts of the document using more convenient methods which are non-streaming (such as XQuery).

The writer paramter is an writer created with newStreamWriter.
The value parameters are one or more XML objects or character data.

import commands stax=stax

stax:writeStartDocument $w
stax:writeStartElement $w foo
stax:write $w <[ <bar>spam</bar> ]> "Text"
stax:writeEndElement $w
stax:writeEndDocument $w
stax:closeWriter $w


StAX Functions

Java Objects
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki