Generating nested XML with XSU

Hi,
I have been trying to generate a nested XML document with the
XSU Utility (Rdbms 9.0.1) by setting up an nested table (see below)
and the using the command line utiliy as:
c:\>java OracleXML getXML -user "scott/tiger" "SELECT * from dept_type_tab
The result is nested all right, but all texts seem to be in Hex representation:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPT>
<DNAME>0x5245534541524348</DNAME>
<EMP>
<ENAME>0x534D495448</ENAME>
</EMP>
</DEPT>
</ROW>
Can anyone point out to me, where I went wrong? ;-(
Thanx for any input
Jan-Peter
create type emp_type as object
ename varchar2(10)
create type dept_type as object
dname varchar2(14),
emp emp_type
create view tmp_jpm2 as
select dept_type(dept.dname,
emp_type(emp.ename)
) dept
from dept, emp WHERE (dept.deptno = emp.deptno);
create table dept_type_tab ( dept dept_type);
insert into dept_type_tab (dept) select dept from tmp_jpm2;

Hi,
I have been trying to generate a nested XML document with the
XSU Utility (Rdbms 9.0.1) by setting up an nested table (see below)
and the using the command line utiliy as:
c:\>java OracleXML getXML -user "scott/tiger" "SELECT * from dept_type_tab
The result is nested all right, but all texts seem to be in Hex representation:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPT>
<DNAME>0x5245534541524348</DNAME>
<EMP>
<ENAME>0x534D495448</ENAME>
</EMP>
</DEPT>
</ROW>
Can anyone point out to me, where I went wrong? ;-(
Thanx for any input
Jan-Peter
create type emp_type as object
ename varchar2(10)
create type dept_type as object
dname varchar2(14),
emp emp_type
create view tmp_jpm2 as
select dept_type(dept.dname,
emp_type(emp.ename)
) dept
from dept, emp WHERE (dept.deptno = emp.deptno);
create table dept_type_tab ( dept dept_type);
insert into dept_type_tab (dept) select dept from tmp_jpm2;

Similar Messages

  • Nested XML with XSU

    I have data in an Oracle8i-database and will use Java to export
    it to XML. I&#8217;m trying to use XML Developer&#8217;s Kit&#8217;s (XDK&#8217;s) XML
    SQL Utility&#8217;s (XSU&#8217;s) OracleXMLQuery class. But I&#8217;ve problems to
    get the nested XML-structure I need!
    Oracle says there&#8217;s two good ways to do this:
    &#8220;Source Customization
    This category incompases customizations done by altering the
    query or the database schema. Among the simplest and the most
    powerful source customizations are:
    * over the database schema, create an object-relational view
    which maps to the desired XML document structure.
    * in your query, use cursor subqueries, or cast-multiset
    constructs to get nesting in the XML document which comes from a
    flat schema.&#8221;
    They then have an example how to create an object-relational
    view. But this is done with an empty database, and I already
    have tables with data so I don&#8217;t know how to do this.
    I&#8217;ve tried with some simple subqueris like
    SELECT name, id,
    (SELECT COUNT(*) FROM order o WHERE c.id = o.id) AS
    NumOfOrders
    FROM cust c
    But it adds just another colum.
    Could somebody help me or direct me to some resource, please?
    Thanks!

    I have data in an Oracle8i-database and will use Java to export
    it to XML. I&#8217;m trying to use XML Developer&#8217;s Kit&#8217;s (XDK&#8217;s) XML
    SQL Utility&#8217;s (XSU&#8217;s) OracleXMLQuery class. But I&#8217;ve problems to
    get the nested XML-structure I need!
    Oracle says there&#8217;s two good ways to do this:
    &#8220;Source Customization
    This category incompases customizations done by altering the
    query or the database schema. Among the simplest and the most
    powerful source customizations are:
    * over the database schema, create an object-relational view
    which maps to the desired XML document structure.
    * in your query, use cursor subqueries, or cast-multiset
    constructs to get nesting in the XML document which comes from a
    flat schema.&#8221;
    They then have an example how to create an object-relational
    view. But this is done with an empty database, and I already
    have tables with data so I don&#8217;t know how to do this.
    I&#8217;ve tried with some simple subqueris like
    SELECT name, id,
    (SELECT COUNT(*) FROM order o WHERE c.id = o.id) AS
    NumOfOrders
    FROM cust c
    But it adds just another colum.
    Could somebody help me or direct me to some resource, please?
    Thanks!

  • Generating Nested XML Documents

    Hi,
    We want to generate nested XML documents from sql queries using pl/sql.
    If the output of the query is
    EMPNO NAME MGRNO
    1 Super Admin 0
    2 Mgr1 1
    4 SubMgr1_1 2
    5 SubMgr2_1 2
    3 Mgr2 1
    6 SubMgr1_2 3
    then XML generated should be in the format
    Super Admin
    Mgr1
    SubMgr1_1
    SubMgr2_1
    Mgr2
    SubMgr1_2
    Your early response is appreciated.
    Thanks.

    No, the id is not unique, it is part of the data. Also, I don't need to update the XML document.
    I store the data part (id, status, nodenum) in the "resp" table with a primary key as a combination of id and some other info. The table "nodes" will have a foreign key and multiple occurrences of node. Same with table "restricts" with multiple restrict.
    Do I need to create a DOM tree then store each part of the XML into appropriate tables? And how do I do that? (which APIs, etc.)
    Thanks,
    Thuvan

  • [svn] 4000: Updating build files to generate dita xml with lenient as true.

    Revision: 4000
    Author: [email protected]
    Date: 2008-11-03 13:39:40 -0800 (Mon, 03 Nov 2008)
    Log Message:
    Updating build files to generate dita xml with lenient as true.
    QE Notes: None
    Doc Notes: None
    tests: checkintests
    Modified Paths:
    flex/sdk/trunk/asdoc/build.xml
    flex/sdk/trunk/frameworks/projects/airframework/build.xml
    flex/sdk/trunk/frameworks/projects/flash-integration/build.xml
    flex/sdk/trunk/frameworks/projects/flex/build.xml
    flex/sdk/trunk/frameworks/projects/flex4/build.xml
    flex/sdk/trunk/frameworks/projects/framework/build.xml
    flex/sdk/trunk/frameworks/projects/haloclassic/build.xml
    flex/sdk/trunk/frameworks/projects/rpc/build.xml
    flex/sdk/trunk/frameworks/projects/utilities/build.xml
    flex/sdk/trunk/frameworks/projects/wireframe/build.xml

    Any idea, I'm looking for your opinion, what do you think of the above

  • How to update Nested tables with xsu

    Hello,
    I have three tables.
    1) DEPARTMENT_TAB
    2) EMPLOYEE_TYP
    3) ADDRESS_TYP
    ADDRESS_TYP is a collection and it is nested inside EMPLOYEE_TYP.
    EMPLOYEE_TYP is a collection and it is nested inside DEPARTMENT_TAB.
    created with below scropt
    CREATE TYPE ADDRESS_TYP AS OBJECT (CITY VARCHAR2(10), STATE VARCHAR2(2));
    CREATE TYPE ADDRESS_TYP_NT AS TABLE OF ADDRESS_TYP;
    CREATE TYPE EMPLOYEE_TYP AS OBJECT (EMPNO NUMBER(4), ENAME VARCHAR2(10), ADDRESS_VAR ADDRESS_TYP_NT);
    CREATE TYPE EMPLOYEE_TYP_NT AS TABLE OF EMPLOYEE_TYP;
    CREATE TABLE DEPARTMENT_TAB (DEPTNO NUMBER(4), DNAME VARCHAR2(10), EMPLOYEE_VAR EMPLOYEE_TYP_NT)
         NESTED TABLE EMPLOYEE_VAR STORE AS EMPLOYEE_TAB
         ( NESTED TABLE ADDRESS_VAR STORE AS ADDRESS_TAB);
    I inserted two rows in DEPARTMENT_TAB and their nested tables using normalsql. and i generated below xml content using XSU java API
    oracle.xml.sql.query.OracleXMLQuery
    My Question is How to UPDATE a row in ADDRESS_TAB using XSU java API
    oracle.xml.sql.dml.OracleXMLSave.
    (When i was trying to update address_tab nested table's row with xml input file. it is deleting other existing rows)
    Thanks.

    Why do you say it does not work?

  • Producing nested xml with querying attributes from a nested table

    How can one produce nested xml querying columns from a nested table? Looking at the object documentation, I can readily unnest the tables. Using your examples in the book, unnesting is select po.pono, ..., l.* from purchaseorder_objtab po, table (po.lineitemlist_ntab) l where l.quantity = 2;
    what if I don't want to unnest and don't want a cursor. I would like to produce nested xml.

    Gail,
    Although you can use XSU (XML-SQL Util) in 8.1.7, I would recommend that you upgrade to 9i for much better support (both in functionality and performance) of XML in the database. For example, in Oracle9i there are:
    - a new datatype - XMLType for storing and retrieving XML documents
    - DBMS_XMLGEN package and SYS_XMLGEN, SYS_XMLAGG functions for generating XML document from complex SQL queries
    - A pipelined table function to break down large XML documents into rows.
    You can check out some examples using SYS_XMLGEN and DBMS_XMLGEN for your specific needs at http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88894/adx05xml.htm#1017141
    Regards,
    Geoff

  • Query to generate Nested XML feed

    Hello,
    I use Oracle 11g R2 SOE....
    I have two main tables
    COMMERCIALS_PROPERTIES (com_id number PK , com_size number, project_id number, com_type number)
    COM_PHOTOS (ID number PK , com_id number FK, content blob, mimetype varchar2)
    Please, note the following has nothing to do with my problem:
    CONTENT and MIMETYPE columns. Also, the lookup tables: PROJECTS , COM_TYPE
    I Exposed a report as RESTful web service in XML format:
    I am using this query to generate the XML 1 feed, but I need to tweak the query to generate XML 2 feed.
    Is it possible, how to do it ???
    Select
    "COM"."COM_ID" as "COM_ID",
    "COM"."COM_SIZE" as "SIZE",
    "PROJECTS"."PROJECT_NAME_EN" as "PROJECT",
    "COM_TYPES"."COM_TYPE" as "COM_TYPE",
    'http://fam-erp.com/apex/erp/fateh/'||IMG.ID as "ImgURL"
    FROM
    COM_PHOTOS IMG inner join COMMERCIALS_PROPERTIES "COM"
    on   IMG.COM_ID = COM.COM_ID
    inner join "PROJECTS" "PROJECTS"
    on "PROJECTS"."PROJECT_ID"="COM"."PROJECT_ID"
    inner join "COM_TYPE_LOOKUP" "COM_TYPES"
    on "COM_TYPES"."TYPE_ID"="COM"."COM_TYPE"
    WHERE
      COM.COM_ID < 80 order by 1h1. XML 1
    h2. Please look only at <COM_ID> and <ImgURL>
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </ROW>
    </ROWSET>---------------------------
    h1. XML 2
    h2. Please look only at <COM_ID> and <Images> and <ImgURL>
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </Images>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </Images>
    </ROW>
    </ROWSET>

    Hello,
    I see, I found another solution, but come across another problem that is the web service should get Data from more than one table. I have this procedure, and I would like to *"UNION" its* Select Statement with another Select Statement:
    declare
      v_xml clob;
      v_retval clob := '<?xml version="1.0" encoding="iso-8859-1"?>';
      v_blob blob;
    begin
    select
           xmlelement(
             "LISTINGS",
             xmlagg(
               xmlelement(
                 "LISTING",
                 xmlforest(
    'RS-'||R."RES_ID" as "Property_Ref_No",
    "UNIT_TYPE_LOOKUP"."UNIT_TYPE" as "Unit_Type",
    'Sale' as "Ad_Type",
    'Dubai' as "State",
    L.LOCATION_NAME_EN AS "Community",
    "PROJECTS"."PROJECT_NAME_EN" as "Property_Name",
    "RES_SALE"."ASKING_PRICE" as "Price",
    ' ' as "Frequency",
    ST."SUB_TYPE" as "Unit_Model",
    R."RES_SIZE" as "Unit_Builtup_Area",
    R.BEDS as "Bedrooms",
    R.bath as "No_of_Bathrooms",
    "RES_SALE"."AD_TITLE" as "Property_Title",
    RES_SALE.DESCRIPTION as "Web_Remarks",
    to_char("RES_SALE"."UPDATED_ON",'YYYY-MM-DD HH:MI:SSPM') as "Last_Updated",
    R.VIDEO as "Web_Tour",
    select xmlagg(
                                 xmlforest(
                                'http://thevillaproject.com/apex/erp/IMAGES/'||IMG.ID AS "ImageUrl"
    FROM      
          IMAGES IMG     
    WHERE IMG.RES_ID = R.RES_ID ) Images )))).getclobval()
      into      v_xml
      FROM
          "RES_SALE" "RES_SALE"
    inner join
          RES R on (R."RES_ID"="RES_SALE"."RES_ID")
    inner join
              "UNIT_STATUS_LOOKUP" on (UNIT_STATUS_LOOKUP.status_id = "RES_SALE"."RES_STATUS")
    inner join
          "PROJECTS" "PROJECTS" on ("PROJECTS"."PROJECT_ID"=R."PROJECT_ID")
    inner join
          "UNIT_TYPE_LOOKUP" "UNIT_TYPE_LOOKUP" on ("UNIT_TYPE_LOOKUP"."TYPE_ID"=R."RES_TYPE")
    inner join
          "RES_SUB_TYPE_LOOKUP" ST on (ST."SUB_TYPE_ID"=R."SUB_TYPE")
    INNER JOIN
          COMPLEX_LOOKUP CL ON (CL.COMPLEX_ID = "PROJECTS".COMPLEX_ID)
    INNER JOIN
          LOCATIONS L ON (L.LOCATION_ID = CL.LOCATION_ID)
    WHERE  "RES_SALE".RES_status IN (5,8) AND "RES_SALE".LIVE = 'Y' AND "RES_SALE".DESCRIPTION IS NOT NULL
      dbms_lob.append(v_retval,v_xml);
      OWA_UTIL.Mime_Header('text/xml'); 
      htp.p('Content-length: ' || to_char(dbms_lob.getlength(v_retval)));
      htp.p('Content-Disposition:  inline; filename="Just.xml"');
      owa_util.http_header_close;
      v_blob := wwv_flow_utilities.clob_to_blob(v_retval);
      wpg_docload.download_file(v_blob);
    end; h1. Select Statement that is needed to be "UNION-ED" with the Select Statement of the previous procedure:
    select
           xmlelement(
             "LISTINGS",
             xmlagg(
               xmlelement(
                 "LISTING",
                 xmlforest(
    'RR-'||R."RES_ID" as "Property_Ref_No",
    "UNIT_TYPE_LOOKUP"."UNIT_TYPE" as "Unit_Type",
    'Rent' as "Ad_Type",
    'Dubai' as "State",
    L.LOCATION_NAME_EN AS "Community",
    "PROJECTS"."PROJECT_NAME_EN" as "Property_Name",
    "RES_RENT"."ASKING_PRICE" as "Price",
    ' ' as "Frequency",
    ST."SUB_TYPE" as "Unit_Model",
    R."RES_SIZE" as "Unit_Builtup_Area",
    R.BEDS as "Bedrooms",
    R.bath as "No_of_Bathrooms",
    "RES_RENT"."AD_TITLE" as "Property_Title",
    "RES_RENT".DESCRIPTION as "Web_Remarks",
    to_char("RES_RENT"."UPDATED_ON",'YYYY-MM-DD HH:MI:SSPM') as "Last_Updated",
    R.VIDEO as "Web_Tour",
    select xmlagg(
                                 xmlforest(
                                'http://thevillaproject.com/apex/erp/IMAGES/'||IMG.ID AS "ImageUrl"
    FROM      
          IMAGES IMG     
    WHERE IMG.RES_ID = R.RES_ID ) Images ))))
    FROM
          "RES_RENT" "RES_RENT"
    inner join
          RES R on (R."RES_ID"="RES_RENT"."RES_ID")
    inner join
              "UNIT_STATUS_LOOKUP" on (UNIT_STATUS_LOOKUP.status_id = "RES_RENT"."RES_STATUS")
    inner join
          "PROJECTS" "PROJECTS" on ("PROJECTS"."PROJECT_ID"=R."PROJECT_ID")
    inner join
          "UNIT_TYPE_LOOKUP" "UNIT_TYPE_LOOKUP" on ("UNIT_TYPE_LOOKUP"."TYPE_ID"=R."RES_TYPE")
    inner join
          "RES_SUB_TYPE_LOOKUP" ST on (ST."SUB_TYPE_ID"=R."SUB_TYPE")
    INNER JOIN
          COMPLEX_LOOKUP CL ON (CL.COMPLEX_ID = "PROJECTS".COMPLEX_ID)
    INNER JOIN
          LOCATIONS L ON (L.LOCATION_ID = CL.LOCATION_ID)
    WHERE  "RES_RENT".RES_status IN (5,8) AND "RES_RENT".LIVE = 'Y' AND "RES_RENT".DESCRIPTION IS NOT NULL

  • SQL query to generate Nested XML

    Hello,
    I use Oracle 11g R2 SOE....
    I have two main tables
    COMMERCIALS_PROPERTIES (com_id number PK , com_size number, project_id number, com_type number)
    COM_PHOTOS (ID number PK , com_id number FK, content blob, mimetype varchar2)
    Please, note the following has nothing to do with my problem:
    CONTENT and MIMETYPE columns. Also, the lookup tables: PROJECTS , COM_TYPE
    In APEX ( Application Express ) we can expose a report as RESTful web service in XML format:
    I am using this query to generate the XML 1 feed, but I need to tweak the query to generate XML 2 feed.
    Is it possible, how to do it ???
    Select
    "COM"."COM_ID" as "COM_ID",
    "COM"."COM_SIZE" as "SIZE",
    "PROJECTS"."PROJECT_NAME_EN" as "PROJECT",
    "COM_TYPES"."COM_TYPE" as "COM_TYPE",
    'http://fam-erp.com/apex/erp/fateh/'||IMG.ID as "ImgURL"
    FROM
    COM_PHOTOS IMG inner join COMMERCIALS_PROPERTIES "COM"
    on   IMG.COM_ID = COM.COM_ID
    inner join "PROJECTS" "PROJECTS"
    on "PROJECTS"."PROJECT_ID"="COM"."PROJECT_ID"
    inner join "COM_TYPE_LOOKUP" "COM_TYPES"
    on "COM_TYPES"."TYPE_ID"="COM"."COM_TYPE"
    WHERE
      COM.COM_ID < 80 order by 1h1. XML 1
    h2. Please look only at <COM_ID> and <ImgURL>
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </ROW>
    </ROWSET>---------------------------
    h1. XML 2
    h2. Please look only at <COM_ID> and <Images> and <ImgURL>
    <ROWSET>
    <ROW>
    <COM_ID>77</COM_ID>
    <SIZE>842</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1410</ImgURL>
          <ImgURL>http://fam-erp.com/apex/erp/fateh/1412</ImgURL>
    </Images>
    </ROW>
    <ROW>
    <COM_ID>78</COM_ID>
    <SIZE>756</SIZE>
    <PROJECT>Bayswater Tower</PROJECT>
    <COM_TYPE>Office</COM_TYPE>
    <Images>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1425</ImgURL>
            <ImgURL>http://fam-erp.com/apex/erp/fateh/1429</ImgURL>
    </Images>
    </ROW>
    </ROWSET>

    Hi, Fateh
    One possible way is to use XML functions to create your XML.
    Using XML functions you can do the IMAGES as an XMLAGG subquery rather than join to the image table.
    Here's an example using SCOTT schema:
    SQL> select xmlelement(
      2            "ROWSET"
      3          , xmlagg(
      4               xmlelement(
      5                  "ROW"
      6                , xmlforest(
      7                     d.deptno as "ID"
      8                   , d.dname as "NAME"
      9                   , (
    10                        select xmlagg(
    11                                  xmlelement(
    12                                     "ImgUrl"
    13                                   , 'http://the.server.com/'||e.empno
    14                                  )
    15                                  order by e.empno
    16                               )
    17                          from scott.emp e
    18                         where e.deptno = d.deptno
    19                     ) as "Images"
    20                  )
    21               )
    22               order by d.deptno
    23            )
    24         ) the_xml
    25    from scott.dept d
    26    /* joins to the other tables EXCEPT image table */
    27  /
    THE_XML
    <ROWSET><ROW><ID>10</ID><NAME>ACCOUNTING</NAME><Images><ImgUrl>http://the.serverThat output is an XMLTYPE column (think of it as a CLOB with added functionality ;-) )
    My SQL*PLUS cuts the output, but believe me, it is all there.
    Just to show it, here's the same example wrapped in an XMLSERIALIZE function to pretty-print the XML:
    SQL> select xmlserialize(
      2            content
      3            xmlelement(
      4               "ROWSET"
      5             , xmlagg(
      6                  xmlelement(
      7                     "ROW"
      8                   , xmlforest(
      9                        d.deptno as "ID"
    10                      , d.dname as "NAME"
    11                      , (
    12                           select xmlagg(
    13                                     xmlelement(
    14                                        "ImgUrl"
    15                                      , 'http://the.server.com/'||e.empno
    16                                     )
    17                                     order by e.empno
    18                                  )
    19                             from scott.emp e
    20                            where e.deptno = d.deptno
    21                        ) as "Images"
    22                     )
    23                  )
    24                  order by d.deptno
    25               )
    26            )
    27            as varchar2(4000)
    28            indent size=2
    29         ) the_xml
    30    from scott.dept d
    31    /* joins to the other tables EXCEPT image table */
    32  /
    THE_XML
    <ROWSET>
      <ROW>
        <ID>10</ID>
        <NAME>ACCOUNTING</NAME>
        <Images>
          <ImgUrl>http://the.server.com/7782</ImgUrl>
          <ImgUrl>http://the.server.com/7839</ImgUrl>
          <ImgUrl>http://the.server.com/7934</ImgUrl>
        </Images>
      </ROW>
      <ROW>
        <ID>20</ID>
        <NAME>RESEARCH</NAME>
        <Images>
          <ImgUrl>http://the.server.com/7369</ImgUrl>
          <ImgUrl>http://the.server.com/7566</ImgUrl>
          <ImgUrl>http://the.server.com/7788</ImgUrl>
          <ImgUrl>http://the.server.com/7876</ImgUrl>
          <ImgUrl>http://the.server.com/7902</ImgUrl>
        </Images>
      </ROW>
      <ROW>
        <ID>30</ID>
        <NAME>SALES</NAME>
        <Images>
          <ImgUrl>http://the.server.com/7499</ImgUrl>
          <ImgUrl>http://the.server.com/7521</ImgUrl>
          <ImgUrl>http://the.server.com/7654</ImgUrl>
          <ImgUrl>http://the.server.com/7698</ImgUrl>
          <ImgUrl>http://the.server.com/7844</ImgUrl>
          <ImgUrl>http://the.server.com/7900</ImgUrl>
        </Images>
      </ROW>
      <ROW>
        <ID>40</ID>
        <NAME>OPERATIONS</NAME>
      </ROW>
    </ROWSET>For a webservice you do not need to pretty-print the XML that is returned by the webservice.
    I do not know APEX, so I do not know if APEX supports exposing an allready built piece of XML rather than exposing a query result.
    But my guess is that it should do it very nicely if you query an XMLTYPE datatype (that is - use the first of my examples rather than the pretty-printed one.)
    If you can't get APEX to do it this way, then I suggest you try asking in the APEX forum rather than the SQL forum ;-)

  • Generate nested xml

    I have following tables :
    DEPT
    DEPT_ID    DEPT_NAME      GRP_NAME
    1          Engineering    Research and Development
    2          Tool Design    Research and Development
    EMP
    EMP_ID      FIRST_NAME    MIDDLE_NAME    LAST_NAME     DEPT_ID    HIRE_DATE      
    1           Roberto       Luc            Tamburello    1          1997-12-12     
    2           Rob           (null)         Walters       2          1998-01-05     
    3           Thierry       (null)         D'Hers        2          1998-01-11     
    4           Janice        B.             Galvin        2          2001-01-23     
    EMP_TEL
    EMP_ID    TEL_ID
    1         1
    1         5
    2         2
    3         3
    4         4
    TEL
    TEL_ID    AREA_CODE    PHONE_NO    EXT     TEL_TYPE_ID    
    1         111          1111111     111     1
    2         222          2222222     222     1
    3         333          3333333     333     1
    4         444          4444444     444     1
    5         555          5555555     (null)  2
    TEL_TYPE
    TEL_TYPE_ID    TEL_TYPE_CD
    1              OFFICE
    2              FAX
    3              CELLIs there a way to generate below xml in one sql statement?
    <Company>
      <Department>
        <DepartmentName>Engineering</DepartmentName>
        <GroupName>Research and Development</GroupName>
        <Employee>
          <FirstName>Roberto</FirstName>
          <MiddleName>Luc</MiddleName>
          <LastName>Tamburello</LastName>
          <HireDate>1997-12-12</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>111-111-1111</TelephoneNumber>
            <Extension>111</Extension>
          </Telephone>
          <Telephone>
            <TelephoneType>FAX</TelephoneType>
            <TelephoneNumber>555-555-5555</TelephoneNumber>
          </Telephone>
        </Employee>
      </Department>
      <Department>
        <DepartmentName>Tool Design</DepartmentName>
        <GroupName>Research and Development</GroupName>
        <Employee>
          <FirstName>Rob</FirstName>
          <LastName>Walters</LastName>
          <HireDate>1998-01-05</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>222-222-2222</TelephoneNumber>
            <Extension>222</Extension>
          </Telephone>
        </Employee>
        <Employee>
          <FirstName>Thierry</FirstName>
          <LastName>D'Hers</LastName>
          <HireDate>1998-01-11</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>333-333-3333</TelephoneNumber>
            <Extension>333</Extension>
          </Telephone>
        </Employee>
        <Employee>
          <FirstName>Janice</FirstName>
          <MiddleName>B.</MiddleName>
          <LastName>Galvin</LastName>
          <HireDate>2001-01-23</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>444-444-4444</TelephoneNumber>
            <Extension>444</Extension>
          </Telephone>
        </Employee>
      </Department>
    </Company>

    Is there a way to generate below xml in one sql statement?yes, this way:
    SQL> select xmlelement("Company",
      2               xmlagg(
      3                  xmlelement("Department",
      4                             xmlforest(dept_name as "DepartmentName",
      5                                       grp_name as "GroupName"
      6                                       ),
      7                             (select xmlagg(
      8                                         xmlelement("Employee",
      9                                                    xmlforest(FIRST_NAME as "FirstName",
    10                                                              MIDDLE_NAME as "MiddleName",
    11                                                              LAST_NAME as "LastName",
    12                                                              to_char(HIRE_DATE,'yyyy-mm-dd') as "HireDate"
    13                                                              ),
    14                                                    (Select xmlagg(
    15                                                              xmlelement("Telephone",
    16                                                                         xmlforest(TEL_TYPE_CD as "TelephoneType",
    17                                                                                   AREA_CODE||'-'||PHONE_NO as "TelephoneNumber",
    18                                                                                   EXT as "Extension"
    19                                                                                   )
    20                                                                         )
    21                                                                   )
    22                                                        from TEL t, TEL_TYPE tt, EMP_TEL et
    23                                                       where t.TEL_TYPE_ID=tt.TEL_TYPE_ID
    24                                                         and et.EMP_ID = e.EMP_ID
    25                                                         and et.TEL_ID = t.TEL_ID
    26                                                    )
    27                                                   )
    28                                              )
    29                                from emp e
    30                               where e.DEPT_ID=d.DEPT_ID
    31                              )
    32                             )
    33                      )
    34                    ).extract('/*') doc
    35    from DEPT d;
    DOC
    <Company>
      <Department>
        <DepartmentName>Engineering</DepartmentName>
        <GroupName>Research and Development</GroupName>
        <Employee>
          <FirstName>Roberto</FirstName>
          <MiddleName>Luc</MiddleName>
          <LastName>Tamburello</LastName>
          <HireDate>1997-12-12</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>111-1111111</TelephoneNumber>
            <Extension>111</Extension>
          </Telephone>
          <Telephone>
            <TelephoneType>FAX</TelephoneType>
            <TelephoneNumber>555-5555555</TelephoneNumber>
          </Telephone>
        </Employee>
      </Department>
      <Department>
        <DepartmentName>Tool Design</DepartmentName>
        <GroupName>Research and Development</GroupName>
        <Employee>
          <FirstName>Rob</FirstName>
          <LastName>Walters</LastName>
          <HireDate>1998-01-05</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>222-2222222</TelephoneNumber>
            <Extension>222</Extension>
          </Telephone>
        </Employee>
        <Employee>
          <FirstName>Thierry</FirstName>
          <LastName>D&apos;Hers</LastName>
          <HireDate>1998-01-11</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>333-3333333</TelephoneNumber>
            <Extension>333</Extension>
          </Telephone>
        </Employee>
        <Employee>
          <FirstName>Janice</FirstName>
          <MiddleName>B.</MiddleName>
          <LastName>Galvin</LastName>
          <HireDate>2001-01-23</HireDate>
          <Telephone>
            <TelephoneType>OFFICE</TelephoneType>
            <TelephoneNumber>444-4444444</TelephoneNumber>
            <Extension>444</Extension>
          </Telephone>
        </Employee>
      </Department>
    </Company>Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

  • How to generate nested xml from a resultset

    there is a table which contains two field:key and fatherkey.
    like this:
    key fatherkey
    node1 root
    node2 node1
    node3 node2
    a tree can be builded from the table by recursion of key and fatherkey.
    now I want to use this table to generate a xml buffer.
    like this:
    <nodes>
    <node>
    <key>node1</key>
    <fkey>root</fkey>
    <node>
    <key>node2</key>
    <fkey>node1</fkey>
    <node>
    <key>node3</key>
    <fkey>node2</fkey>
    </node>
    </node>
    </node>
    </nodes>
    if oracle special sql --"Connect by" can be used ,it is so easy.
    but I can only use ansi sql.
    how to generate the xml?

    hehe, I solved it by JDom!
    source code is :
    public StringBuffer loadInitResource()
    Vector theOrphans = new Vector();
    StringBuffer theInitRes = new StringBuffer();
    Element root = new Element("NODES");
    String xsql = "SELECT KEY,FATHERKEY FROM TABLE1";
    ResultSete m_rs = stmt.executeQuery(xsql);
    try{
    while(m_rs.next())
    Element theNode = new Element("NODE");
    Element theFLD = new Element("ID");
    theFLD.addContent(m_rs.getString(1));
    theNode.addContent(theFLD);
    theFLD = new Element("SID");
    theFLD.addContent(m_rs.getString(2));
    theNode.addContent(theFLD);
    if("Root".equals(theNode.getChildText("SID").trim()))
    root.addContent(theNode);
    else if(x_setFatherRes(theNode, root))
    System.out.println("find");
    else
    theOrphans.addElement(theNode);
    Element theNode;
    int nIndex;
    boolean isDo = false;
    while(theOrphans.size()>0)
    System.out.println("find the orphan!");
    isDo = false;
    for(nIndex = 0;nIndex < theOrphans.size();nIndex++)
    theNode = (Element) theOrphans.get(nIndex);
    if(x_setFatherRes(theNode, root))
    theOrphans.remove(nIndex);
    isDo = true;
    System.out.println("found the orphan!");
    break;
    if(!isDo)
    System.out.println("some nodes could not be loaded!");
    break;
    //OutputStream out=new FileOutputStream("e:/XMLFile.xml");
    Document doc = new Document(root);
    XMLOutputter outputter = new XMLOutputter();
    outputter.setEncoding("GB2312");
    //outputter.output(doc,out);
    theInitRes = new StringBuffer(outputter.outputString(doc));
    catch(Exception e)
    m_error += e.toString() ;
    return theInitRes;
    private boolean x_setFatherRes(Element theSon,Element theFather)
    boolean isOK = false;
    String sFatherSID = theFather.getChildText("ID");
    if(sFatherSID != null)
    if(theSon.getChildText("SID").equals(sFatherSID.trim()))
    theFather.addContent(theSon);
    isOK = true;
    if(isOK)
    return isOK;
    Iterator iterator = theFather.getChildren().iterator();
    while(iterator.hasNext())
    Element theFather2 = (Element) iterator.next();
    isOK = x_setFatherRes(theSon,theFather2);
    if(isOK)
    break;
    return isOK;
    enjoy it!

  • Generate nested XML using OracleXMLQuery generates error

    Hello,
    I have oracle 8.1.6 with XSQL 1.0.4 and need to generate XML out of a query that contains the // init the OracleXMLQuery
    OracleXMLQuery qry = new OracleXMLQuery(conn, query);
    // shape the XML doc generated
    qry.setMaxRows(2); // set the maximum number of rows to be returned
    qry.setSkipRows(3); // numbers of rows to skipped
    qry.setRowsetTag("MYDOC"); // set the tags encapsulating the whole doc
    qry.setRowTag("RECORD"); // sets the row separator tag
    qry.setRowIdAttrName("cnt"); // sets the id attribute of the row element
    qry.useNullAttributeIndicator(true); // use attr. to indicate nullness
    qry.useUpperCaseTagNames(); // use upper case tag names
    qry.setErrorTag("ERR"); // tag for errors writen to XML doc
    XMLDocument myXMLDocument = (XMLDocument)qry.getXMLDOM();
    PrintWriter out = response.getWriter();
    myXMLDocument.print(out);
    out.close();null

    I have exactly the same problem by using XSU.
    If somebody solve it already ?
    David, can you please provide more information or small example, how can I extract OracleConnection or Oracle Specific Driver inside the Weblogic App. Server and not generic weblogic.jdbc.rmi.SerialConnection instance.
    I'm using Oracle thinDriver on Oracle8i.
    Thank you in advance.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David G:
    have seen similar problems with wrapped jdbc driver being passed into Weblogic pool service and then cast back into OracleDriver after getting it back from Weblogic's JNDI DataSource lookup ...the Oracle extensions do not seem to survive Weblogic's jdbc pool services handling. I have gone over to running all my connection pools in Oracle's own namespace jdbc_access:// for JNDI lookups on DataSource pools instead. Much happier. <HR></BLOCKQUOTE>
    null

  • Un-nest XML with single child element

    I'm trying to write a generic function for un-nesting child nodes where nesting is deemed unnecessary. Typically when the element only has one child element.
    For example, given the following source....
    <ROOT>
      <ITEM>
        <DESCRIPTION>TEST1</DESCRIPTION>
      </ITEM>
      <ITEM>
        <DESCRIPTION>TEST2</DESCRIPTION>
      </ITEM>
    </ROOT>I actually want.....
    <ROOT>
      <DESCRIPTION>TEST1</DESCRIPTION>
      <DESCRIPTION>TEST2</DESCRIPTION>
    </ROOT>because we think ITEM isn't really required before we deliver XML data.
    I've been trying to achieve this with a function, where I pass in the XPath to the node I want flattening, something like
    function UnNest(pXMLData XMLType, pXPath varchar2) return XMLType...Called like the following...
    declare
    begin
      vXMLData := UnNest(SomeXMLData, '/ROOT/ITEM')
    end;I tried using XQuery Update (11gR2), as follows,
    select /*+ no_xml_query_rewrite */
      xmlquery('
        copy $d := .
         modify (
            for $i in $d/ROOT/ITEM
            return
              replace node $i with $i/child::node()  
         return $d'
      passing xmltype(
    '<ROOT>
      <ITEM>
        <DESCRIPTION>TEST1</DESCRIPTION>
      </ITEM>
      <ITEM>
        <DESCRIPTION>TEST2</DESCRIPTION>
      </ITEM>
    </ROOT>'
      returning content) XML
    from dual.... which works, but when I try to pass in a path variable, it doesn't.
    select /*+ no_xml_query_rewrite */
      xmlquery('
        copy $d := .
         modify (
            for $i in $d/$Unnestpath
            return
              replace node $i with $i/child::node()  
         return $d'
      passing xmltype(
    '<ROOT>
      <ITEM>
        <DESCRIPTION>TEST1</DESCRIPTION>
      </ITEM>
      <ITEM>
        <DESCRIPTION>TEST2</DESCRIPTION>
      </ITEM>
    </ROOT>'
      'ROWSET/ROW' as "Unnestpath"
      returning content) XML
    from dual
    ORA-19112: error raised during evaluation:
    XVM-01020: [XPTY0020] The path step context item is not a node
    6             replace node $i with $i/child::node()  
    -                                   ^Am I missing something obvious?
    My destination platform is 11gR2 64 bit but going forward I may need a solution for 10gR2 too. Perhaps there is another way without using XQuery Update? Any advice would be greatly appreciated.

    paul zip wrote:
    when I try to pass in a path variable, it doesn't.Yes, paths are not variables, they have to be static. However, you can make the whole query dynamic.
    Another option is XSLT, which will work on both releases, or a combination of extract/updatexml calls.
    SQL> create or replace function UnNest(pXMLData XMLType, pXPath varchar2)
      2  return XMLType
      3  is
      4    result          XMLType;
      5    xsl_template    varchar2(2000) :=
      6    '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      7    <xsl:template match="@*|node()">
      8      <xsl:copy>
      9        <xsl:apply-templates select="@*|node()"/>
    10      </xsl:copy>
    11    </xsl:template>
    12    <xsl:template match="#TARGET_XPATH#">
    13      <xsl:apply-templates select="node()"/>
    14    </xsl:template>
    15  </xsl:stylesheet>';
    16 
    17  begin
    18 
    19    select xmltransform(
    20             pXMLData
    21           , xmlparse(document replace(xsl_template, '#TARGET_XPATH#', pXPath))
    22           )
    23    into result
    24    from dual ;
    25 
    26    return result;
    27 
    28  end;
    29  /
    Function created
    SQL> set long 5000
    SQL>
    SQL> select unnest(
      2  xmltype(
      3  '<ROOT>
      4    <ITEM>
      5      <DESCRIPTION>TEST1</DESCRIPTION>
      6    </ITEM>
      7    <ITEM>
      8      <DESCRIPTION>TEST2</DESCRIPTION>
      9    </ITEM>
    10  </ROOT>'),
    11  '/ROOT/ITEM'
    12  )
    13  from dual;
    UNNEST(XMLTYPE('<ROOT><ITEM><D
    <ROOT>
    <DESCRIPTION>TEST1</DESCRIPTION>
    <DESCRIPTION>TEST2</DESCRIPTION>
    </ROOT>
    Typically when the element only has one child element.If it's a general rule to apply, XSLT can do it very easily on every node that satisfies this condition.
    Edited by: odie_63 on 21 mai 2013 12:38

  • Generate Deployment XML with Ant or Build

    I'm looking for a way to generate the deployment xml through a build script rather than through the mapping workbench.
    Anyone know if there are command-line type options available?

    Not that I'm aware of, but why would you want to not use the MW, it's a huge productivity gain as far as development is concerned. It saves you from writing out all that XML.
    Remember that typically in a development team, this XML is generated just 1 time for a given release (unless you're continually changing the object model or data model - which is a bad idea anyway)
    my 2 cents,
    Darren

  • Nesting xml in Oracle 8i

    How to generate nested xml/ complex xml in Oracle 8i using 8i packages dbms_xmlquery or xmlgen .
    The xml might be looked like this..
    if any body have idea then pls let me know.
    i am trying to write Stored procedure on that i am using query like select c1,c2, cursor(c3,c4 from xyb) from ABC
    but not getting required output
    <?xml version="1.0" ?>
    - <File>
    <File_Type>ETNL_TRAVELR_PAYMENTS</File_Type>
    - <File_Header_Record>
    <File_Format_Version>0002</File_Format_Version>
    <Creation_Module />
    </File_Header_Record>
    - <Transaction>
    <Transaction_Type>FT_TRANS_IMP</Transaction_Type>
    - <Transaction_Header>
    <Record_Number>1</Record_Number>
    <Urgent>N</Urgent>
    </Transaction_Header>
    - <Model_Info>
    - <Model_ID>
    - <![CDATA[ FF DOM EXT PAY
      ]]>
    </Model_ID>
    </Model_Info>
    - <Transfer_Info>
    <Charges>15</Charges>
    </Transfer_Info>
    - <Amounts>
    - <Transaction_Amount>
    <Amount>154.00</Amount>
    <Currency>GBP</Currency>
    </Transaction_Amount>
    </Amounts>
    - <Dates>
    <Trusted_Source>N</Trusted_Source>
    <Value_Date />
    </Dates>
    - <Bank_Account>
    <Bank_Account_Type>DR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>K</Code_Type>
    </Bank_Route_Code>
    </Bank>
    - <Account>
    <Account_ID>D562</Account_ID>
    </Account>
    </Bank_Account>
    - <Bank_Account>
    <Bank_Account_Type>CR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>K</Code_Type>
    - <Code>
    - <![CDATA[ 538111
      ]]>
    </Code>
    </Bank_Route_Code>
    - <Bank_Address_Info>
    - <Name>
    - <![CDATA[ Natwest
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[ Long Sutton Branch
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[ 25 market Place
      ]]>
    </Street2>
    - <City>
    - <![CDATA[ Spalding
      ]]>
    </City>
    <Country>GB</Country>
    </Bank_Address_Info>
    </Bank>
    - <Account>
    - <Account_Number>
    - <![CDATA[ 12345678
      ]]>
    </Account_Number>
    - <Account_Address_Info>
    - <Name>
    - <![CDATA[ John Doe
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[ Employee Addr1
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[ Employee Addr2
      ]]>
    </Street2>
    - <City>
    - <![CDATA[ EmployeeCity
      ]]>
    </City>
    <Country_Sub_Entity />
    <Postal>CF375YL</Postal>
    <Country>GB</Country>
    </Account_Address_Info>
    </Account>
    </Bank_Account>
    - <Payment_Details_Or_Addenda>
    - <Details_Text>
    - <![CDATA[ PAY OHRID: 100000999
      ]]>
    </Details_Text>
    </Payment_Details_Or_Addenda>
    - <Comments>
    - <Comment_Text>
    - <![CDATA[ NONE
      ]]>
    </Comment_Text>
    </Comments>
    - <References>
    - <Reference>
    <Reference_Type>FBNF</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ INVOICE 20021004001542
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type />
    - <Reference_Value>
    - <![CDATA[
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type>FMAILEN</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ [email protected]
      ]]>
    </Reference_Value>
    </Reference>
    </References>
    </Transaction>
    + <Transaction>
    <Transaction_Type>FT_TRANS_IMP</Transaction_Type>
    + <Transaction_Header>
    <Record_Number>2</Record_Number>
    <Urgent>N</Urgent>
    </Transaction_Header>
    + <Model_Info>
    - <Model_ID>
    - <![CDATA[ FF DOM EXT PAY
      ]]>
    </Model_ID>
    </Model_Info>
    + <Transfer_Info>
    <Charges>15</Charges>
    </Transfer_Info>
    - <Amounts>
    - <Transaction_Amount>
    <Amount>46.00</Amount>
    <Currency>EUR</Currency>
    </Transaction_Amount>
    </Amounts>
    - <Dates>
    <Trusted_Source>N</Trusted_Source>
    <Value_Date />
    </Dates>
    - <Bank_Account>
    <Bank_Account_Type>DR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>G</Code_Type>
    </Bank_Route_Code>
    </Bank>
    - <Account>
    <Account_ID>D202</Account_ID>
    </Account>
    </Bank_Account>
    - <Bank_Account>
    <Bank_Account_Type>CR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>G</Code_Type>
    - <Code>
    - <![CDATA[ 234543
      ]]>
    </Code>
    </Bank_Route_Code>
    - <Bank_Address_Info>
    - <Name>
    - <![CDATA[
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[
      ]]>
    </Street2>
    - <City>
    - <![CDATA[
      ]]>
    </City>
    <Country />
    </Bank_Address_Info>
    </Bank>
    - <Account>
    - <Account_Number>
    - <![CDATA[ DE65100700000123456789
      ]]>
    </Account_Number>
    - <Account_Address_Info>
    - <Name>
    - <![CDATA[ Test User
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[ Employee Addr1
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[ Employee Addr2
      ]]>
    </Street2>
    - <City>
    - <![CDATA[ Berlin
      ]]>
    </City>
    <Country_Sub_Entity />
    <Postal>1234323</Postal>
    <Country>DE</Country>
    </Account_Address_Info>
    </Account>
    </Bank_Account>
    - <Payment_Details_Or_Addenda>
    - <Details_Text>
    - <![CDATA[ PAY OHRID: 100000888
      ]]>
    </Details_Text>
    </Payment_Details_Or_Addenda>
    - <Comments>
    - <Comment_Text>
    - <![CDATA[ NONE
      ]]>
    </Comment_Text>
    </Comments>
    - <References>
    - <Reference>
    <Reference_Type>FBNF</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ INVOICE 20021101001053
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type />
    - <Reference_Value>
    - <![CDATA[
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type>FMAILEN</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ [email protected]
      ]]>
    </Reference_Value>
    </Reference>
    </References>
    </Transaction>
    + <Transaction>
    <Transaction_Type>FT_TRANS_IMP</Transaction_Type>
    + <Transaction_Header>
    <Record_Number>3</Record_Number>
    <Urgent>N</Urgent>
    </Transaction_Header>
    + <Model_Info>
    - <Model_ID>
    - <![CDATA[ FF INTL EXT PAY
      ]]>
    </Model_ID>
    </Model_Info>
    + <Transfer_Info>
    <Charges>15</Charges>
    </Transfer_Info>
    + <Amounts>
    + <Transaction_Amount>
    <Amount>265.00</Amount>
    <Currency>EUR</Currency>
    </Transaction_Amount>
    </Amounts>
    + <Dates>
    <Trusted_Source>N</Trusted_Source>
    <Value_Date />
    </Dates>
    + <Bank_Account>
    <Bank_Account_Type>DR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>S</Code_Type>
    </Bank_Route_Code>
    </Bank>
    - <Account>
    <Account_ID>D202</Account_ID>
    </Account>
    </Bank_Account>
    + <Bank_Account>
    <Bank_Account_Type>CR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>S</Code_Type>
    - <Code>
    - <![CDATA[
      ]]>
    </Code>
    </Bank_Route_Code>
    + <Bank_Address_Info>
    - <Name>
    - <![CDATA[
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[
      ]]>
    </Street2>
    - <City>
    - <![CDATA[
      ]]>
    </City>
    <Country />
    </Bank_Address_Info>
    </Bank>
    + <Account>
    - <Account_Number>
    - <![CDATA[ NL02ABNA0123456789
      ]]>
    </Account_Number>
    - <Account_Address_Info>
    - <Name>
    - <![CDATA[ New User
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[ Employee Addr1
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[ Employee Addr2
      ]]>
    </Street2>
    - <City>
    - <![CDATA[ Ansterdam
      ]]>
    </City>
    <Country_Sub_Entity />
    <Postal>34242</Postal>
    <Country>NL</Country>
    </Account_Address_Info>
    </Account>
    </Bank_Account>
    + <Payment_Details_Or_Addenda>
    - <Details_Text>
    - <![CDATA[ PAY OHRID: 100000777
      ]]>
    </Details_Text>
    </Payment_Details_Or_Addenda>
    + <Comments>
    + <Comment_Text>
    - <![CDATA[ NONE
      ]]>
    </Comment_Text>
    </Comments>
    + <References>
    + <Reference>
    <Reference_Type>FBNF</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ INVOICE 20021101001025
      ]]>
    </Reference_Value>
    </Reference>
    + <Reference>
    <Reference_Type />
    - <Reference_Value>
    - <![CDATA[
      ]]>
    </Reference_Value>
    </Reference>
    + <Reference>
    <Reference_Type>FMAILEN</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ [email protected]
      ]]>
    </Reference_Value>
    </Reference>
    </References>
    </Transaction>
    + <Transaction>
    <Transaction_Type>FT_TRANS_IMP</Transaction_Type>
    - <Transaction_Header>
    <Record_Number>4</Record_Number>
    <Urgent>N</Urgent>
    </Transaction_Header>
    - <Model_Info>
    - <Model_ID>
    - <![CDATA[ FF INTL EXT PAY
      ]]>
    </Model_ID>
    </Model_Info>
    - <Transfer_Info>
    <Charges>15</Charges>
    </Transfer_Info>
    - <Amounts>
    - <Transaction_Amount>
    <Amount>34.70</Amount>
    <Currency>EUR</Currency>
    </Transaction_Amount>
    </Amounts>
    - <Dates>
    <Trusted_Source>N</Trusted_Source>
    <Value_Date />
    </Dates>
    - <Bank_Account>
    <Bank_Account_Type>DR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>S</Code_Type>
    </Bank_Route_Code>
    </Bank>
    - <Account>
    <Account_ID>D202</Account_ID>
    </Account>
    </Bank_Account>
    - <Bank_Account>
    <Bank_Account_Type>CR</Bank_Account_Type>
    - <Bank>
    - <Bank_Route_Code>
    <Code_Type>S</Code_Type>
    - <Code>
    - <![CDATA[
      ]]>
    </Code>
    </Bank_Route_Code>
    - <Bank_Address_Info>
    - <Name>
    - <![CDATA[
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[
      ]]>
    </Street2>
    - <City>
    - <![CDATA[
      ]]>
    </City>
    <Country />
    </Bank_Address_Info>
    </Bank>
    - <Account>
    - <Account_Number>
    - <![CDATA[ FR313000400828000123456789
      ]]>
    </Account_Number>
    - <Account_Address_Info>
    - <Name>
    - <![CDATA[ French User
      ]]>
    </Name>
    - <Street1>
    - <![CDATA[ Employee Addr1
      ]]>
    </Street1>
    - <Street2>
    - <![CDATA[ Employee Addr2
      ]]>
    </Street2>
    - <City>
    - <![CDATA[ Paris
      ]]>
    </City>
    <Country_Sub_Entity />
    <Postal>54333</Postal>
    <Country>FR</Country>
    </Account_Address_Info>
    </Account>
    </Bank_Account>
    - <Payment_Details_Or_Addenda>
    - <Details_Text>
    - <![CDATA[ PAY OHRID: 100000666
      ]]>
    </Details_Text>
    </Payment_Details_Or_Addenda>
    - <Comments>
    - <Comment_Text>
    - <![CDATA[ NONE
      ]]>
    </Comment_Text>
    </Comments>
    - <References>
    - <Reference>
    <Reference_Type>FBNF</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ INVOICE 20021101001481
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type />
    - <Reference_Value>
    - <![CDATA[
      ]]>
    </Reference_Value>
    </Reference>
    - <Reference>
    <Reference_Type>FMAILEN</Reference_Type>
    - <Reference_Value>
    - <![CDATA[ [email protected]
      ]]>
    </Reference_Value>
    </Reference>
    </References>
    </Transaction>
    - <File_Trailer_Record>
    <File_Name>ETNL_TRAVELR_PAYMENTS</File_Name>
    <Total_Records>4</Total_Records>
    </File_Trailer_Record>
    </File>
    regards
    Ramashankar Sahu

    As I recall from my 8i days (it's been many years), the only way to do this is to install the XML XDK. From http://www.oracle.com/technology/tech/xml/xdk/xdk_java.html, it says "The Oracle9i versions of the XDK can also be used to build applications designed to interface with Oracle8i databases." I had thought the 10g version could do that as well but I'm not seeing it now.
    Since XMLType was not part of 8i, you will need to use PL/SQL to take your Select statement results and build them into a DOMDocument structure.
    Hope that helps.

  • Nested XML from recordset problems.

    Hi
    I have been struggling with this for a while now and desperatley need som help!
    I'm trying to create a nested spryregion that looks like this:'
    http://www.soulkompetens.se/utbildningar.php#
    Problem with that page is that it only works in Safari (mac). Firefox the encoding does not work (questionmarks instead of åäö).
    Windows explorer does not work at all .
    So I started to work wit the http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html page to try to generate the xml.
    The XML should be something like:
    <DOCUMENT>
      <ROW0>
        <UTBILDNING_ID>22</UTBILDNING_ID>
        <RUBRIK>Värdegrunden som bas för affärsutveckling</RUBRIK>
        <ROW1>
          <INGRESS>Värdegrunden som bas för affärsutveckling, diskrimineringsgrunderna</INGRESS>
          <ID>17</ID>
         <TEXT></TEXT>
          <DATUM>0000-00-00</DATUM>
        </ROW1>
        <ROW1>
          <INGRESS>Västra Götaland 3:e september</INGRESS>
          <ID>34</ID>
          <TEXT></TEXT>
          <DATUM>2009-06-21</DATUM>
        </ROW1>
      </ROW0>
      <ROW0>
        <UTBILDNING_ID>25</UTBILDNING_ID>
        <RUBRIK>Omvärldsanalys</RUBRIK>
        <ROW1>
          <INGRESS>Mellersta Norrland 11:e december</INGRESS>
          <ID>35</ID>
          <TEXT></TEXT>
          <DATUM>0000-00-00</DATUM>
        </ROW1>
    </ROW0>
    </DOCUMENT>
    I get the XML from two joined Tables in the database.
    Sql looks like:
    select utbildning_rubrik.utbildning_id, utbildning_rubrik.rubrik, utbildning.ingress, utbildning.ID, utbildning.text, utbildning.datum
    from utbildning_rubrik, utbildning where utbildning_rubrik.utbildning_id = utbildning.utbildning_id
    order by utbildning_rubrik.utbildning_id, utbildning.ingress
    Now! How do I generate the XML with "query to xml".
    I have been trying a lot of things an my head is spinning around
    Can anybody help me please.
    Regards
    Olle

    Thank you for the answer.
    I think I am close. But there is something wrong wit the nesting of the nodes and repeating.
    Here is the code:
    <?php
    mysql_select_db($database_SOUL, $SOUL);
    $query_rsImages = "SELECT utbildning_rubrik.utbildning_id, utbildning_rubrik.rubrik, utbildning.ingress, utbildning.ID, utbildning.text, utbildning.datum FROM utbildning_rubrik, utbildning WHERE utbildning_rubrik.utbildning_id = utbildning.utbildning_id ORDER BY utbildning_rubrik.utbildning_id, utbildning.ingress";
    $rsImages = mysql_query($query_rsImages, $SOUL) or die(mysql_error());
    $row_rsImages = mysql_fetch_assoc($rsImages);
    $totalRows_rsImages = mysql_num_rows($rsImages);
    // Send the headers
    header('Content-type: text/xml');
    header('Pragma: public');       
    header('Cache-control: private');
    <?php echo('<?xml version="1.0" encoding="ISO-8859-1"?>'); ?>
    <DOCUMENT>
      <?php if ($totalRows_rsImages > 0) { // Show if recordset not empty ?>
        <ROW0>
        <UTBILDNING_ID><?php echo $row_rsImages['utbildning_id']; ?></UTBILDNING_ID>
        <?php do { ?><RUBRIK><?php echo $row_rsImages['rubrik']; ?>
      <ROW1>
            <?php do { ?><INGRESS><?php echo $row_rsImages['ingress']; ?></INGRESS>
            <TEXT><![CDATA[<?php echo $row_rsImages['text']; ?>]]></TEXT><?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
            </ROW1>
            </RUBRIK><?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
            </ROW0>
       <?php } // Show if recordset not empty ?>
    </DOCUMENT>
    In the other php document consuming the xml I have
    ds1.setColumnType("RUBRIK", "html");
    So the main problem with this is I dont know php so good that I can repeat the nodes to my choise.
    I neew it to be
    ROW0>
      <UTBILDNING_ID></UTBILDNING_ID>
      <RUBRIK></RUBRIK>
      <ROW1>
        <INGRESS></INGRESS>
        <TEXT></TEXT>
        <DATUM>/DATUM>
      </ROW1>
      <ROW1>
        <INGRESS></INGRESS>
        <TEXT></TEXT>
        <DATUM></DATUM>
      </ROW1>
    </ROW0>
    <ROW0>
      <UTBILDNING_ID></UTBILDNING_ID>
      <RUBRIK></RUBRIK>
      <ROW1>
        <INGRESS></INGRESS>
       <ID></ID>
        <TEXT></TEXT>
        <DATUM></DATUM>
      </ROW1>
      </ROW1>
    </ROW0>
    Can you help?
    Regards
    Olle

Maybe you are looking for

  • Photo sharing (over the network with Bonjour) doesnt support Events!

    Hi, When i use iPhoto '08 it can't share the new events groups.. I have to place them in a album to few them on other computers. Otherwise i have i have to scroll down through many albums to find the desired picutres. Why split them in events then? P

  • Flex 4.5 Build Times

    We are building a Flex 4.5 application using the pure MVC framework.  We use the Apache Subversion SVN server for source code control (and ant for building).  When we do a build of the project the build time can vary between 30 seconds and 15 minutes

  • What means '404 not found' and what can I do?

    when I open firefox I get this. Then I tryed explorer and the same happened. I can not surf on the internet. I only get some adresses in the balk.

  • Deleting a radio button from View for ESS

    Hi, I have imported ess~us and created a project on local machine. On the first screen of W2 reprint, I want to remove a radio button Intercompany mail. When I navigated to the Dictionaries> local dictionary> data type > simple type> delivery method

  • Boost M2 slot to 256G and install OS there. Any issues u530 Touch

    I want to install a 256 SSD in the M2 slot and move the OS and most of my programs there leaving the HD for large files (video and images)  I am making the following assumptions.  Please let me know if I left something out.  Pre install - Moved many