WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
21306
XMLSerializer problem
https://bugs.webkit.org/show_bug.cgi?id=21306
Summary
XMLSerializer problem
Martin Marko
Reported
2008-10-02 06:17:28 PDT
Having the following code: var dom=new DOMParser().parseFromString("<root/>","text/xml"); var n=dom.documentElement; var str="/>"; n.textContent=str; this.assertEquals(n.textContent,str); var strSer=new XMLSerializer().serializeToString(dom); I would expect to receive the following: <root>/<</root> But XMLSerializer produce <root>/></root> I there any explanation ? Is there any workaround to get string representing "Well Formed XML" ? I have not found any explanation for this yet BTW: Firefox/2.0.0.14 produces correct (expected) result thanx
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2008-10-02 06:52:39 PDT
This is fixed in nightly builds, you can download one from <
http://nightly.webkit.org
> to verify that.
> Is there any workaround to get string representing "Well Formed XML" ?
I believe that "<root>/></root> " is well-formed XML - the only characters that need escaping are '&' and '<'. We had to add escaping for several other characters to be match other browsers, and not because any spec required that.
Martin Marko
Comment 2
2008-10-02 07:02:37 PDT
You have forced me to go back to specs, YOU ARE RIGHT,IT MAY be escaped ...however this causes interoperability problems...
http://www.w3.org/TR/REC-xml/#sec-well-formed
The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings "&" and "<" respectively. The right angle bracket (>) may be represented using the string ">", and MUST, for compatibility, be escaped using either ">" or a character reference when it appears in the string "]]>" in content, when that string is not marking the end of a CDATA section. Thanx....
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug