Revision [1730]

This is an old revision of FunctionStAXwriteAttribute made by DavidLee on 2011-05-31 13:18:11.

 

Command writeAttribute


This command is part of the StAX support.

Name

writeAttribute writes a single attribute to a StAX Writer created with newStreamWriter

Synopsis

writeAttribute writer qname value


Description

writeAttribute writes a single attribute to a writer created with newStreamWriter. It is only valid immedetely after a call to writeStartElement or writeAttribute

Note 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 FunctionQName 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
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki