4 Replies Latest reply on Mar 30, 2007 9:33 PM by lle

    ajax4jsf FastFilter issue

    lle

      Hi,
      I have to use FastFilter in order to overcome the performance issue with large documents. However, when my document has an empty div:

      <div class="heading"></div>

      the response of an Ajax call gave me this:
      <div class="heading"/>

      This has caused rendering issue on IE. Is there a way for me to tell the Ajax filter to parse empty elements with explicit close tag?

      Thanks
      ly

        • 1. Re: ajax4jsf FastFilter issue

          Are you speaking about Ajax response or pre-ajax behavior ?

          Why do you decide this is a parser convert

          <div></div>
          into
          <div/>


          • 2. Re: ajax4jsf FastFilter issue
            lle

            Hi,

            It is the Ajax response. I didn't say it's a parser convert. It might be an issue with FacesServlet. However, in my facelets xhtml document, i did explicitly put

            <div></div>


            But, after the ajax call, the ajax response contains
            <div/>


            I am still debugging to see where the conversion happens. However, if I used Filter instead of FastFilter, the TidyParser gave me the output
            <div></div>

            So I was wondering if there's somehow for me to set the NekoParser to expand empty elements.
            Thanks.

            • 3. Re: ajax4jsf FastFilter issue
              lle

              Hi there,

              I debugged and it is the NekkoParser that changed

              <div></div>
              to
              <div/>


              Can I somehow change this behavior?

              Thanks.

              • 4. Re: ajax4jsf FastFilter issue
                lle

                Deeper debugging into ajax4jsf code and I found the code where the short div was generated.
                It is the method endElement() of class org.ajax4jsf.xml.serializer.ToStream. Here is a code snippet of the method:

                public void endElement(String namespaceURI, String localName, String name)
                throws org.xml.sax.SAXException {
                 ...
                 if (m_elemContext.m_startTagOpen)
                 {
                 if (m_tracer != null)
                 super.fireStartElem(m_elemContext.m_elementName);
                 int nAttrs = m_attributes.getLength();
                 if (nAttrs > 0)
                 {
                 processAttributes(m_writer, nAttrs);
                 // clear attributes object for re-use with next element
                 m_attributes.clear();
                 }
                 if (m_spaceBeforeClose)
                 writer.write(" />");
                 else
                 writer.write("/>");
                 /* don't need to pop cdataSectionState because
                 * this element ended so quickly that we didn't get
                 * to push the state.
                 */
                
                 }
                 else
                 {
                 if (m_cdataTagOpen)
                 closeCDATA();
                
                 if (shouldIndent())
                 indent(m_elemContext.m_currentElemDepth - 1);
                 writer.write('<');
                 writer.write('/');
                 writer.write(name);
                 writer.write('>');
                 }
                 ...
                }

                As you see, when the element is empty, the element is written in the short form (e.g. ).

                Can ajax4jsf be enhanced to take in a property to tell the serializer to expand empty elements?

                This has caused serious layout issues with IE. Without a fix, I am forced to rerender the entire page instead of ajax when it comes to big response. It's a trade-off for using TidyParser instead of NekkoParser.

                Thank you very much.