pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedAmpersands in the output...
2+ messages / 2 participants
[nested] [flat]
* Ampersands in the output...
@ 2005-01-12 23:20 Schuhmacher, Bret <Bret.Schuhmacher@Aspect.com>
0 siblings, 1 reply; 2+ messages in thread
From: Schuhmacher, Bret @ 2005-01-12 23:20 UTC (permalink / raw)
To: pgsql-jdbc
I'm using postgres to return business names via a function. In the
function I "xml-ify" the output by taking the name and wrap it with
start/end tags, as in "<name>name</name>" (there's a lot more to this
and I'm simplifying greatly). However, the problem is that some of the
names have "&" in them, like "Joes Bar & Grill", which really should be
escaped in XML.
Any ideas how to escape those things before they get to the recipient
(i.e. my application, IE, Mozilla, etc.)? Is there a built-in function
or something I could make use of? I suppose I could write a little more
code in my function to look in the field and try to do a string replace
or something, but is that the most efficient method?
Thanks in advance! :-)
Bret
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Ampersands in the output...
@ 2005-01-12 23:54 Oliver Jowett <oliver@opencloud.com>
parent: Schuhmacher, Bret <Bret.Schuhmacher@Aspect.com>
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Jowett @ 2005-01-12 23:54 UTC (permalink / raw)
To: Schuhmacher, Bret <Bret.Schuhmacher@Aspect.com>; +Cc: pgsql-jdbc
Schuhmacher, Bret wrote:
> I'm using postgres to return business names via a function. In the
> function I "xml-ify" the output by taking the name and wrap it with
> start/end tags, as in "<name>name</name>" (there's a lot more to this
> and I'm simplifying greatly). However, the problem is that some of the
> names have "&" in them, like "Joes Bar & Grill", which really should be
> escaped in XML.
>
> Any ideas how to escape those things before they get to the recipient
> (i.e. my application, IE, Mozilla, etc.)? Is there a built-in function
> or something I could make use of? I suppose I could write a little more
> code in my function to look in the field and try to do a string replace
> or something, but is that the most efficient method?
This is unrelated to the JDBC driver. Please use an appropriate list.
That said, it depends very much on how you are generating your XML.
Serializing a DOM tree should do the escaping for you. A reverse SAX
parser should also do it.
-O
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-01-12 23:54 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-12 23:20 Ampersands in the output... Schuhmacher, Bret <Bret.Schuhmacher@Aspect.com>
2005-01-12 23:54 ` Oliver Jowett <oliver@opencloud.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox