2 Replies Latest reply on Dec 8, 2011 2:45 AM by its_me

    How to Display a XML string in richfaces?

    its_me

      Hello All,

       

      We have an application which has a formatted XML string saved in the database. When we display it on screen, the spaces and the tabs are getting cut and we see the string as a continuous string. This problem occurs only while displaying on screen. The download works fine. The following is the command used for display:

       

      <h:outputText value="#{myBean.docContent}"

                                                        styleClass="c41f4" style="word-wrap: break-word;display: block;"  />

       

      We tried h:outputFormat too. It still doesnt help.

       

      Any help is appreciated.

       

      Thanks and Regards,

      Nid...................

        • 1. Re: How to Display a XML string in richfaces?
          healeyb

          Try style="white-space: pre" or style="white-space: pre-wrap" (possibly in conjunction with what

          you are already specifying), and use h:outputText escape="false":

           

          <h:panelGroup layout="block">

            <h:outputText escape="false" style="white-space: pre" value="..."/>

          </h:panelGroup>

           

          If this doesn't work try wrapping the outputText in <pre></pre> tags. Using escape="false" introduces

          the risk of cross site scripting attacks if the content being displayed is user entered, so be aware.

           

          Regards,

          Brendan.

          • 2. Re: How to Display a XML string in richfaces?
            its_me

            Hello Brendan,

             

            We tried your solution, but still the string gets displayed without any spaces/return/tabs. Thus it doesnt look like a XML still

             

            Regards,

            Nid..............