Re: EJB values into xml attributes (a little off topic, I know)
Hi Randahl, - Original Message - From: "Randahl Fink Isaksen" [EMAIL PROTECTED] XMLEscaper.escape(Book.getPreface()) for all the output you take from your beans and use to generate XML really sounds like a mess to me. While we are at it: If you just *have* to do this conversion, why not do it when you put information into the beans rather than when you take it back Well, we do need unescaped string properties in the beans to do the business logic right. If a companies name is "Smith Wesson" it is not "Smith amp; Wesson". Think that somebody is searching for this company in an EJB-client. As a general note, the entire problem belongs to the topic of "Java object - XML mapping". This is much researched right now with no de-facto standard I know of yet. There is a SUN community process for this topic. Until then, I suggest at least JDOM should handle Java Strings internally. Bye, Falk
RE: EJB values into xml attributes (a little off topic, I know)
I will rephrase my question then (still, a little off topic): On Orion at least, it seems transformation only works for element values NOT for attribute values. If I have !DOCTYPE doc [ !ENTITY "amp;" ] Then doc:p/doc:p will get transformed to pamp;/p But p x=""/ will just get transformed into p x = ""/ because the '' is inside an attribute. How can one accomplish transformation of such attributes? Yours Randahl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of orionEJB Sent: 28. februar 2001 15:37 To: Orion-Interest Subject: Re: EJB values into xml attributes (a little off topic, I know) You can use title as element not as attribut in your XML document. Then you can to use CDATA. Everything inside a CDATA section is ignored by the parser. poem title ![CDATA[ everything you want.. ]] /title /poem BaV RFI PROBLEM RFI I have a question regarding taking properties from an EJB and generating XML RFI output. To explain, here is an example of my problem: RFI poem title = "%= myPoem.getTitle()" %= myPoem.getContents() % RFI /poem RFI Because title is an XML attribute I think special characters like '' needs RFI to be escaped with amp; and the like. How does one handle this in a nice RFI way? ---R--E--K--L--A--M--A- Szukasz wiedzy? 85 tysiecy uaktualnianych ciagle hasel. Encyklopedia Internautica: http://encyklopedia.interia.pl/
Re: EJB values into xml attributes (a little off topic, I know)
!DOCTYPE doc [ !ENTITY "amp;" ] I do not think this is legal. (1) Recursive entitity declaration (2) amp; is predefined, is reserved as entity prefix. I do not think that You can redefine the XML grammar by defining "" or "" as entities. In summary, You do not need the DOCTYPE at all. (I haven't read the spec recently, I may be wrong). Then, to my understanding, doc:p/doc:p should be p/p because doc: is a namespace prefix, not a DOCTYPE prefix. p/p should be pamp;/p (cf. above) Therefore, You have the same problem for elements and attributes. We do have the same problem and solve it by transforming all strings by our class XMLEscaper or (where elements may use CDATA when it must preserve whitespace and linefeeds) before generating XML. I would be surprised if there existed some magic avoiding this step. [EMAIL PROTECTED] has proposed this magic to the JDOM list such that Java strings can be passed in and out of elements and attributes without worry. Dunno what happened to this proposition. JDOM *is* the place where this problem should be fixed. Bye, Falk
RE: EJB values into xml attributes (a little off topic, I know)
Falk wrote: (...) We do have the same problem and solve it by transforming all strings by our class XMLEscaper (...) I would be surprised if there existed some magic avoiding this step. (...) You are probably right. Still, I would very much like to hear from anybody who could prove you wrong. Having to use something like XMLEscaper.escape(Book.getPreface()) for all the output you take from your beans and use to generate XML really sounds like a mess to me. While we are at it: If you just *have* to do this conversion, why not do it when you put information into the beans rather than when you take it back out again... many systems on the web certainly have more content browsing than updates of content. Still, I sure hope this EJB/XML hindrance is just a rumour - somebody tell me there is a solution to this (!) Randahl
Re: EJB values into xml attributes (a little off topic, I know)
You can use title as element not as attribut in your XML document. Then you can to use CDATA. Everything inside a CDATA section is ignored by the parser. poem title ![CDATA[ everything you want.. ]] /title /poem BaV RFI PROBLEM RFI I have a question regarding taking properties from an EJB and generating XML RFI output. To explain, here is an example of my problem: RFI poem title = "%= myPoem.getTitle()" %= myPoem.getContents() % RFI /poem RFI Because title is an XML attribute I think special characters like '' needs RFI to be escaped with amp; and the like. How does one handle this in a nice RFI way? ---R--E--K--L--A--M--A- Szukasz wiedzy? 85 tysiecy uaktualnianych ciagle hasel. Encyklopedia Internautica: http://encyklopedia.interia.pl/