Load nested XML into table

Hello, could anyone help me on this? I have a XML file as below:
<Feed>
<svc>enr1</svc>
<report_email>[email protected]</report_email>
<requisition id="12">
<email>[email protected]</email>
<Name>Joseph</Name>
<PRODUCT>
     <PROD_ID>532343234</PROD_ID>
     <NAME>KID'S WEAR </NAME>
     <DATE_ORDERED>09/04/2009</DATE_ORDERED>
</PRODUCT>
<PRODUCT>
     <PROD_ID>67045434</PROD_ID>
     <NAME>SHOES</NAME>
     <DATE_ORDERED>09/04/2009</DATE_ORDERED>
</PRODUCT>
</requisition>
<requisition id="13">
<email>[email protected]</email>
<Name>Sarah</Name>
<PRODUCT>
     <PROD_ID>11111111</PROD_ID>
     <NAME>LOST IN FOREST</NAME>
     <DATE_ORDERED>10/05/2008</DATE_ORDERED>
</PRODUCT>
<PRODUCT>
     <PROD_ID>222222222</PROD_ID>
     <NAME>TRY IT NOW</NAME>
     <DATE_ORDERED>09/04/2007</DATE_ORDERED>
</PRODUCT>
</requisition>
</Feed>

You could flatten the XML into table style output using XMLTABLE...
WITH t as (select XMLTYPE('
<RECSET>
  <REC>
    <COUNTRY>1</COUNTRY>
    <POINT>1800</POINT>
    <USER_INFO>
      <USER_ID>1</USER_ID>
      <TARGET>28</TARGET>
      <STATE>6</STATE>
      <TASK>12</TASK>
    </USER_INFO>
    <USER_INFO>
      <USER_ID>5</USER_ID>
      <TARGET>19</TARGET>
      <STATE>1</STATE>
      <TASK>90</TASK>
    </USER_INFO>
  </REC>
  <REC>
    <COUNTRY>2</COUNTRY>
    <POINT>2400</POINT>
    <USER_INFO>
      <USER_ID>3</USER_ID>
      <TARGET>14</TARGET>
      <STATE>7</STATE>
      <TASK>5</TASK>
    </USER_INFO>
  </REC>
</RECSET>') as xml from dual)
-- END OF TEST DATA
select x.country, x.point, y.user_id, y.target, y.state, y.task
from t
    ,XMLTABLE('/RECSET/REC'
              PASSING t.xml
              COLUMNS country NUMBER PATH '/REC/COUNTRY'
                     ,point   NUMBER PATH '/REC/POINT'
                     ,user_info XMLTYPE PATH '/REC/*'
             ) x
    ,XMLTABLE('/USER_INFO'
              PASSING x.user_info
              COLUMNS user_id NUMBER PATH '/USER_INFO/USER_ID'
                     ,target  NUMBER PATH '/USER_INFO/TARGET'
                     ,state   NUMBER PATH '/USER_INFO/STATE'
                     ,task    NUMBER PATH '/USER_INFO/TASK'
             ) y
   COUNTRY      POINT    USER_ID     TARGET      STATE       TASK
         1       1800          1         28          6         12
         1       1800          5         19          1         90
         2       2400          3         14          7          5Or you could shread the XML into Oracle nested tables...
e.g.
(Based on response from mdrake on this thread: Re: XML file processing into oracle
Reading XML using a schema...
declare
  SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
  XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
        <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
        <xs:complexType name="groupType" xdb:maintainDOM="false">
                <xs:sequence>
                        <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="id" type="xs:byte" use="required"/>
        </xs:complexType>
        <xs:complexType name="itemType" xdb:maintainDOM="false">
                <xs:simpleContent>
                        <xs:extension base="xs:string">
                                <xs:attribute name="id" type="xs:short" use="required"/>
                                <xs:attribute name="name" type="xs:string" use="required"/>
                        </xs:extension>
                </xs:simpleContent>
        </xs:complexType>
        <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                <xs:sequence>
                        <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="cust_id" type="xs:short" use="required"/>
        </xs:complexType>
     </xs:schema>';
  INSTANCE  CLOB :=
'<cust_order cust_id="12345">
  <group id="1">
    <item id="1" name="Standard Mouse">100</item>
    <item id="2" name="Keyboard">100</item>
    <item id="3" name="Memory Module 2Gb">200</item>
    <item id="4" name="Processor 3Ghz">25</item>
    <item id="5" name="Processor 2.4Ghz">75</item>
  </group>
  <group id="2">
    <item id="1" name="Graphics Tablet">15</item>
    <item id="2" name="Keyboard">15</item>
    <item id="3" name="Memory Module 4Gb">15</item>
    <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
  </group>
  <group id="3">
    <item id="1" name="Optical Mouse">5</item>
    <item id="2" name="Ergo Keyboard">5</item>
    <item id="3" name="Memory Module 2Gb">10</item>
    <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
    <item id="5" name="Dual Output Graphics Card">5</item>
    <item id="6" name="28inch LED Monitor">10</item>
    <item id="7" name="Webcam">5</item>
    <item id="8" name="A3 1200dpi Laser Printer">2</item>
  </group>
</cust_order>';                
begin
  dbms_xmlschema.registerSchema
     schemaurl       => SCHEMAURL
    ,schemadoc       => XMLSCHEMA
    ,local           => TRUE
    ,genTypes        => TRUE
    ,genBean         => FALSE
    ,genTables       => TRUE
    ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
  execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
end;
desc CUST_ORDER_TBL
SQL> desc CUST_ORDER_TBL
Name                                                                                                                                    Null?    Type
TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
set autotrace on explain
set pages 60 lines 164 heading on
col cust_id format a8
select extract(object_value,'/cust_order/@cust_id') as cust_id
      ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
from   CUST_ORDER_TBL
      ,XMLTABLE('/cust_order/group'
                passing object_value
                columns id   number       path '@id'
                       ,item xmltype      path 'item'
               ) grp
      ,XMLTABLE('/item'
                passing grp.item
                columns id   number       path '@id'
                       ,inm  varchar2(30) path '@name'
                       ,qty  number       path '.'
               ) itm
CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
12345             1          1 Standard Mouse                        100
12345             1          2 Keyboard                              100
12345             1          3 Memory Module 2Gb                     200
12345             1          4 Processor 3Ghz                         25
12345             1          5 Processor 2.4Ghz                       75
12345             2          1 Graphics Tablet                        15
12345             2          2 Keyboard                               15
12345             2          3 Memory Module 4Gb                      15
12345             2          4 Processor Quad Core 2.8Ghz             15
12345             3          1 Optical Mouse                           5
12345             3          2 Ergo Keyboard                           5
12345             3          3 Memory Module 2Gb                      10
12345             3          4 Processor Dual Core 2.4Ghz              5
12345             3          5 Dual Output Graphics Card               5
12345             3          6 28inch LED Monitor                     10
12345             3          7 Webcam                                  5
12345             3          8 A3 1200dpi Laser Printer                2
17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
On 10.2.0.1:
Execution Plan
Plan hash value: 3741473841
| Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
|   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
|   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
|   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
|*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
|   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
Predicate Information (identified by operation id):
   4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       filter("SYS_NC_TYPEID$" IS NOT NULL)
Note
   - dynamic sampling used for this statementOn 10.2.0.3:
Execution Plan
Plan hash value: 1048233240
| Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
|   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
|   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
|   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
|   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
|*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
|*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
|*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
   6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
              w5Ysl6x9w=="."SYS_NC0000600007$")
       filter("SYS_NC_TYPEID$" IS NOT NULL AND
              "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
   7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
              w5Ysl6x9w=="."SYS_NC0000600007$")
Note
   - dynamic sampling used for this statementCLEAN UP...
DROP TABLE CUST_ORDER_TBL purge;
exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

Similar Messages

  • How to load a XML into Checkpoint in UFT API using custom code

    I am automating a webservice using UFT-12. In which I am trying to load a xml into the checkpoint at run time. but I am not able to find out a way of doing it.Can any1 help me on this?

    @piyu_sh_arm 
    ‎Thank you for using HP Support Forum. I have brought your issue to the appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publicly post ( serial numbers and case details).
    If you are unfamiliar with the Forum's private messaging please click here to learn more.
    Thank you,
    Omar
    I Work for HP

  • Load XML into Table

    Hi All,
    I want to create a procedure in which , I provide table name and XML file location, The procedure goes at that location and pick XML file and load in to the table. Can this is possible ??
    Thanks
    Best Regards,
    Adil

    The following code very interesting.
    DROP TABLE TBL_TEST
    CREATE TABLE "TBL_TEST"
    (     "N" NUMBER,
    "V" VARCHAR2(20),
         "D" DATE)
    CREATE OR REPLACE DIRECTORY XML_DIR AS 'C:\XMLDIR';
    CREATE OR REPLACE
    PROCEDURE INSERT_XML_TBL_TEST(p_directory in varchar2,
    p_filename in varchar2)
    --p_tableName in varchar2 DEFAULT 'TBL_TEST')
    AS
    insCtx DBMS_XMLSTORE.CTXTYPE;
    rows NUMBER;
    xmlDoc CLOB := null;
    BEGIN
    if (dbms_xdb.existsResource('/public/'||lower(p_filename))) then
    dbms_xdb.deleteResource('/public/'||lower(p_filename));
    end if;
    v_return := DBMS_XDB.CREATERESOURCE(abspath => '/public/'||lower(p_filename),
    data => BFILENAME(UPPER(p_directory),LOWER(p_filename)));
    COMMIT;
    SELECT RV.RES.GETCLOBVAL()
    INTO xmldoc
    FROM RESOURCE_VIEW RV WHERE ANY_PATH = '/public/'||lower(p_filename);
    insCtx := DBMS_XMLSTORE.newcontext('TBL_TEST');
    dbms_xmlstore.SetRowTag(insctx,'TBL_TEST_ROW');
    dbms_xmlstore.clearkeycolumnlist(insctx);
    dbms_xmlstore.setupdatecolumn(insctx,'N');
    dbms_xmlstore.setupdatecolumn(insctx,'V');
    dbms_xmlstore.setupdatecolumn(insctx,'D');
    rows := dbms_xmlstore.insertxml(insctx, xmldoc);
    dbms_output.put_line(rows ||' rows inserted');
    dbms_xmlstore.closecontext(insctx);
    END;
    select * from tbl_test
    begin
    INSERT_XML_TBL_TEST('XML_DIR','tbl_test.xml');
    end;
    and I created XMLDIR folder on C:\
    and there have a xml file name is tbl_test.xml and content this file is
    <TBL_TEST_ROWSET>
    <TBL_TEST_ROW num="1">
    <N>11</N>
    <V>Testing 11</V>
    </TBL_TEST_ROW>
    <TBL_TEST_ROW num="2">
    <N>10</N>
    <V>Testing 11</V>
    </TBL_TEST_ROW>
    </TBL_TEST_ROWSET>
    Mahir M. Quluzade
    Edited by: Mahir M. Quluzade on Nov 24, 2010 11:47 AM

  • XML into table: Why do all my insert values are NULL?

    Hello,
    I'm pretty new in XML ... then I still learn a lot by myself !!!
    I surfed to a lot of forums and examples ....
    I have a XML file. I built a XSL file in order to insert a part of my XML file into a table.
    The 2 files are loaded as CLOB into a DB table.
    I wrote a PLSQL procedure for this job.
    We are on a DB 10gR2.
    As a result, all the inserted columns are loaded with NULL !!!! ....
    I must have done something wrong ... for sure !!! but I cannot figure out.
    Here are the files and procedures:
    *<?xml version="1.0" ?>*
    *<purchaseOrder orderDate="1999-10-20">*
    *<shipTo country="US">*
    *<name>Alice Smith</name>*
    *<street>123 Maple Street</street>*
    *<city>Mill Valley</city>*
    *<state>CA</state>*
    *<zip>90952</zip>*
    *</shipTo>*
    *<billTo country="US">*
    *<name>Robert Smith</name>*
    *<street>8 Oak Avenue</street>*
    *<city>Old Town</city>*
    *<state>PA</state>*
    *<zip>95819</zip>*
    *</billTo>*
    *<comment>Hurry, my lawn is going wild!</comment>*
    *<items>*
    *<item partNum="872-AA">*
    *<productName>Lawnmower</productName>*
    *<quantity>1</quantity>*
    *<USPrice>148.95</USPrice>*
    *<comment>Confirm this is electric</comment>*
    *</item>*
    *<item partNum="926-AA">*
    *<productName>Baby Monitor</productName>*
    *<quantity>1</quantity>*
    *<USPrice>39.98</USPrice>*
    *<shipDate>1999-05-21</shipDate>*
    *</item>*
    *</items>*
    *</purchaseOrder>*
    The XLS file is :
    *<?xml version="1.0"?>*
    *<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">*
    *<xsl:output method="xml" media-type="text/xml" />*
    *<xsl:template match="/">*
    *<insert>*
    *<Table>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_club'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<Columns>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_code'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_name'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_price'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *</Columns>*
    *<xsl:for-each select="purchaseOrder/items">*
    *<Rowset>*
    *<xsl:for-each select="item">*
    *<Row>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_code'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="@partNum" />*
    *<!--layer=Default-->*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_name'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="productName" />*
    *<!--layer=Default-->*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_price'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="USPrice" />*
    *<!--layer=Default-->*
    *</Column>*
    *</Row>*
    *</xsl:for-each>*
    *<!--layer=Default-->*
    *</Rowset>*
    *</xsl:for-each>*
    *<!--layer=Default-->*
    *</Table>*
    *</insert>*
    *</xsl:template>*
    *</xsl:stylesheet>*
    *<!--xsl-easyControl - (C) 2003-2007 SoftProject GmbH-->*
    *<!--Source: "purchaseOrder_clubDev.xml"|Type:"xml"-->*
    *<!--Destination: "Connexion_XSL_SCFOX.xac"|Type:"Connexion_XSL_SCFOX"-->*
    *<!--Document type: Input Driven-->*
    The XML files are successfully inserted into a CLOB colum :
    ID FILENAME XML
    24 item_club.xsl <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.or
    25 purchaseOrder.xml <?xml version="1.0" ?> <purchaseOrder orderDate="1999-10-20">
    And the procedure is :
    CREATE OR REPLACE PROCEDURE load_xml( p_dir IN VARCHAR2
    , p_filename IN VARCHAR2) AS
    insCtx DBMS_XMLSave.ctxType;
    rows NUMBER;
    l_bfile BFILE := BFILENAME(p_dir, p_filename);
    l_clob CLOB;
    l_bfile_xsl BFILE;
    l_clob_xsl CLOB;
    begin
         dbms_output.put_line('p_filename='||p_filename);
         insCtx := DBMS_XMLSave.newContext('sipmo.item_club'); -- get the save context..!
         dbms_output.put_line('item_club.xsl context='||insCtx);
         --IMPORTANT... ignore la casse
         DBMS_XMLSave.setIgnoreCase(insCtx, 1);
         --select XSL file item_club.xsl
    l_bfile_xsl := BFILENAME(p_dir, 'item_club.xsl');
         DBMS_LOB.createtemporary (l_clob_xsl, TRUE);
         DBMS_LOB.fileopen( l_bfile_xsl, DBMS_LOB.file_readonly);
         DBMS_LOB.loadfromfile( l_clob_xsl, l_bfile_xsl, DBMS_LOB.getlength(l_bfile_xsl));
         dbms_output.put_line('item_club.xsl length='||DBMS_LOB.getlength(l_bfile_xsl));
         DBMS_LOB.fileclose(l_bfile_xsl);
         DBMS_XMLSave.SETXSLT(insCtx, l_clob_xsl);
         dbms_output.put_line('step 10');
         DBMS_XMLSave.clearUpdateColumnList(insCtx); -- clear the update settings
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_CODE');
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_NAME');
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_PRICE');
         -- Now insert into the table
         dbms_output.put_line('step 90');
         rows := DBMS_XMLSave.insertXML(insCtx, l_clob);
         dbms_output.put_line('step 100 rows='||rows);
         DBMS_XMLSave.closeContext(insCtx);
         DBMS_LOB.freetemporary (l_clob_xsl);
         DBMS_LOB.freetemporary (l_clob);
    END;
    The result table is like this :
    scfx>select * from item_club;
    ITEM_CODE ITEM_NAME ITEM_PRICE
    All the columns of each row are NULL !!!
    Why?
    Do you have any advice ?
    Thanks if advance,
    Olivier

    So, if I understand what you mean ... I should write something like this :
         insert into item_club
              select t2.partnum, t2.productname, to_number(replace(t2.usprice, '.', ','))
              from odab_xml_tab t
              , xmltable('*' passing t.xml.extract('purchaseOrder/items/*')
              columns partNum varchar2(35) path '@partNum'
              , productName varchar2(35) path 'productName'
              , USPrice varchar2(35) path 'USPrice'
              ) t2
    Its a change in our code.. but that looks nice !!!
    Thanks,
    Olivier

  • Loading Large XML into Oracle Database

    Hi,
    I am fairly new to XML DB. I have been successful in registering a schema to a table in the Database. Now, I have to load the appropriate XML into that table. I am using the Simple Bulk Loader program found on this oracle site, however, when I load my XML file I get the following error: ORA-21700: object does not exist or is marked for delete.
    So, I figured maybe simple bulk loader cannot handle large files? So I reduced my XML file and loaded it with the program and it worked. However, does anyone know how I can load large files into my registered schema table.
    Thanks,
    Prerna :o)

    Did you specify genTables true or false when registering the XML Schema ?
    Does you XML schema contain a recursive definition
    Is it possible that after reducing the size of the document you no longer have nodes that contain recursive structures...

  • Load external XML into DataGrid with AS3

    I've really looked hard to find an example/tutorial for
    loading external XML data into a DataGrid component using AS3. The
    code I'm using at the moment has the XML data in the AS code. If
    anyone can point me to a good resource(s) for code or a tutorial
    I'd be very appreciative. It needs to be AS3. ~steve
    Here is the code that is working for internal XML data:
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.data.DataProvider;
    stop();
    var emailXML:XML = <emails>
    <email date="06-04-07" code="EMRPAAV" campaign="This is
    the campaign details."/>
    <email date="06-11-07" code="EMRPAAW" campaign="This is
    the campaign details."/>
    <email date="06-18-07" code="EMRPAAX" campaign="This is
    the campaign details."/>
    <email date="06-25-07" code="EMRPAAY" campaign="This is
    the campaign details."/>
    <email date="07-02-07" code="EMRPAAZ" campaign="This is
    the campaign details."/>
    <email date="07-09-07" code="EMRPABA" campaign="This is
    the campaign details."/>
    </emails>;
    var dateCol:DataGridColumn = new DataGridColumn("date");
    dateCol.headerText = "Date";
    dateCol.width = 60;
    var codeCol:DataGridColumn = new DataGridColumn("code");
    codeCol.headerText = "Source Code";
    codeCol.width = 70;
    var campaignCol:DataGridColumn = new
    DataGridColumn("campaign");
    campaignCol.headerText = "Campaign";
    campaignCol.width = 300;
    var myDP:DataProvider = new DataProvider(emailXML);
    emailData.columns = [dateCol, codeCol, campaignCol];
    emailData.width = 440;
    emailData.dataProvider = myDP;
    emailData.rowCount = emailData.length;
    // end code

    Here is how you build it for external XML. in my example am
    using the same xml format that you are using . The xml file called
    "dataGrid.xml"
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.data.DataProvider;
    import fl.containers.UILoader;
    import fl.data.DataProvider;
    import fl.events.*;
    import flash.xml.*;
    var emailXML:XML;
    var myList:XMLList;
    function parseXML():void
    var url:String = "dataGrid.xml";
    var urlRequest:URLRequest = new URLRequest(url);
    var loader:URLLoader = new URLLoader();
    loader.addEventListener("complete" , loadXML);
    loader.load(urlRequest);
    /*var emailXML:XML = <emails>
    <email date="06-04-07" code="EMRPAAV" campaign="This is
    the campaign details."/>
    <email date="06-11-07" code="EMRPAAW" campaign="This is
    the campaign details."/>
    <email date="06-18-07" code="EMRPAAX" campaign="This is
    the campaign details."/>
    <email date="06-25-07" code="EMRPAAY" campaign="This is
    the campaign details."/>
    <email date="07-02-07" code="EMRPAAZ" campaign="This is
    the campaign details."/>
    <email date="07-09-07" code="EMRPABA" campaign="This is
    the campaign details."/>
    </emails>
    parseXML();
    function loadXML(evt:Event):void
    emailXML = new XML(evt.target.data);
    myDP = new DataProvider(emailXML);
    emailData.dataProvider = myDP;
    var dateCol:DataGridColumn = new DataGridColumn("date");
    dateCol.headerText = "Date";
    dateCol.width = 60;
    var codeCol:DataGridColumn = new DataGridColumn("code");
    codeCol.headerText = "Source Code";
    codeCol.width = 70;
    var campaignCol:DataGridColumn = new
    DataGridColumn("campaign");
    campaignCol.headerText = "Campaign";
    campaignCol.width = 300;
    var myDP:DataProvider;
    emailData.columns = [dateCol, codeCol, campaignCol];
    emailData.width = 440;
    emailData.dataProvider = myDP;
    emailData.rowCount = emailData.length;

  • Interface to get inbond XML into tables

    We have Oracle 7.3 and HP-UX. We have a requirement to get XML from client and get the data into our tables.
    I think we need to install Oracle XDK and parse the XML and put it in Oracle using JDBC.
    I need to know which version of XDK I should install in HP-UX/Oracle 7.3?
    Can anyone provide a sample code to insert data from XML to tables?
    We have a standard XML with data in tags. No attributes.

    We have Oracle 7.3 and HP-UX. We have a requirement to get XML from client and get the data into our tables.
    I think we need to install Oracle XDK and parse the XML and put it in Oracle using JDBC.
    I need to know which version of XDK I should install in HP-UX/Oracle 7.3?
    Can anyone provide a sample code to insert data from XML to tables?
    We have a standard XML with data in tags. No attributes.

  • How to load external XML into DataGrid ??

    Hello ,everybody , I can't load external Xml like this format
    <list>
    <month name="Jan-04" revenue="400263" average="80052">
    <region name="APAC" revenue="46130"/>
    <region name="Europe" revenue="106976"/>
    <region name="Japan" revenue="79554"/>
    <region name="Latin America" revenue="39252"/>
    <region name="North America" revenue="128351"/>
    </month>
    <month name="Feb-04" revenue="379145" average="75829">
    <region name="APAC" revenue="70324"/>
    <region name="Europe" revenue="88912"/>
    <region name="Japan" revenue="69677"/>
    <region name="Latin America" revenue="59428"/>
    <region name="North America" revenue="90804"/>
    </month>
    </list>
    I only can load with node format like this :
    <order>
    <item>
    <menuName>burger</menuName>
    <price>3.95</price>
    </item>
    <item>
    <menuName>fries</menuName>
    <price>1.45</price>
    </item>
    </order>
    Please tell me what am I going to do?
    Thanks!

    I'm stuck on this as well. I've read through the above
    samples and postings and am now feeling really retarded. I thought
    throwing the contents of a simple XML doc into a DataGrid would be
    easy, but I've been trying all morning and no love. Any help is
    appreciated.
    Here the XML --> guides.xml
    <?xml version="1.0" encoding="UTF-8">
    <GuideList title="Current Guides">
    <GuideItem>
    <GuideName>11699240</GuideName>
    <DisplayName>Supercharged Branding
    Program</DisplayName>
    <LinkText>View Downloadable Guide</LinkText>
    <Franchise>Film/TV</Franchise>
    <Property>Cars</Property>
    </GuideItem>
    <GuideItem>
    <GuideName>11721503</GuideName>
    <DisplayName> Packaging & Retail
    Signage</DisplayName>
    <LinkText>View Downloadable Guide</LinkText>
    <Franchise>Film/TV</Franchise>
    <Property>None</Property>
    </GuideItem>
    etc....
    Here's the flex --> GuideListDisplay.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" initialize="guidelist.send()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable] private var myData:ArrayCollection;
    private function resultHandler(event:ResultEvent):void {
    myData = event.result.GuideList.GuideItem;
    ]]>
    </mx:Script>
    <mx:HTTPService id="guidelist" url="assets/guides.xml"
    result="resultHandler(event)"/>
    <mx:Panel title="{myData.GuideList.title}"> // 1119
    <mx:DataGrid x="29" y="36" id="Guides"
    dataProvider="{myData.lastresult.GuideList.GuideItem}"> // 1119
    <mx:columns>
    <mx:DataGridColumn headerText="Guide Number"
    dataField="GuideName"/>
    <mx:DataGridColumn headerText="Guide Name"
    dataField="DisplayName"/>
    <mx:DataGridColumn headerText="DisplayText"
    dataField="LinkText"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    The lines throw with // 1119 throw a problem notice - 1119:
    Access of possibly undefined property GuideList through a reference
    with static type mx.collections:ArrayCollection.
    GuideListDisplay.mxml Lessons line 17 March 21, 2007 12:53:45 PM
    215
    Please help before hari kari looks like a good option.
    Thanks!

  • How do you load external XML into a dataProvider?

    I have been looking through the docs and have found a couple
    of entries discussing how to load external XML. Unfortunately, that
    is where the example stops and there is no example of doing
    anything useful with that data.
    I have managed thus far to get my XML file loaded into
    actionscript/flex:
    function getExternalXML():void {
    request = new URLRequest('source.xml');
    loader = new URLLoader();
    loader.load(request);
    loader.addEventListener("complete", loadXML);
    function loadXML(e:Event):void {
    combo.dataProvider = loader.data;
    obviously, the above doesn't work at all. I don't know how to
    convert the loader.data into a format that the
    ComboBox.dataProvider understands. I can't believe I have to write
    a function to parse this XML. Surely there must be a way to simply
    convert the XML to an array or something???

    That link uses the flex beta 3 docs. You may want to use the
    current livedocs.
    Here
    is a direct link to the section I was talking about.
    Scroll down about halfway to the part that says "However,
    using a raw data object..."
    If you want the PDFs (easier to read IMO) you can get them
    here.
    Here
    is a direct link to the Developer's Guide:

  • Nested XML into comboBox

    Well as stupid as this sounds I can populate a datagrid from
    a dynamic xml source(ASP) using HTTPservice but a basic lack of
    understanding is preventing me from using this data in a comboBox
    Below is my application source that works for populating the
    datagrid in it, but when the data is used in the comboBox as it's
    dataprovider the value is "[object][object]" Ive tried a bunch of
    stuff but I think im conceptualy misunderstanding something about
    retreiving nested values...
    --MY BROKEN EXAMPLE---
    --XML-output-by-asp-document--------
    <product>
    <category>Tile</category>
    <name>Angelic Peach</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Cosmo</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Durva</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Isosilis</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Magaloth</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Trunklin</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Googolfletch</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Moskurbelf</name>
    </product>
    <product>
    <category>Tile</category>
    <name>DoChoaKoa</name>
    </product>
    ---products-component-for-use-in-main-application---
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="400" height="300"
    creationComplete="this.productStream.send();">
    <mx:Script>
    <![CDATA[
    import mx.utils.ArrayUtil;
    import mx.utils.XMLUtil
    //var urlPath="
    http://localhost/rogerwilko/AndeanStone/xml.asp";
    function xmlRequest():void {
    // Cancel all previous pending calls.
    productStream.cancel();
    var params:Object = new Object();
    params.func = 'products';
    productStream.send(params);
    ]]>
    </mx:Script>
    <mx:HTTPService id="productStream"
    url="
    http://localhost/rogerwilko/AndeanStone/xml.asp"/>
    <mx:Label text="Select A Product Category" top="0"
    left="0"/>
    <mx:ComboBox id="prodCatList"
    dataProvider="{mx.utils.ArrayUtil.toArray(this.productStream.lastResult.product)}"
    width="200" left="0" top="20" cornerRadius="3" fillAlphas="[0.5,
    0.5]" themeColor="#00ff00" alpha="0.49">
    </mx:ComboBox>
    <mx:DataGrid id="prodList"
    dataProvider="{mx.utils.ArrayUtil.toArray(this.productStream.lastResult.product)}"
    columnWidth="200" width="200" left="0" top="55">
    <mx:columns>
    <mx:DataGridColumn headerText="{prodCatList.value}"
    dataField="name"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>
    Thanks in advance for any help you can provide me
    leo

    You will need to specify either a labelField or
    labelFunction. You can use a labelField if the value you want to
    show in the combo box is a first level property of the item.
    If the data you want to display is deeper in the item object,
    and you need to "dot down" to get it use a labelFunction.
    HTTPService resultFormat defaults to Object. I have never
    been comfortable about the way Flex converts xml into objects, so I
    always use e4x. This choice affects the structure of your item
    objects, and therefore the way you need to access the item objects
    properties.
    Try labelField, anif that doesn't work use a labelFunction.
    Note, you can debug the labelFunction quite handily.
    Tracy

  • XSLT to convert XML into Tables

    Hi,
    I'm trying to import my XML data into a table format. After adding an XSL file to my Structure Application as a Preprocessing Stylesheet, and importing my XML instance file with the Template file opened, the "Unknown File Type" error window appeared asking for a file format to Convert From. Picking any one doesn't create a table.
    The XSL file tranforms the XML data into an HTML file that has a table with columns corresponding to the XML data. I was thinking using that type of XSL because it renders tables.
    Below is the XSL markup:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html>
      <body>
      <h2>Products</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>Title</th>
            <th>Number</th>
            <th>Date</th>
          </tr>
          <xsl:for-each select="Products/Product">
          <tr>
            <td><xsl:value-of select="Title"/></td>
            <td><xsl:value-of select="Number"/></td>
            <td><xsl:value-of select="Date"/></td>
          </tr>
          </xsl:for-each>
        </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    Title, Number, and Date are child elements of the Product element, which is a child element of the Products root element in my XML file.
    Am I applying the stylesheet correctly here? Am I using the write kind of stylesheet?
    Thanks,
    zeb

    Hi Michael, Van,
    Thank you for responding to my post. Your feedback was very helpful!
    I was able to get the table to generate in FrameMaker but no data from the XML file is flowing into it. All that appears is the header row with "Title," "Number," and "Date" in the cells, and a row with blank cells underneath it. The Structure View pane has a red "<no value>" for the "Cols" and "Widths" attributes of the Table element. Only the Title column is affected by the width value.
    The XSL, RW, and EDD files are as a follows: (The structure for the XML is a "Products" root element with mulitple "Product" child elements that each have a "Title," "Name," "Date" child element.)
    ==========================XSL==================
    <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" doctype-system="products_DTD3.dtd" />
    <xsl:template match="/">
    <products>
    <Table cols="3" width="150">
    <TableHeading>
        <TableRow>
            <TableCell>Title</TableCell>
            <TableCell>Number</TableCell>
            <TableCell>Date</TableCell>
        </TableRow>
    </TableHeading>
    <TableBody>
    <TableRow>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Title"/></xsl:for-each></TableCell>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Number"/></xsl:for-each></TableCell>
    <TableCell><xsl:for-each select="Products/Product"><xsl:value-of select="Date"/></xsl:for-each></TableCell>
    </TableRow>
    </TableBody>
    </Table>
    </products>
    </xsl:template>
    </xsl:stylesheet>
    ==========================EDD==================
    Element (Container): products
    General rule:    Table
    Valid as the highest-level element.
    Element (Table): Table
    General rule:    TableHeading,TableBody
    Attribute list
    Name: cols     String     Required
    Name: width     String     Required
    Element (Table Heading): TableHeading
    General rule:    TableRow
    Element (Table Row): TableRow
    General rule:    TableCell+
    Element (Table Cell): TableCell
    General rule:    <TEXT>
    Element (Table Body): TableBody
    General rule:    TableRow
    ==========================RW===================
    fm version is "10.0";
    element "Table" {
      is fm table element;
      attribute "cols" is fm property columns;
      attribute "width" is fm property column widths;
    element "TableRow" is fm table row element;
    element "TableHeading" is fm table heading element;
    element "TableBody" is fm table body element;
    element "TableCell" is fm table cell element;
    ===============================================
    I'm having trouble placing the "<xsl:for-each select="Products/Product">" tag in the XSL file. When I put it under  TRow, FrameMaker  gives an error that "TRow is not a valid for content (TCell)+". Only when I place it within the TCell tags (as I have above) does the above-mentioned Table with a Header row and a row with empty cells generate.
    Is the XSL the problem here?
    Thanks,
    Zeb

  • How to load blob data into table

    hi
    i have a table with
    ID     NUMBER     No     -      1
    PARENT_ID     NUMBER     No     -      -
    DOCUMENT     BLOB     Yes     -      -
    NAME     VARCHAR2(40)     Yes     -      -
    MIMETYPE     VARCHAR2(40)     Yes     -      -
    COMMENTS     VARCHAR2(400)     Yes     -      -
    TIMESTAMP_CREATED     TIMESTAMP(6)     Yes     -      -
    CREATED_BY     VARCHAR2(40)     Yes     -      -
    TIMESTAMP_MODIFIED     TIMESTAMP(6)     Yes     -      -
    MODIFIED_BY     CHAR(40)     Yes     -      -
    IS_GROUP     CHAR(1)     No     -      -
    FILE_NAME     VARCHAR2(4000)     Yes     -      -
    as columns. i want to insert blob data into the empty table.i have some fields in the form through which i insert data by hard coding in a process.when i upload a document in the filebrowse type field the mime type is not updating though i have written code in the source value. i removed the database links of the form with the table and that is why i am hard coding to the table thru a process. could u suggest a query where i can insert the blolb data.
    i use the process
    begin
    select max(ID) into aaa from "PSA_KNOWLEDGE_TREE";
    insert into PSA_KNOWLEDGE_TREE values(aaa+1,1,null,:p126_NEW_GROUP,null,:p126_COMMENTS,:P126_TIMESTAMP_CREATED,:P126_CREATED_BY,null,null,'Y',null);

    could u please type the query according to my table and process requirements. i have tried many queries and i have failed to load the blob data. the imetype is not being updated.
    thnx for ur reply

  • Batch load images (tiff) into table with a BLOB column

    Hi,
    Does anyone know any third-party tool/software to bulk/batch load images into Oracle table? There is an ETL software to regularly pull the images (tiff) from a ftp server to a directory in the database server. There is no way I can hardcode the image filenames into the control file and use SQL*Loader to load the files. Is there any tool/software that can just grab whatever files in the directory and load them into Oracle. Then, I can write a program to extract the filename from the file already loaded into the table and update the filename column.
    Thanks.
    Andy

    sound like simple scripting to me...
    -- SQL loader example
    http://www.orafaq.com/wiki/SQL%2ALoader_FAQ#How_does_one_use_SQL.2ALoader_to_load_images.2C_sound_clips_and_documents.3F
    -- dynamically build control file
    devuser1:/tmp>>touch image1.gif
    devuser1:/tmp>>touch image2.jpg
    devuser1:/tmp>>touch image3.jpg
    devuser1:/tmp>>ls -l image*
    -rw-rw-r--   1 devuser1   mygrp           0 Jul 10 11:19 image1.gif
    -rw-rw-r--   1 devuser1   mygrp           0 Jul 10 11:19 image2.jpg
    -rw-rw-r--   1 devuser1   mygrp           0 Jul 10 11:19 image3.jpg
    devuser1:/tmp>>ls -l image* | awk '{ print NR "," $9}'
    1,image1.gif
    2,image2.jpg
    3,image3.jpg
    devuser1:/tmp>>echo "LOAD DATA" > t.ctl
    devuser1:/tmp>>echo "INFILE *" >> t.ctl
    devuser1:/tmp>>echo "..." >> t.ctl
    devuser1:/tmp>>echo "BEGINDATA" >> t.ctl
    devuser1:/tmp>>ls -l image* | awk '{ print NR "," $9}' >> t.ctl
    devuser1:/tmp>>cat t.ctl
    LOAD DATA
    INFILE *
    BEGINDATA
    1,image1.gif
    2,image2.jpg
    3,image3.jpgEdited by: maceyah on Jul 10, 2009 12:42 PM

  • SQL* Loader to load data format into tables??????

    Hi,
    Hai I am very much new to Oracle. I am trying to load data into a table using SQL*Loader and i getting error while it is using the data format.
    the format used in data file is "Sep 6 2001 12:00:00:000AM"
    and when i used to_date( :accountDate, 'YYYY-MM-DD HH:MI:SS AM or PM') function it throws me an exception like
    "ORA-01821: date format not recognized". so anybody can help me to insert data with out changing the data file, whould be really helpfull
    thanks
    vijay

    Also it looks like you need to change your date format mask.
    If your data is formatted as "Sep 6 2001 12:00:00:000AM"
    then you should use to_date( :accountDate, 'Mon DD YYYY HH:MI:SSAM')
    This will work with a two digit second field, but not a three digit second field.

  • Make DB application users load bulkdata(.CSV) into tables from Application.

    I have created an Apex application which has report and form pages.
    my application allows the user to add a record/ update an existing record through form page.
    but in 1 scenario every day my user gets arround 500 records in .csv files. Its hectic for him to upload each record 1 by 1.
    please help me out how to make him load bulk data(.csv) into the tables(reports) from the application itself. I meant to ask, what changes should i make in the application as a developer in order to fulfill this requirement and how ?

    Hi,
    These links might help build solution
    http://dbswh.webhop.net/dbswh/f?p=BLOG:READ:0::::ARTICLE:11000346061523
    http://dbswh.webhop.net/dbswh/f?p=BLOG:READ:0::::ARTICLE:126300346812330
    Regards,
    Jari

Maybe you are looking for

  • Safari doesn't open website fully unless CMD R (force refresh)

    Hello Everyone, Headteacher isn't happy that for some reason Safari  will not open images at the top of this website unless I hit CMD R. Doesn't work with the normal refresh/reload button. It works fine in Chrome and Firefox.  Site is http://www.lowe

  • Why does my Mozilla Support password suddenly fail to work?

    I tried to sign in to Mozilla Support to ask a question about Thunderbird that I could find no answer to elsewhere. I was denied. I verified my user name and password from the list I carefully keep on a flash drive and tried again. No go. Then I aske

  • Too slow on internal references (InD CS6 [8.0.1] on OSX 10.7.5, 3.4GHz iMac with 16GB memory)

    I'm making a 400-page book in the latest version of InDesign. Other books of similar length present no problems, but this particular book has huge numbers of internal references. For example, it says "see page xx for more information," and I'm specif

  • Pls help me with this program - urgent

    Hi, I am new to Java. First time to do the program. Stuck here. The description of the program: Implement a complex number (numbers of the form a+ib, where i2 = -1, i2 is i raised to power 2 ). Recall that a complex number consists of a real part (a)

  • Ubuntu Problem in Pavillion dv6 3208-tx Notebook PC

    I own an HP dv6 3208-tx Notebook PC. I installed Ubuntu 11.04 recently and I'm facing the following problem. From the bootloader, when I select Ubuntu, it doesn't load. It gets stuck at a black screen without any cursor. If I go to Windows and turn o