Thread: xml to string, ascii x utf8 conversion

xml to string, ascii x utf8 conversion

From
Radek Novotný
Date:
Hello,
having problem with conversion while doing function query_to_xml.


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?


I found nothing on google...


Regards,
Radek Novotny



--

www.publicstream.cz - vytvořili jsme produkt pro živé přenosy (online streaming) a videoarchív ve formátu FLASH.


Bc. Radek Novotný
jednatel Mediawork group s.r.o.


tel.: +420 724 020 361
email: radek.novotny@mediawork.cz
http://www.mediawork.cz

Re: xml to string, ascii x utf8 conversion

From
Peter Eisentraut
Date:
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).