Command writeAttribute
This command is part of the StAX support.
Name
writeAttribute writes a single attribute to a StAX Writer created with newStreamWriterSynopsis
writeAttribute writer qname valueDescription
writeAttribute writes a single attribute to a writer created with newStreamWriter. It is only valid immedetely after a call to writeStartElement or writeAttributeNote that unlike many of the StAX functions this is a command not a function. You use the Command syntax to invoke it.
The "qname" argument is the name of the attribute. This can be a simple name (becomes the localname), a QName in Clark notation or a QName object (created by the QName function)
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
StAX Functions
newStreamWriter
Java Objects