21 May
2015
21 May
'15
11:18 a.m.
Thomas Schraitle schrieb am 21.05.2015 um 11:13:
For example, I need to remove the whole prolog (XML declaration, DOCTYPE, and optional comments) of an XML file. I know, this sounds strange, but for the time being let's assume I have a valid reason. ;)
To remove the prolog, my idea was to get the line number of the root's start-tag. With that information, I can strip the complete prolog. Unfortunately, it gives me the line number where it _ends_ which makes the start-tag syntactically incorrect. So my idea doesn't work.
Maybe there is a better method to remove the prolog of an XML file, but I only found this one.
Any idea?
Why not serialise only the root element? Stefan