3 Replies Latest reply on Mar 9, 2009 9:22 AM by Michael Decker

    Sporadic failure:

    Michael Decker Newbie

      I am getting a sporadic xml parsing error:

      XML Parsing Error: mismatched tag. Expected: </head>.
      Location: http://myserver:1234/myapp/my.jsf
      Line Number 4, Column 3:</head>
      --^
      


      It seams, that I'm not the only one: http://www.seamframework.org/Community/XMLParsingError

      There could be a workaround: http://www.seamframework.org/Community/XMLParsingError#comment59059

      try using a
      <f:view contentType="text/html"/>



      Some news? Is this a bug?

        • 1. Re: Sporadic failure:
          Nick Belaevski Master

          Hello,

          Not necessarily. Please provide full page code and web.xml contents.

          • 2. Re: Sporadic failure:
            Stuart Douglas Master

            This is to do with the way firefox handles xhtml files. All you need is a single unescaped special character and firefox refuses to parse the page. Consider:

            <html>
            <head>
            </head>
            <body>
            hello & world
            </body>
            </html>
            


            If you save this a a.html and open it in firefox it works fine. If you save it as a.xhtml you get the same error you are getting. Changing the content type back to html via content type headers is the easiest way to get rid of this.

            The harder way is to figure out what elements on your page are doing this, however it is possible that a taglib that you are using does not generate well formed xhtml, in which case you do not have any choice but use html.

            If you view source in firefox next time you get this error anyone that is proficient in xml should be able to point out what is causing the error.

            • 3. Re: Sporadic failure:
              Michael Decker Newbie

              A very small example (reduced version of a generated page):

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
              <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Test</title><link class="component" href="/myApp/faces/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" />
              </head><body>
              </body></html>


              That causes this this FireFox error:
              XML-Verarbeitungsfehler:
              Adresse: file:///C:/temp/XHTML/search.jsf.xhtml
              Zeile Nr. 2, Spalte 137:<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Test</title><link class="component" href="/" rel="stylesheet" type="text/css" />
              ----------------------------------------------------------------------------------------------------------------------------------------^


              The problem seams to be the starting slash in href, because without a slash on the beginning, I 've not problem... A firefox bug?
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
              <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Test</title><link class="component" href="myApp/faces/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" />
              </head><body>
              </body></html>


              Opera and IE 7 has no problems... So it's a bug or a feature of firefox ;-/