• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDOM and CDATA

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have an attribute in my XML, something like <field=abcdefghi/>
I need to insert a CRLF after abc and after def so that when output it's shown as
abc
def
ghi
so in my java I have something like
....."abc\r\ndef\r\nghi\r\n
I have found out that the parser will strip out the LF and leave the CR between each one, but I need to retain BOTH.
Am I right in thinking that CDATA will allow me to do this?
If so, how can I accomplish this using JDOM for my attribute? I can see how you do it as an element.
Thanks
Dave
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would it be ok to just go through the resulting string/file and add the missing '\r' where it's missing?
 
Dave Hewy
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I thought that might do it, so I tried it out, but it didn't seem to work.
Then I remembered that the receiver of the XML is using the MS XML parser, which is probably doing exactly the same thing! DOH!
This will have to be sorted out at their end !
Thanks anyway.
reply
    Bookmark Topic Watch Topic
  • New Topic