Re: Using XMLNAMESPACES with XMLEMENT - Mailing list pgsql-general

From Rob Sargent
Subject Re: Using XMLNAMESPACES with XMLEMENT
Date
Msg-id 15F25C40-2929-442D-92D3-4812DDFCEBE1@gmail.com
Whole thread Raw
In response to Using XMLNAMESPACES with XMLEMENT  (Garfield Lewis <garfield.lewis@lzlabs.com>)
Responses Re: Using XMLNAMESPACES with XMLEMENT  (Garfield Lewis <garfield.lewis@lzlabs.com>)
List pgsql-general


On Sep 24, 2021, at 3:44 PM, Garfield Lewis <garfield.lewis@lzlabs.com> wrote:



Hi All,

 

I am attempting to port the following statement from DB2z to Postgres:

 

SELECT e.empno, e.firstnme, e.lastname,

          XMLELEMENT ( NAME "foo:Emp",

            XMLNAMESPACES('http://www.foo.com' AS "foo"),

            XMLATTRIBUTES(e.empno as "serial"),

                          e.firstnme,

                          e.lastname ) AS "Result"

       FROM EMP e

       WHERE e.edlevel = 12;

 

The NAMESPACES function is not supported by Postgres in the XMLELEMENT function. Is there any way to get this to work? I’ve looked at the WITH syntax but it doesn’t look like that will be helpful here.

 


Which Postgres version?  Have you tried path function?

Regards,

Garfield

pgsql-general by date:

Previous
From: Garfield Lewis
Date:
Subject: Using XMLNAMESPACES with XMLEMENT
Next
From: Garfield Lewis
Date:
Subject: Re: Using XMLNAMESPACES with XMLEMENT