(in Saxon 9.3) which allows you to use, literally,

XMLStreamWriter sw = new XMLStreamWriterToReceiver(receiver);
sw.writeStartDocument();
sw.writeEmptyElement("doc");
sw.writeEndDocument();
That doesn't work btw. When writeEndDocument() in StreamWriterToReceiver
attempts to close the open tag (because depth > 1), it throws

Exception in thread "main" java.lang.IllegalStateException: Attempt to output end tag with no matching start tag
	at net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:208)
        ...

Now fixed. Thanks for reporting it. The failure only occurs when writeEmptyElement() is immediately followed by writeEndDocument(), so I don't feel too bad about failing to test this case.

Michael Kay
Saxonica

      
------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help