[jdom-interest] Keeping newlines in attribute values

Jason Hunter jhunter at servlets.com
Wed Oct 24 11:17:14 PDT 2001


Sorry, but XML doesn't let you do what you want to do:

http://www.w3.org/TR/REC-xml#AVNormalize

-jh-

Christian Hirsch wrote:
> 
> Hi.
> 
> I need to keep the plain test formatting in longer texts received in
> the value of an attribute, but can't figure out how to do so.
> 
> Example of an incoming document:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE tst_message SYSTEM "file:/tmp/tst_message.dtd">
> <tst_message>
> <tst_text
>         message="Here are some linesof text I need to know the plain
> text fomatting of, that is where the newlines originally
> were placed. Especially important in texts like:
> 
> 2001                   Quite Nice
> 2000                   Not so Nice
> 1999                   Ok"
> />
> </tst_message>
> 
> Where the DTD (file:/tmp/tst_message.dtd) looks like:
> 
> <!ELEMENT tst_message  (tst_text) >
> <!ELEMENT tst_text     EMPTY >
> <!ATTLIST tst_text  message CDATA  #REQUIRED >
> 
> So, how do I keep the newlines in the message attribute?
> 
> Anyone got any ideas?
> 
> Best Regards
> Christian Hirsch
> ------------------------------------------------------
> hp at netbook.se                   www.netbook.se
> hp at hirsch.pp.se                 www.hirsch.pp.se
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list