Instead of doing
$path_out = 'output.xml';
$xw = new XMLWriter();
$xw->openURI($path_out);
Is it possible, using another method or any other way, to do something like:
$path_out = 'output.xml';
$fp = open($path_out, 'w');
$xw = new XMLWriter();
$xw->openURI($fp);
No and this does indeed really suck. The XMLWriter/XMLReader combo are supposed to operate 'streaming' which is awesome but then they can't work with already open streams. This seems like a major oversight.
A bit late but this should be possible because the the provided uri has supports for an custom protocol. So if you create an custom wrapper that wraps around an resource you should be able to write directly to wrapped resource.
I have created an small library because i had the same problem and you could find that here.
So for your example you could do:
$fd = fopen('output.xml', 'w');
StreamWrapper::register($fd, 'output.xml');
$writer = new \XMLWriter();
$writer->openUri('wrapper://output.xml');