21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1380 Views |
-
self-closing tags error using xml template in IE

5 May 2009 at 8:50pm
could anyone confirm the following bug before i create a ticket for it:
self-closing tags in an xml template will seem to be rewritten to regular tags, ending up in invalid markup. strangely enough, only reproducable in internet explorer. example code:
Page_Controller
function xmlTeasers() {
return $this->renderWith('Hometeasers_xml');
}
Hometeasers_xml.ss<?xml version="1.0" encoding="UTF-8"?>
<home>
<teaser>
<image src="mysite/_content/thumb_motionmeta.jpg" posx="300" posy="10" />
</teaser>
</home>
when you render this in IE and view the source code, the slash of the self-closing tag 'image' is gone.
tried feeding the xml to flash and it threw an xml error ('image tag not closed')i also tried 'ContenNegotiator::disable()', but doesn't seem to have any effect (2.3.1).
-
Re: self-closing tags error using xml template in IE

16 September 2009 at 5:37pm
Did you find a solution to this, I have the same problem and its a massive pain in the backside!!!!!
-
Re: self-closing tags error using xml template in IE

17 September 2009 at 3:00am
Have you taken a look at the Convert::raw2xml() function? SS has a pretty robust XMLDataFormatter that will handle entire DataObjects, but I think you just need to pass your data through the Convert functions before doing ->customise($data)->renderWith(). If you are rendering in your template with the .XML call it will be properly escaped in my experience.
-
Re: self-closing tags error using xml template in IE

12 October 2009 at 9:25am Last edited: 20 October 2009 1:59pm
I'm in the middle of doing a Google Map populated with locations entered into DataObjectManager...
I had the same issue, it would strip the <?xml version="1.0" encoding="UTF-8"?> and reformat <marker ..... /> to <marker ....>.
I added $this (taken from one of the google map modules):
function GMapXml() {
return DataObject::get('StoreLocation');
return $this->customise('StoreLocation')->renderWith('GoogleMapXML');
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
}With the addHeader, everything worked. In my case I didn't need to do anything with ContentNegotiator. Google didn't care whether it was <marker .../> or <marker ...></marker>.
EDIT: Google didn't care, but IE sure did. It didn't recognize <marker ../> as an object. I changed to <marker ...></marker> and IE stopped whining.I think it would be more proper to use text/xml instead of application/xml, but I don't know that for sure. Also, I could never see the header change when viewing with FF plugin - Live HTTP Headers. It always said text/html.
EDIT: I read on another site that suggested that application/xml is preferred.
| 1380 Views | ||
|
Page:
1
|
Go to Top |




