Re: xml to string, ascii x utf8 conversion

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Radek Novotný <radek(dot)novotny(at)mediawork(dot)cz>
Subject: Re: xml to string, ascii x utf8 conversion
Date: 2009-07-21 09:27:56
Message-ID: 200907211227.56775.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 20 July 2009 19:46:01 Radek Novotný wrote:
> query_to_xml('select Nazev as "TITLE", Datum as "DATE", Autor_Akce as "meta
> rel=''action_author''", ....
>
> gave me
>
> <table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <row>
> <TITLE>Test</TITLE>
> <DATE>2009-07-20</DATE>
> <meta_x0020_rel_x003D__x0027_action_author_x0027_>test
> </meta_x0020_rel_x003D__x0027_action_author_x0027_>
>
> How can i transcode this well generated xml(ascii) to string(UTF8) without
> the escape characters?

This has nothing to do with ASCII vs. UTF-8. The problem is that "meta
rel='action_author'" is not a valid XML *element* name, so it needs to be
escaped. What you are trying to achieve is presumably to get a meta element
with a rel attribute. To get that, you will have to run the result of
query_to_xml through some postprocessing (with XSLT, for example).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Murat Kabilov 2009-07-21 10:08:51 element from an array by its index
Previous Message Bjørn T Johansen 2009-07-21 08:27:16 ERROR: could not access status of transaction 2495690984