Re: Problems with Mixed Content and XMLOutputter

[email protected]
Newsgroups gmane.comp.java.jdom.general
Message-ID <OF98A61DC4.25178031-ONC1257324.006AAAF6-C1257324.006B53D7@fritid.as>

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                                                                                             
             <[email protected]>                                                                                      
             Sent by:                                                                                                To 
             [email protected]              "Grimm, Markus" <[email protected]>                               
                                                                                                                     cc 
                                                         [email protected]                                         
             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/[email protected]
(See attached file: smime.p7s)_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
smime.p7s (application/octet-stream, 2.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.