XML output change [message #242626] |
Mon, 04 June 2007 06:37 |
bhoite_amol83
Messages: 110 Registered: June 2005 Location: Pune
|
Senior Member |
|
|
Hi,
I generate one XML output. Everything is fine. But, i need to add one line of code into the XML output.
Please find the query for generation of XML.
Current XML, and expected XML
-- SQL query
SELECT REGION.region_seq,
XMLELEMENT("comtec", XMLATTRIBUTES ('2.7' AS "version"),
XMLELEMENT("area",XMLELEMENT("code",REGION.region_seq),
XMLELEMENT("name",REGION.region_name),
XMLELEMENT("area_kind_code",'default'),
(SELECT XMLELEMENT("area_parts",XMLAGG(XMLELEMENT("area_part",
XMLELEMENT("include", XMLELEMENT("country_code",REGION.calc_country_code),
XMLELEMENT("min_zipcode",REGION_ZIPCODE.from_zip_code),
XMLELEMENT("max_zipcode",REGION_ZIPCODE.to_zip_code)
)
)
)
)
FROM REGION_ZIPCODE
WHERE REGION_ZIPCODE.region_seq = REGION.region_seq
)
)
) result
FROM REGION
-- Current output
<?xml version="1.0" encoding="UTF-8"?>
<comtec version="2.7">
<area>
<code>592</code>
<name>ENTIRE GERMANY</name>
<area_kind_code>default</area_kind_code>
<area_parts>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>1</min_zipcode>
<max_zipcode>5</max_zipcode>
</include>
</area_part>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>58</min_zipcode>
<max_zipcode>79</max_zipcode>
</include>
</area_part>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>4545</min_zipcode>
<max_zipcode>454545</max_zipcode>
</include>
</area_part>
</area_parts>
</area>
</comtec>
--Expected output. Add one line of code
i.e. <!DOCTYPE comtec SYSTEM "comtec_cdms.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comtec SYSTEM "comtec_cdms.dtd">
<comtec version="2.7">
<area>
<code>592</code>
<name>ENTIRE GERMANY</name>
<area_kind_code>default</area_kind_code>
<area_parts>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>1</min_zipcode>
<max_zipcode>5</max_zipcode>
</include>
</area_part>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>58</min_zipcode>
<max_zipcode>79</max_zipcode>
</include>
</area_part>
<area_part>
<include>
<country_code>DE</country_code>
<min_zipcode>4545</min_zipcode>
<max_zipcode>454545</max_zipcode>
</include>
</area_part>
</area_parts>
</area>
</comtec>
How can i do it?
Please suggest.
Thanks in advance.
[Updated on: Mon, 04 June 2007 07:27] Report message to a moderator
|
|
|
Re: XML output change [message #242637 is a reply to message #242626] |
Mon, 04 June 2007 08:31 |
bhoite_amol83
Messages: 110 Registered: June 2005 Location: Pune
|
Senior Member |
|
|
Hi,
Please let me know is it possible to change XML output using any other oracle-xml function.
Please let me know if any documentation exists for the Oracle XML generation.
Please send me any help asap.
Waiting for reply.
Thanks a lot.
|
|
|
Re: XML output change [message #242930 is a reply to message #242626] |
Tue, 05 June 2007 09:32 |
mchadder
Messages: 224 Registered: May 2005 Location: UK
|
Senior Member |
|
|
I don't think you can (not with SQL/XML functions anyway), even at 10g, you can add CDATA sections, xml root elements, PIs, but not !DOCTYPE. I think you've got no option other than to do string manipulation, i.e. add it on yourself.
|
|
|
Re: XML output change [message #243230 is a reply to message #242930] |
Wed, 06 June 2007 09:25 |
bhoite_amol83
Messages: 110 Registered: June 2005 Location: Pune
|
Senior Member |
|
|
Hi Mchadder,
Thanks for you suggetions.
So i am sure that this is not possible by using any oracle function.
So, I will do with string manipulation same as what you are saying.
Thanks,
|
|
|