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
tutu10
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:
<entry>
<g:id>114778689</g:id>
<g:title>My PRODUCT</g:title>
</entry>

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
_jum
Messages: 577
Registered: February 2008
Senior Member
You could use namespace notation:

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

XD
----------------------------------------------------------------------
<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

Previous Topic: RETURNING BULK COLLECT INTO COLLECTION
Next Topic: Identify data based on data in other tables
Goto Forum:
  


Current Time: Thu Mar 28 07:46:12 CDT 2024