Magento Forum

   
Selfclosing <a> breaks XML parsing? 
 
kirederf
Jr. Member
 
Total Posts:  10
Joined:  2008-01-30
 

Hi there,

I have a very strange issue with the following syntax:

<class="last_item" />
<
br class="clearer" />

In Firefox on Mac this breaks my markup and is resulting in this:

<class="last_item">
    <
br class="clearer">
</
a>

From this point the <a> element shows up everywhere in my markup even though I defined it just once....

The error is ownly visible in generated source code via Firebug not in “normal” source-code view of the page. Is this caused by the XML-parsing of magento or do I miss something else?

Regards

Frederik

Edit: I use the code in one of my phtml files. In templates/page/html/header.phtml

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

what the heck is “<a class="last_item" />” ???

 
Magento Community Magento Community
Magento Community
Magento Community
 
kirederf
Jr. Member
 
Total Posts:  10
Joined:  2008-01-30
 

<div id="main-nav">
        <
class="bc_blue" href="<?=$this->getBaseUrl()."something1";?>">Something1</a>
        <
class="bc_blue" href="<?=$this->getBaseUrl()."something2";?>">Something2</a>
        <
class="bc_blue" href="<?=$this->getBaseUrl()."something3";?>">Something3</a>
        <
class="last_item" />
        <
br class="clearer" />
</
div>

It’s the end of a link list used to attach a different background image.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

Self closing anchor tags are not legal in HTML, only in XHTML.  But I can guarantee you that you are not using XHTML.  Just because you write your HTML as XHTML does not trigger any browser to render your work as XHTML.  I thought everybody knew this…

The only way to get firefox to turn on xhtml rendering is to send a “Content-Type xhtml+xml” header.  But, this doesn’t work in any other browser (konq, IE, safari, opera).  For those you need to send “Content-Type: application/xml”.  Plus, for IE you need to include an XSL sheet that converts your true XML (application/xml) into XHTML locally on the browser.  Another reason why I’m pretty sure you’re not using XHTML.  If ever there is any error anywhere in the entire document (like a bad product description, malicious, malformed user reviews) the entire page fails to render and you’re left with 1 giant error pointing you to the line and column that is incorrect.  You’d probably be locked out of the page that would even allow you to fix such “bad” input from the admin screen. 

XHTML is a joke and it doesn’t work.  I seriously thought I was the last person to figure this out.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top