[jdom-interest] Problems with Mixed Content and XMLOutputter

frode at fritid.as frode at fritid.as
Thu Jul 26 12:32:55 PDT 2007



Hi.

If the textual content of the tag 'Content' is to be treated as text, it should either be escaped, or inserted as CDATA.
Then all spaces/tags within is kept as is.

How can You otherwise extract this HTML-part from a DOM-tree, if not as the Elementtext of 'Content' ?

Frode







                                                                                                                        
             Paul Libbrecht                                                                                             
             <paul at activemath.org>                                                                                      
             Sent by:                                                                                                To 
             jdom-interest-bounces at jdom.org              "Grimm, Markus" <Grimm at juris.de>                               
                                                                                                                     cc 
                                                         jdom-interest at jdom.org                                         
             26.07.2007 14:57                                                                                   Subject 
                                                         Re: [jdom-interest] Problems with Mixed Content and            
                                                         XMLOutputter                                                   
                                                                                                                        
                                                                                                                        
                                                                                                                        
                                                                                                                        
                                                                                                                        
                                                                                                                        




Markus,

my solution was rely on the faithful formatting... does your solution avoid this ?
whitespaces in xml are tricky as hell!
You might want to post your patch or class... we would be interested to test this!

paul


Le 26 juil. 07 à 13:29, Grimm, Markus a écrit :



      Hi,





      We handle with XML-Documents including elements with mixed-content.





      an easy example:


      =============


      …


      <text>


                  <Content><P>Hello <B>World</B> how are you?</P></Content>


      </text>


      …





      I have to use Compact-Format to output the document as string. Later this output is used to create a html-view of
      the content.


      But the outputter-result looks like:  <Content><P>Hello<B>World</B>how are you?</P></Content>


      The space befor <B>World and after World</B> is deleted.


      The reason is simple, if you look in the XMLOutputter. But I think it’s a fault?!


      In Mixed-Content perhaps I need a single space at those positions. In such cases of mixed-content they should be
      handled as spaces in a string.


      They shouldn’t be trimed.





      So,  I had to pimp the XMLOutputter for my needs. Now he knows what kind of node a) follows to a text-node or b)
      follows to an Element.


      When it’s a) an Element, the text-node isn’t right-trimed and it’s b) a text-node so the same text-node isn’t
      left-trimmed. So far so good.





      What do the developers think about a own solution in the jdom-package for this problem?





      Bye,


      Markus









      _______________________________________________
      To control your jdom-interest membership:
      http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
(See attached file: smime.p7s)_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/octet-stream
Size: 2203 bytes
Desc: not available
Url : http://www.jdom.org/pipermail/jdom-interest/attachments/20070726/03d13cfe/smime.obj


More information about the jdom-interest mailing list