backuplib.php has functions full_tag, start_tag, end_tag, xml_safe_content or something.
these are not appropriate for use elsewhere but could be the basis for a simple class. Making a stream-based XML-writer is not exactly rocket science - a nice class for it (so that it can do pretty-print and stuff, and throw errors if you write the close tags in the wrong order) should probably be under 100 lines.
Also note in cases where a (php5) DOM representation already exists in memory then the DOMDocument::saveXML method should be used, regardless of any other stream-based writer implementation that might get done. however if you want to write in a stream way, it isn't efficient to construct an in-memory DOM first, so this may not be a good general approach.