From: <dg...@su...> - 2009-01-22 15:22:33
|
Author: bellmich Date: Thu Jan 22 16:21:21 2009 New Revision: 177 URL: http://libwbxml.opensync.org/changeset/177 Log: - added XML default encoding UTF-8 - removed [<? ... ?>] which is really special and not covered by WBXML - replaced all kinds of [\s\r\n]* combinations at the end of a line by a single newline Modified: wbxmlTestSuite/trunk/normalize_xml.pl Modified: wbxmlTestSuite/trunk/normalize_xml.pl ============================================================================== --- wbxmlTestSuite/trunk/normalize_xml.pl Thu Jan 22 14:26:49 2009 (r176) +++ wbxmlTestSuite/trunk/normalize_xml.pl Thu Jan 22 16:21:21 2009 (r177) @@ -60,6 +60,10 @@ if ($state eq "IGNORE" and $line =~ q{^\s*<\?}) { $state = "ENC_OPEN"; } + if ($state eq "ENC_OPEN" and $line =~ q{^\s*<\?.*\?>\s*$} and $line !~ q{\sencoding="[^"]*"}) { + # add default encoding + $line =~ s{\s*\?>\s*$}{ encoding="UTF-8"?>\n}; + } if ($state eq "ENC_OPEN" and $line =~ q{\?>\s*$}) { $state = "WRITE"; } @@ -68,6 +72,10 @@ if ($state eq "IGNORE" and $line =~ q{^\s*<!DOCTYPE}) { $state = "DTD_OPEN"; } + if ($state eq "DTD_OPEN" and $line =~ q{\s\[<\?.*\?>\]}) { + ## such special XML stuff is lost in WBXML + $line =~ s{\s\[<\?.*\?>\]}{}; + } if ($state eq "DTD_OPEN" and $line =~ q{>\s*$}) { $state = "WRITE"; } @@ -85,6 +93,7 @@ $line = <$ORG_FD>; } if ($state eq "WRITE") { + $line =~ s{[\s\r\n]*$}{\n}s; print $NEW_FD $line; $line = <$ORG_FD>; $state = "IGNORE"; |