[Webkit-unassigned] [Bug 25206] New: XMLSerializer().serializeToString() doesn't generate the XML declaration markup like Opera and Firefox

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 15 02:05:27 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25206

           Summary: XMLSerializer().serializeToString() doesn't generate the
                    XML declaration markup like Opera and Firefox
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: XML
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: shadow2531 at gmail.com
                CC: ap at webkit.org


WebKit r42344

When you use serializeToString() on an xml document that was generated by
parsing xml markup that contained an xml declaration, the xml declaration
markup is missing from the returned string.

For example:

var xmlpi = '<?xml version="1.0" encoding="UTF-8"?>';
var markup = xmlpi + '<root><test/></root>';
var xmldoc = new DOMParser().parseFromString(markup, "text/xml");
var smarkup = new XMLSerializer().serializeToString(xmldoc);

In Opera and Firefox, smarkup will begin with '<?xml version="1.0"
encoding="UTF-8"?>'. In Safari, it's missing.

Difference between Opera and Firefox though:

1. If the @encoding value of the xml declaration in the parsed markup is
lowercase, Firefox will upppercase it for serializeToString(). For example,
encoding="utf-8" -> encoding="UTF-8". Opera does not do that and leaves it
as-is.

2. If the parsed markup doesn't contain an xml declaration, Firefox won't
generate xml declaration markup for serializeToString. Opera will generate
'<?xml version="1.0"?>' it seems.

It seems it would be good to at least follow FF here.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list