9 Replies Latest reply on Nov 27, 2008 2:17 PM by nbelaevski

    tree xml parse error id contains ampersand

    mail.micke

      Hi

      The nodes in my tree may contain ampersand and other crazy German characters.

      Currently I'm getting an XML parse error pointing to the ampersand.

      Had a look at the generated source and discovered that the node content is used as part of the element id. For the most cases the ampersand is escaped properly but in at least one place it isn't.


      xhtml code:

      <rich:tree style='width:120px;max-width:120px;width:expression(100 +"px");'
       switchType="client"
       value="#{sdb2.filterTree}"
       var="item"
       nodeFace="#{item.type}">
       <rich:treeNode type="cpty">
       <h:outputText value="#{item.cpty}"/>
       </rich:treeNode>
       <rich:treeNode id="branch" type="branch">
       <h:outputText value="#{item.branch}"/>
       </rich:treeNode>
       <rich:treeNode id="db_entity" type="db_entity">
       #{item.dbEntity}
       </rich:treeNode>
       <rich:treeNode type="product">
       <a4j:commandLink value="#{item.productType}"
       action="#{sdb2.filter(item)}"
       reRender="posListingTable"/>
       </rich:treeNode>
      </rich:tree>
      


      a4jLog (full here http://pastebin.com/f54dcd58e ):
      error[10:16:52,577]: Error parsing XML
      error[10:16:52,577]: Parse Error: XML Parsing Error: Whitespace is not allowed at this location.
      Location: Line Number 1, Column 3162:
      Richfaces_Tree_j_id10_j_id24.getNodeElements(['j_id10:j_id24:DEU:LDN:Reuschel & Co. Kommanditgesellschaft, München:FXFORWARD::j_id32'] );</script>
      --------------------------------------------------------------------------------^
      


      Would be very happy for comments.

      With some effort I could solve this in the model object by replacing all & with "and", but I'd rather not since I use the date in the tree for comparisons with data from a database and then I need to process that data in the same way ;(


      Regards,
      Micke

        • 1. Re: tree xml parse error id contains ampersand
          nbelaevski

          Hello,

          What are your parser settings (parser is configured in web.xml)?

          • 2. Re: tree xml parse error id contains ampersand
            mail.micke

            Hi

            Like this:

             <context-param>
             <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
             <param-value>NEKO</param-value>
             </context-param>
            


            (I played around with the parser settings to speed up rendering of pages with large datatables.)

            Thanks,
            micke

            • 3. Re: tree xml parse error id contains ampersand
              mail.micke

              Hi

              Have you had any time to look at this yet?

              Curious if it is something which I can fix (without using TIDY filter, if that fixes it I don't know) or if I should file a JIRA.

              Currently this is a show stopper for me and I'll have to manually convert the troublesome & to "and" or something if it can't be fixed by other means.

              Cheers,
              Micke

              • 4. Re: tree xml parse error id contains ampersand
                nbelaevski

                Micke,

                I cannot reproduce the issue with NEKO, it is working ok for me. Please file the issue to JIRA.

                P.S. What is your Richfaces version?

                • 5. Re: tree xml parse error id contains ampersand
                  mail.micke

                  Hi,
                  thanks for looking at this.

                  I'm using version 3.2.1.GA.

                  The problem doesn't manifest itself when first rendering the page, it happens when I click the a4j:commandLink for the product type node. Did you try that?

                  Which version did you use?

                  Many thanks,
                  micke

                  • 6. Re: tree xml parse error id contains ampersand
                    mail.micke
                    • 7. Re: tree xml parse error id contains ampersand
                      ronanker

                      I've just corrected in my app a bug that nearly sounds like yours or others like yours...
                      about "Error parsing responseXML Parsing Error" error :

                      actually i have a a4j:commandLink that have an action that sometimes do ajax navigation and sometimes server navigation. returning 'null' or returning 'go_page' where 'go_page' is defined in faces-config.xml

                      <navigation-case>
                       <from-outcome>go_page</from-outcome>
                       <to-view-id>/page.jsp</to-view-id>
                       </navigation-case>
                      

                      in this case, some IE will issue "Error parsing responseXML Parsing Error" when trying to put the destination page content into the curent window.
                      this is not the version of IE that makes the difference we have 7.0.5730.11 and 7.0.5730.13 and 7.0.6001.18000... for each one some computer will have the bug and some other won't have...

                      this bug drove me crazy for about 1 day and half, and finally, i found a workaround :
                      <navigation-case>
                       <from-outcome>go_page</from-outcome>
                       <to-view-id>/page.jsp</to-view-id>
                       <redirect/>
                       </navigation-case>
                      

                      in this case, we no longer have any problem...

                      I let you the pleasure of searching why the following bug happen on some IE :
                      debug[12:03:40,138]: Header Ajax-Response not found, search in <meta>
                      debug[12:03:40,139]: Header Ajax-Expired not found, search in <meta>
                      warn[12:03:40,139]: No ajax response header
                      debug[12:03:40,140]: Header Location not found, search in <meta>
                      debug[12:03:40,147]: replace all page content with response
                      debug[12:03:40,148]: setup custom document.open method
                      debug[12:03:40,183]: exception during write page content undefined
                      error[12:03:40,231]: Error parsing responseXML Parsing Error: [...(any fool error... too strict validation ?)...]
                      debug[12:03:40,232]: page content has been replaced


                      note on firefox we have :
                      debug[12:12:10,192]: Header Ajax-Expired not found, search in <meta>
                      warn[12:12:10,192]: No ajax response header
                      debug[12:12:10,192]: Header Location not found, search in <meta>
                      debug[12:12:10,194]: replace all page content with response
                      debug[12:12:10,340]: window.document has opened for writing
                      debug[12:12:10,350]: window.document has been writed
                      debug[12:12:10,352]: window.document has been closed for writing
                      debug[12:12:10,352]: page content has been replaced
                      


                      using the workaround :
                      debug[14:55:11,793]: Response with content-type: text/xml;charset=UTF-8
                      debug[14:55:11,793]: Full response content: <?xml version="1.0" encoding="UTF-8"?>
                       <html xmlns="http://www.w3.org/1999/xhtml"><head>
                       <meta name="Ajax-Response" content="redirect" />
                       <meta name="Location" content="/page.jsf" /></head></html>
                      debug[14:55:11,793]: Header Ajax-Expired not found, search in <meta>
                      debug[14:55:11,794]: search for elements by name 'meta' in element #document
                      debug[14:55:11,802]: Find <meta name='Ajax-Response' content='redirect'>
                      debug[14:55:11,802]: Find <meta name='Location' content='/page.jsf'>
                      warn[14:55:11,803]: No ajax response header



                      • 8. Re: tree xml parse error id contains ampersand
                        ronanker

                        note : i can't show you the debug trace for IE when it works as a4j:log doesn't work in popup on IE and when i don't use popup the page refresh (it work) so i don't have time to copy the trace...

                        • 9. Re: tree xml parse error id contains ampersand
                          nbelaevski

                          Hi,

                          That seems to be the same as https://jira.jboss.org/jira/browse/RF-3745