Re: EJB values into xml attributes (a little off topic, I know)

2001-03-02 Thread Falk Langhammer

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 &
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)

2001-03-01 Thread Randahl Fink Isaksen

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)

2001-03-01 Thread Falk Langhammer


]>

I do not think this is legal.
(1) Recursive entitity declaration
(2) & 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,

& should be & because doc: is a namespace prefix, not
a DOCTYPE prefix.
& should be & (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)

2001-03-01 Thread Randahl Fink Isaksen

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


]>

Then & will get transformed to &

But  will just get transformed into  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.

 


 


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><%= myPoem.getContents() %>
RFI> 

RFI> Because title is an XML attribute I think special characters like '&'
needs
RFI> to be escaped with & 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)

2001-02-28 Thread orionEJB

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.

 


 


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><%= myPoem.getContents() %>
RFI> 

RFI> Because title is an XML attribute I think special characters like '&' needs
RFI> to be escaped with & 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/





EJB values into xml attributes (a little off topic, I know)

2001-02-28 Thread Randahl Fink Isaksen

PROBLEM

I have a question regarding taking properties from an EJB and generating XML
output. To explain, here is an example of my problem:

   <%= myPoem.getContents() %>


Because title is an XML attribute I think special characters like '&' needs
to be escaped with & and the like. How does one handle this in a nice
way?





BACKGROUND

I can think of at least two solutions, but I was hoping someone could
suggest a better one:

1: One could make sure to always store all content in the database as
escaped content. This means that the title of myPoem could be stored as
"Strength & Honour" instead of "Strength & Honour".

2: One could require all get/set-methods to transform unescaped content to
escaped content and vise-versa.

3: One could use a utility class with a static method:
 .


I know all this could work, but still I think it involves a programming
overhead which I would like to avoid if possible. - Especially because I
have found out I do not need to do any conversion for content which is not
used in an attribute, e.g. myPoem.getContents() works fine no matter what it
contains.