Java Reference
In-Depth Information
class StAXDemo
{
public static void main(String[] args)
{
try
{
XMLOutputFactory
xmlof
=
XMLOutputFact-
ory.newFactory();
XMLEventWriter xmlew;
xmlew
=
xmlof.createXMLEventWriter(new
FileWriter("recipe.xml"));
final
XMLEventFactory
xmlef
=
XMLEventFact-
ory.newFactory();
XMLEvent event = xmlef.createStartDocument();
xmlew.add(event);
Iterator<Namespace> nsIter;
nsIter = new Iterator<Namespace>()
{
int index = 0;
Namespace[] ns;
{
ns = new Namespace[2];
ns[0] = xmlef.createNamespace("h",
"ht-
tp://www.w3.org/1999/xhtml");
ns[1] = xmlef.createNamespace("r",
"ht-
tp://www.tutortutor.ca/");
}
public boolean hasNext()
{
return index != 2;
}
public Namespace next()
{
Search WWH ::




Custom Search