W3C home > Mailing lists > Public > www-tag@w3.org > January 2013

Re: Highlighting issue of XML support in DOM 4

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 23 Jan 2013 02:26:47 +0100
To: Anne van Kesteren <annevk@annevk.nl>
Cc: www-tag@w3.org
Message-ID: <qdduf8554im9id9nfpqhe2r7amfklc7i9v@hive.bjoern.hoehrmann.de>
* Anne van Kesteren wrote:
>On Tue, Jan 22, 2013 at 4:32 PM, Norman Walsh <ndw@nwalsh.com> wrote:
>> As Henri observes in another message, the version is moot, the code
>> performing serialization can decide if it's generating a standalone
>> document or not, and the encoding will be UTF-8 if the serializer
>> has any sense.
>
>Note that there is an XML serialization API:
>http://domparsing.spec.whatwg.org/#the-xmlserializer-interface

It http://shadowregistry.org/js/misc/#t8f43b148e7ac0d83ae2407516933c0e5
seems to behave as one would expect: the following code returns false,

  var doc1 = new DOMParser().parseFromString("<?xml version='1.0' "
    + "standalone='no'?><y/>", "text/xml");
  var doc2 = new DOMParser().parseFromString("<?xml version='1.0' "
    + "standalone='yes'?><y/>", "text/xml");
  var str1 = new XMLSerializer().serializeToString(doc1);
  var str2 = new XMLSerializer().serializeToString(doc2);
  return str1 == str2;

in Opera, Firefox, and Webkit as they retain the standalone declaration.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Wednesday, 23 January 2013 01:27:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 23 January 2013 01:27:16 GMT