http://bugs.winehq.org/show_bug.cgi?id=16453
--- Comment #17 from Nikolay Sivov bunglehead@gmail.com 2010-02-16 17:07:14 --- It seems I found a clean enough workaround for that - we could reliably know that declaration was present in original document checking 'doc->standalone' or similar field for input parser context. If it is -1 then no declaration was present in xml stream. So if it's not -1 we could construct additional PI node with data already present in xmlDoc structure.