Subj : Re: XML declaration broken going from Mozilla 1.8a6 to 1.8b To : netscape.public.mozilla.jseng From : torntrousers Date : Sun Mar 13 2005 02:28 am Brendan Eich wrote in message news:<42332BBF.9050504@meer.net>... > Martin Honnen wrote: > > > Maybe Brendan and/or Igor know better whether new XML() in E4X should be > > able to consume the complete XML markup from a document including the > > XML declaration. > > > The specification's authors' intentions are not so clear, but as you > note, the spec is: what SpiderMonkey does here is correct per ECMA-357. > > Note that if you make an E4X wrapper around an XML DOM document via > > var x = new XML(document); > > (a feature not yet implemented in SpiderMonkey and Gecko -- soon!), you > shouldn't have any such problems. So it seems ECMA-357 wants you to be > able to parse XML into a DOM and then wrap that with E4X glue, which > allows the XML declaration pseudo-PI; or parse a JS string containing > XML, which does not. > > I'll raise this issue with ECMA TG1. > > /be Well this doesn't seem perfect, surely whatever the spec actually says the intention would have been for this to be possible? It sounds like I'll have to use a hack along the lines of: function getAsXML(s) { var sx = s; if (""); sx = s.substring(i+2,l); } var xml = new XML(sx); return xml; } Seeing as the spec is unclear and Rhino can deal with this fine couldn't Spidermonkey be fixed to do a fiddle like this for me? ...ant PS. Thanks for all the help. E4X rocks .