Home » SQL & PL/SQL » SQL & PL/SQL » DataMapper - JSON -> XML - Add a colon in XML tag
DataMapper - JSON -> XML - Add a colon in XML tag [message #674457] Mon, 28 January 2019 02:54 Go to next message
Messages: 2
Registered: January 2019
Junior Member
Hello everyone,
Today i want to generate an XML file from a JSON.
I already generate XML files but I here I want to generate a particular one, this is an XML in google format.
Like this:
<g:title>My PRODUCT</g:title>

My problem is the colon because on STUDIO it is prohibit to add a colon( : ) in an XML tag.
Has anyone had a solution to work this in mapping?
Actual, the only solution is to make a replacement after file generation (not good).

Thank's for your help !
Re: DataMapper - JSON -> XML - Add a colon in XML tag [message #674459 is a reply to message #674457] Mon, 28 January 2019 03:27 Go to previous message
Messages: 573
Registered: February 2008
Senior Member
You could use namespace notation:

WITH data ( id, title) AS 
 (SELECT 114778689, 'My PRODUCT' FROM dual)
SELECT xmlelement
         ,xmlelement("g:id", id)
         ,xmlelement("g:title", title)
       ) xd
  FROM data;          

<entry><g:id>114778689</g:id><g:title>My PRODUCT</g:title></entry>

[Updated on: Mon, 28 January 2019 03:28]

Report message to a moderator

Next Topic: Identify data based on data in other tables
Goto Forum:

Current Time: Fri May 14 05:41:05 CDT 2021