Re: xml to string, ascii x utf8 conversion - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: xml to string, ascii x utf8 conversion
Date
Msg-id 200907211227.56775.peter_e@gmx.net
Whole thread Raw
In response to xml to string, ascii x utf8 conversion  (Radek Novotný <radek.novotny@mediawork.cz>)
List 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).

pgsql-general by date:

Previous
From: Bjørn T Johansen
Date:
Subject: ERROR: could not access status of transaction 2495690984
Next
From: Peter Eisentraut
Date:
Subject: Re: First query very slow. Solutions: memory, or settings, or SQL?