1 Reply Latest reply on Feb 17, 2011 10:11 AM by tomaszk

    Ajax call and XML Validation error with special chars like & (amp)

    tomaszk

      Hello,

       

      Our text data in database can contain special chars such as amp (&), which causes AJAX response crash, while the XML is invalid and could not be parsed (message visible in Firebug):

      XML Parsing Error: not well-formed

       

      For Ajax event we use :

       

      <a4j:support event="onchange" immediate="true">, which rerenders other rich:datatable

       

      Is there any configuration flag that enables us to escape such special characters in Ajax XML responses?

       

      In web.xml we have:

       

      <context-param>

              <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>

              <param-value>NONE</param-value>

          </context-param>

          <context-param>

              <param-name>org.ajax4jsf.xmlparser.NONE</param-name>

              <param-value>.*\..*</param-value>

      </context-param>

       

      But i suppose it's not the error connected with xmlparser of ajax4jsf, since NONE parser does not perform xml validation.

        • 1. Ajax call and XML Validation error with special chars like & (amp)
          tomaszk

          We have resolved the issue by switching to NEKO parser, instead of NONE

           

          <context-param>

                  <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>

                  <param-value>NEKO</param-value>

              </context-param>

              <context-param>

                  <param-name>org.ajax4jsf.xmlparser.NEKO</param-name>

                  <param-value>.*\..*</param-value>

          </context-param>

           

          As it turned out NEKO parser purifies HTML inputs and properly encodes invalid xml characters, while NONE parser does not.

           

          The hint came from Nick Belaevski from Richfaces team, after I put the bug on JIRA:

           

          https://issues.jboss.org/browse/RF-10554