Home » Developer & Programmer » JDeveloper, Java & XML » XML output change
XML output change [message #242621] Mon, 04 June 2007 06:24
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 06:27]

Report message to a moderator

Previous Topic: Please help me with handling PIPELINED
Next Topic: Webservice in Oracle 8i
Goto Forum:
  


Current Time: Fri Dec 02 20:37:18 CST 2016

Total time taken to generate the page: 0.15231 seconds