pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Schuhmacher, Bret <Bret.Schuhmacher@Aspect.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Ampersands in the output...
Date: Thu, 13 Jan 2005 12:54:08 +1300
Message-ID: <41E5B8A0.3030902@opencloud.com> (raw)
In-Reply-To: <98E4F4D46DACD0479C96D7356D5C37356B031C@sac1exch3.aspect.com>
References: <98E4F4D46DACD0479C96D7356D5C37356B031C@sac1exch3.aspect.com>

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



view thread (2+ messages)

Message-ID: <41E5B8A0.3030902@opencloud.com>
Permalink:  ../41E5B8A0.3030902@opencloud.com/
Also on:    postgresql.org/message-id/41E5B8A0.3030902@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, Bret.Schuhmacher@Aspect.com
  Subject: Re: Ampersands in the output...
  In-Reply-To: <41E5B8A0.3030902@opencloud.com>
  References: <98E4F4D46DACD0479C96D7356D5C37356B031C@sac1exch3.aspect.com> <41E5B8A0.3030902@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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