Extraction of XML data

Hello

I have a requirement to extract data from XML and insert in a custom table.

XML structure is

< A >

< Column1 >

< Column2 >

< Column3 >

< Column4 >

< column > 5

< A >

< A1 >

< Column1 >

< Column2 >

< Column3 >

< Column4 >

< column > 5

< A1 >

.

.

.

.

< a >

< Column1 >

< Column2 >

< Column3 >

< Column4 >

< column > 5

< a >


I need to extract all the values in the column and insert it into a custom table.

Number of nodes one will increase every day, and columns can be of the order of 50-100.


With the help of EXTRACTVALUE and bulk collect I m doing this process, but taking almost 2 hours for the processing of 3000 records.


Please let me know is there better way (in terms of performance) to extract XML data?


Thank you

Kumar.

Why the node is called as A1, A2... One? Why can it not be Just A? Here's an example of how to represent XML report and analyzed data to a relational structure.

SQL> with t
  2  as
  3  (
  4  select xmltype
  5         (
  6  '
  7      
  8           1
  9           ram
 10           01-01-2016
 11           10000
 12      
 13      
 14           2
 15           karthick
 16           01-01-2016
 17           10000
 18      
 19      
 20           3
 21           subha
 22           01-01-2016
 23           10000
 24      
 25      
 26           4
 27           vimal
 28           01-01-2016
 29           10000
 30      
 31      
 32           5
 33           vijay
 34           01-01-2016
 35           10000
 36      
 37  
' 38 ) xmldata 39 from dual 40 ) 41 select t1.* 42 from t 43 , xmltable 44 ( 45 '/table/row' passing xmldata 46 columns 47 empno number path 'empno', 48 ename varchar2(10) path 'ename', 49 doj varchar2(10) path 'doj', 50 sal number path 'sal' 51 ) t1; EMPNO ENAME DOJ SAL ---------- ---------- ---------- ---------- 1 ram 01-01-2016 10000 2 karthick 01-01-2016 10000 3 subha 01-01-2016 10000 4 vimal 01-01-2016 10000 5 vijay 01-01-2016 10000

Tags: Database

Similar Questions

  • Extraction of XML data and display new line

    I have a table named, SAPDATABROWSER, which has several columns and lines. A column named SAPTEXT (data type: CLOB) consist of xml data. Each XML data are different in terms of number of nodes, but has the same following structure:

    < SAP_BAPI_PROP >
    < SelectedProperty >
    < structure >
    < field > < / field >
    < length > < / length >
    < FieldValue > < / FieldValue >
    < type > < / Type >
    < priority > < / priority >
    < / structure >
    < / SelectedProperty >
    < / SAP_BAPI_PROP >

    So now, what I would do is, to extract the values: field, FieldValue and the length of each line (total 72) and see the result as follows.

    Length of track FieldValue
    XXXX YYYY ZZZZ
    PPPP QQQQ RRRR
    AAAA BBBB CCCC
    MMMM OOOO NNNN

    Again, each line (total 72) has several XML Data nodes, IE there are several nodes FieldType, length and field and no two XML data/line are similar!

    I use the following code:

    SELECT
    EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Field / text () ');
    EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Length / text () ');
    EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/FieldValue / text () ')
    OF sapdatabrowser;

    The code above produces the following result:

    SAP_BAPI_PROP/.../Field/Text () SAP_BAPI_PROP/.../Length/text () SAP_BAPI_PROP/.../FieldValue/text)
    1 XXXXPPPPAAAA YYYYQQQQBBBB ZZZZRRRRCCCC
    2 MMMM OOOO NNNN


    Any suggestions? Thank you very much. :)

    Based on your sample data:

    SQL> select x.*
      2  from sapdatabrowser t
      3     , xmltable(
      4         '/SAP_BAPI_PROP/SelectedProperty/Structure'
      5         passing xmltype(t.saptext)
      6         columns field_name  varchar2(30) path 'Field'
      7               , field_len   varchar2(30) path 'Length'
      8               , field_val   varchar2(30) path 'FieldValue'
      9       ) x
     10  ;
    
    FIELD_NAME                     FIELD_LEN                      FIELD_VAL
    ------------------------------ ------------------------------ ------------------------------
    X                              Y                              Z
    P                              Q                              R
    A                              B                              C
    M                              N                              O
     
    

    (adjust the projected if necessary data types)

  • How to extract an XML data that have different namespace prefixes?

    Hello

    I have inserted XMLs in an XMLTYPE column which are based on a common XSD that allows different namespaces.

    How can I extract some data from these XMLs using extractvalue when will be preceded different namespaces for this node?

    Thank you and best regards,
    A

    Hello

    You can use XPath:

    //*[local-name()="node_name"]
    

    For example:

    with t as (
     select xmltype(
     '
      mark
      del
     '
     ) doc
     from dual union all
     select xmltype(
     '
      john
      mum
     '
     )
     from dual
    )
    select extractvalue(t.doc,'//*[local-name()="name"]') as name,
           extractvalue(t.doc,'//*[local-name()="place"]') as place
    from t;
    

    or,

    with t as (
     select xmltype(
     '
      mark
      del
     '
     ) doc
     from dual union all
     select xmltype(
     '
      john
      mum
     '
     )
     from dual
    )
    select x.*
    from t, XMLTable(
    '
     {
      element name { //*[local-name()="name"] },
      element place { //*[local-name()="place"] }
     }
     '
    passing t.doc
    columns
     place varchar2(30) path 'place',
     name  varchar2(30) path 'name'
    ) x;
    
  • How to extract my XML data

    {color: #800000} Dear friends,
    It's kind of a matter of newbie on XML queries. Our DotNet developers send documents to xml by CLOB column. So I want to extract data from an xml file
    Please help me...

    I will wait for the response

    Title Description
    --------------------------------
    Project Title01
    Title02 demo
    Title03 test


    Is this possible...? {color}
    It's xml content:

    "& lt; NewDataSet & gt;
    & lt; Schema id = "NewDataSet" xmlns = "" xmlns: XS = "http://www.w3.org/2001/XMLSchema" xmlns:msdata = "urn: schemas-microsoft-com: xml-msdata"& gt;
    & lt; xs: element name = "NewDataSet" msdata:IsDataSet = "true" msdata:MainDataTable = "planAddfield" msdata:UseCurrentLocale = "true" & gt;
    & lt; complexType & gt;
    & lt; xs: Choice minOccurs = "0" maxOccurs = "unbounded" & gt;
    & lt; xs: element name = "planAddfield" & gt;
    & lt; complexType & gt;
    & lt; xs: Sequence & gt;
    & lt; xs: element name = "Sno" type = "xs: int" minOccurs = "0" / & gt;
    & lt; xs: element name = "Title" type = "xs: String" minOccurs = "0" / & gt;
    & lt; xs: element name = "Description" type = "xs: String" minOccurs = "0" / & gt;
    & lt; xs: element name = "Flag" type = "xs: int" minOccurs = "0" / & gt;
    & lt; / xs: Sequence & gt;
    & lt; / xs: complexType & gt;
    & lt; / xs: ELEMENT & gt;
    & lt; / xs: Choice & gt;
    & lt; / xs: complexType & gt;
    & lt; / xs: ELEMENT & gt;
    & lt; / xs: Schema & gt;
    & lt; planAddfield & gt;
    & lt; SNO & gt; 0 & lt; / Sno & gt;
    & lt; Title & gt; Title01 & lt; / title & gt;
    & lt; Description & gt; project & lt; / Description & gt;
    & lt; Flag & gt; 0 & lt; / flag & gt;
    & lt; / planAddfield & gt;
    & lt; planAddfield & gt;
    & lt; SNO & gt; 0 & lt; / Sno & gt;
    & lt; Title & gt; Title02 & lt; / title & gt;
    & lt; Description & gt; Demo & lt; / Description & gt;
    & lt; Flag & gt; 0 & lt; / flag & gt;
    & lt; / planAddfield & gt;
    & lt; planAddfield & gt;
    & lt; SNO & gt; 0 & lt; / Sno & gt;
    & lt; Title & gt; Title03 & lt; / title & gt;
    & lt; Description & gt; test & lt; / Description & gt;
    & lt; Flag & gt; 0 & lt; / flag & gt;
    & lt; / planAddfield & gt;
    & lt; / NewDataSet & gt; »

    Hello
    This will make...

    DECLARE
        x   XMLTYPE := XMLTYPE('
        
            
                
                    
                        
                            
                                
                                    
                                    
                                    
                                    
                                
                        
                        
                    
                
            
        
        
            0
            Title01
            project
            0
        
        
            0
            Title02
              demo
              0
         
         
              0
              Title03
              test
              0
         
    ');
    BEGIN
        FOR i IN ( SELECT  EXTRACTVALUE(VALUE(t), '/planAddfield/Title') title,
                           EXTRACTVALUE(VALUE(t), '/planAddfield/Description') description
                    FROM TABLE(XMLSEQUENCE(x.EXTRACT('NewDataSet/planAddfield'))) t)
        LOOP
            dbms_output.put_line('Title : ' || i.title ||','||'Description :'||i.description);
        END LOOP;
    END;
    

    See you soon,.
    Kadoch

  • extract data from blob field containing xml data big

    I'm working on Oracle 11 g 2, 11.0.2.0.3. UNIX database server.

    my oracle instance receive large xml data service web ftp, I put this file as blob in a table called TBL_ALERT_XML (ID_ALERT NUMBER, DATE of the TIMESTAMP_ALERT, ALERT_XML BLOB).

    My goal is to get data of BLOB content e file put in one or more other tables.

    I try with the opening of a cursor on

    SELECT XMLTYPE (UTL_RAW.cast_to_varchar2 (ALERT_XML)). Extract (' alerts/points/point / / Text () ') threads

    OF TBL_ALERT_XML

    without any filter on ID_ALERT.

    But I get the error:

    ORA-22835: buffer too small for to CHAR CLOB or BLOB to RAW conversion



    Please help me, thank you very much

    Because the web service is deployed in python and my co worker is not able to call a stored procedure with the parameter xmltype, but only with the setting of the BLOB.

    If you can't get around it, so be it. All the less, using CLOB would be better.

    However, which prevents you to convert BLOB XMLType entry within the stored procedure and store it in an XMLType column.

    To do this, simply use the XMLType of BLOB.

    create table tbl_alert_xml)

    number of id_alert

    date of timestamp_alert

    alert_xml xmltype

    );

    insert into tbl_alert_xml

    values)

    1

    sysdate

    xmltype (p_blob

    , nls_charset_id ('AL32UTF8') - put the encoding of the file here

    )

    );

    Then, you will be able to execute queries optimized using XMLTABLE.

  • extract xml data in the collection

    Hello

    I want to extract xml data in a collection of collection


    could any body you tell me if we succeed in sql
    ex:

    declare
    type t_code is table of number;
    type r_rec is record (c_name varchar2 (100),)
    c_code vrachar2 (100),
    c_code_number t_code);
    type t_rec is the table of the r_rec;

    l_xml xmltype: = xmltype (')

    < body >
    <>campaign
    < code > < code > CAMP_1
    < description > Campaign_1 < / description >
    < rateplans >
    < rateplanCode > 1 < / rateplanCode >
    < rateplanCode > 2 < / rateplanCode >
    < rateplanCode > 3 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_2
    < description > Campaign_2 < / description >
    < rateplans >
    < > 11 rateplanCode < / rateplanCode >
    < > 22 rateplanCode < / rateplanCode >
    < rateplanCode > 33 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_3
    < description > Campaign_3 < / description >
    < rateplans >
    < > 111 rateplanCode < / rateplanCode >
    < > 222 rateplanCode < / rateplanCode >
    < > 333 rateplanCode < / rateplanCode >
    < / rateplans >
    < / campaign >
    < result >
    < > 00 resultCode < / resultCode >
    < resultText > success < / resultText >
    < / result >
    (< / body > ');

    Start

    Select / * logic exrat value of xml in the final collection * /.
    Double;

    end;

    I want data in the model in my final collection t_rec

    CAMP_1, Campaign_1, nested_table (1,2,3)
    CAMP_2, Campaign_2, nested_table (11,22,33)
    CAMP_3, Campaign_3, nested_table (111,222,333)

    Published by: 948596 on May 17, 2013 05:17

    Like this

    SQL> declare
      2       type t_code is table of number ;
      3       type r_rec is record
      4       (
      5          c_name varchar2(100),
      6          c_code varchar2(100),
      7          c_code_number t_code
      8       );
      9       type t_rec is table of r_rec ;
     10       l_rec t_rec := t_rec();
     11       l_xml xmltype := xmltype
     12                        ('
     13                           
     14                           
     15                           CAMP_1
     16                           Campaign_1
     17                           
     18                           1
     19                           2
     20                           3
     21                           
     22                           
     23                           
     24                           CAMP_2
     25                           Campaign_2
     26                           
     27                           11
     28                           22
     29                           33
     30                           
     31                           
     32                           
     33                           CAMP_3
     34                           Campaign_3
     35                           
     36                           111
     37                           222
     38                           333
     39                           
     40                           
     41                           
     42                           00
     43                           Success
     44                           
     45                           '
     46                        ) ;
     47  begin
     48       for i in (
     49                 select rownum id
     50                      , t1.code
     51                      , t1.description
     52                      , t2.rate_plan_code
     53                      , row_number() over(partition by t1.code order by t2.rate_plan_code) rno
     54                   from xmltable
     55                        (
     56                             '/body/campaign' passing l_xml
     57                             columns
     58                               code        varchar2(100) path 'code',
     59                               description varchar2(100) path 'description',
     60                               rate_plans  xmltype       path 'rateplans'
     61                        ) t1
     62                      , xmltable
     63                        (
     64                             '/rateplans/rateplanCode' passing t1.rate_plans
     65                             columns
     66                               rate_plan_code varchar2(100) path '.'
     67                        ) t2
     68                )
     69       loop
     70            if i.rno = 1 then
     71               l_rec.extend;
     72               l_rec(l_rec.count).c_name := i.description;
     73               l_rec(l_rec.count).c_code := i.code;
     74               l_rec(l_rec.count).c_code_number := t_code();
     75            end if;
     76            l_rec(l_rec.count).c_code_number.extend;
     77            l_rec(l_rec.count).c_code_number(i.rno) := i.rate_plan_code;
     78       end loop;
     79       for i in 1..l_rec.count
     80       loop
     81          dbms_output.put_line(l_rec(i).c_code || '  ' || l_rec(i).c_name);
     82          for j in 1..l_rec(i).c_code_number.count
     83          loop
     84             dbms_output.put_line(l_rec(i).c_code_number(j));
     85          end loop;
     86       end loop;
     87  end;
     88  /
    CAMP_1  Campaign_1
    1
    2
    3
    CAMP_2  Campaign_2
    11
    22
    33
    CAMP_3  Campaign_3
    111
    222
    333
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Using EXTRACT XML data extraction

    Hi, I have a XML file where I want to analyze the fields in a table in DB:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < FIXML > < batch > < MktDataFull BizDt = '2012-07-13' > < Instrmt Sym = "JCPRXU" ID = "JCPRXU" Desc = "JCP.SR. XR. «USD"SecTyp ="CD"Src ="H"subtype = MMY" S "="201209"MatDt = ' 2012-09-20" Mult = Exch "0.01" = "CMD" UOM = "CTL" UOMCcy = "USD" UOMQty = "1" PxUOM = "IPNT" ValMeth = "CD" CpnRt = "1.0" IntAcrl = ' 2012-06-20 ' CpnPmt = ' 2012-09-20 ' NotnlPctOut = "100.0" Snrty = 'SR' RstrctTyp = 'XR' DayCntMeth = "ACT/360" tenor = "0 M" > < DITTA HELP = "US708130AC31" AltIDSrc = "105" / > < HELP AltID = "JCP.SR." "" ""» XR. USD.12U.100"AltIDSrc ="101"/ > < HELP DITTA = '1 201209 JCPRXU' AltIDSrc = 'H' / > < DITTA HELP ="1 201209 JCPRXU"AltIDSrc ="100"/ > < Evnt EventTyp ="5"Dt ="2008-09-19"/ > < Evnt EventTyp = '7' Dt = '2012-09-19' / > < Evnt EventTyp ="19"Dt ="2012-10-05"/ > < Evnt EventTyp ="100"Dt ="2012-07-16"/ > < Evnt EventTyp = '8' Dt ="2012-07-14"/ > < Evnt EventTyp = '9' Dt = '2012-09-20' / > < Evnt EventTyp ="101"Dt = '2012-03-20' / > < Evnt EventTyp ="102"Dt ="2008-09-20"/ > < Evnt EventTyp = « 103 » Dt = « 2008-09-22 » / >< Evnt EventTyp = « 104 » Dt = « 2012-09-19 » / >< Evnt EventTyp = « 111 » Dt = « 2012-09-20 » / >< Evnt EventTyp = « 112 » Dt = « 2012-06-20 » / >< Evnt EventTyp = « 113 » Dt = « 2012-03-20 » / >< Evnt EventTyp = « 114 » Dt = « 2012-07-12 » / >< Evnt EventTyp = « 115 » Dt = « 2012-07-16 » / >< / Instrmt >< complet Typ = « 6 » Px = Mkt « 99.7433368 » = « CMD » QCond = « 6 » PxTyp = « 1 » OpenClsSettlFlag = « 1 » >< / Full >< complet Typ = « 6 » Px = « 234.5254 » Mkt = QCond « CMD » = « 6 » PxTyp = « 6 » ' OpenClsSettlFlag = '1' > < / Full > < full Typ = "Y" Px = Mkt "40.0" = 'CMD' PxTyp = '1' OpenClsSettlFlag = '1' > < / Full > < full Typ = '6' Px = "234.5212" Mkt = QCond 'CMD' = '7' PxTyp = '6' OpenClsSettlFlag = '1' > < / Full > < full Typ = Mkt "B" = 'CMD' OpenClsSettlFlag = '4' Sz = '0' > < / Full > < full type = 'C' Mkt = 'CMD' OpenClsSettlFlag = '4' Sz = '0' > < / Full > < full Typ = 'z' Px = Mkt '0.18' = 'CMD' PxTyp = '1' OpenClsSettlFlag = '1 '. > < / full > < full Typ = 'y' Px = "0.1899965" Mkt = QCond 'CMD' = '6' PxTyp = '5' OpenClsSettlFlag = '1' > < / Full > < InstrmtExt > < Attrb Typ = '100' Val = '24' / > < Attrb Typ = '101' Val = '0' / > < Attrb Typ = '109' Val = '0' / > < Attrb Typ = '103' Val = '24' / > < Attrb Typ = '102' Val = '24' / > < Attrb Typ = '110' Val = '3' / > < Attrb Typ = '29' Val = 'Y' / > < Attrb Typ = '112' Val = 'Y ' /. > < / InstrmtExt > < / MktDataFull > < / batch > < / FIXML >


    Right now, I'm just trying to extract the first 3 fields, BizDt, Bal and id I use to analyze the following:


    SELECT
    Extract (value (p), '/BizDt') .getStringVal () AS DATE_,.
    Extract (value (p), ' /Instrmt/Sym').getStringVal (AS SYMBOL),)
    Extract (value (p), ' /Instrmt/ID').getStringVal () AS ID_)

    OF s TABLE_NAME.
    TABLE (XMLSEQUENCE (Extract (xmlType.createXml (s.CDS_CLOB), ' FIXML/batch/MktDataFull / *'))) p
    WHERE s.ID_ = 1

    But I get nothing back. My guess is the because the XML data does not have opening tags and formal closing, because if I change my XML like this:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < FIXML > < batch > < MktDataFull > < BizDt > 2012 - 07 - 13 < / BizDt > < Instrmt > < Sym > JCPRXU < / Sym > < ID > JCPRXU < /ID > < Desc > JCP.SR. XR. USD < / Desc > < SecTyp > CD < / SecTyp > < / Instrmt > < / MktDataFull > < / batch > < / FIXML >

    I was able to get the data. Therefore, in order so solve this problem, what should I do with my original XML? Can I format the tags?

    Thank you

    When you nest xsl: for each of the elements, the select expression is evaluated in the context of the enclosing instance.

    Consider this:

    
      
    

    This means you are trying to match items complete as children Instrmt, that is not correct, because they are actually siblings.
    In the same goes for HELP, Evnt etc.

    I don't know what kind of structure you want.
    Caps all does not much sense given that groups of brothers of repeat items that have no apparent correlation between them. Essentially, you end up with a big Cartesian product.

    I would approach this by storing repeated elements in different tables with a parent/child relationship to preserve the hierarchical nature of the data (if necessary).

  • How to extract the party date XML dateTime data type

    Hi all

    I have a problem with the extraction of the date part of the dateTime data type. I am getting my output * 2012-09 - 28 T 21: 49:45 * in this format. I need to extract the date part which is

    * 2012-09-28 * excluding the time. Kindly help me out by doing this. I'm new to the world of xml. Sorry if this question seems to be too stupid, but I'm quite help less.

    Thank you

    What error do you get?

    These two work for me:

    let $myDateTime := xs:dateTime("2012-09-28T21:49:45")
    return {$myDateTime cast as xs:date}
    
    let $myDateTime := xs:dateTime("2012-09-28T21:49:45")
    return {xs:date($myDateTime)}
    
  • How to extract data using the xml data type

    Hello
    I tried the following example using the xml data type, but not the desired output.
    could you please correct the query in order to obtain the necessary
    CREATE TABLE TEST.EMP_DETAIL
    (
      EMPNO       NUMBER,
      ENAME       VARCHAR2(32 BYTE),
      EMPDETAILS  SYS.XMLTYPE
    )
    Insert into EMP_DETAIL
       (EMPNO, ENAME, EMPDETAILS)
     Values
       (7, 'Martin', XMLTYPE('<Dept>
      <Emp Empid="1">
        <EmpName>Kevin</EmpName>
        <Empno>50</Empno>
        <DOJ>20092008</DOJ>
        <Grade>E3</Grade>
        <Sal>3000</Sal>
      </Emp>
      <Emp Empid="2">
        <EmpName>Coster</EmpName>
        <Empno>60</Empno>
        <DOJ>01092008</DOJ>
        <Grade>E1</Grade>
        <Sal>1000</Sal>
      </Emp>
      <Emp Empid="3">
        <EmpName>Samuel</EmpName>
        <Empno>70</Empno>
        <DOJ>10052008</DOJ>
        <Grade>E2</Grade>
        <Sal>2530</Sal>
      </Emp>
      <Emp Empid="4">
        <EmpName>Dev</EmpName>
        <Empno>80</Empno>
        <DOJ>10032007</DOJ>
        <Grade>E2</Grade>
        <Sal>1200</Sal>
      </Emp>
    </Dept>
    '));
    I need to get the record for Empid = '2'
    Then tried the following query with no expected o/p
    SELECT a.empno,a.ename,a.empdetails.extract('//Dept/Emp/EmpName/text()').getStringVal() AS "EmpNAME",
         a.empdetails.extract('//Dept/Emp/Empno/text()').getStringVal() AS "EMPNumber",
          a.empdetails.extract('//Dept/Emp/DOJ/text()').getStringVal() AS "DOJ",
          a.empdetails.extract('//Dept/Emp/Grade/text()').getStringVal() AS "Grade",
          a.empdetails.extract('//Dept/Emp/Sal/text()').getStringVal() AS "Salary",
          a.empdetails.extract('//Dept/Emp[@Empid="2"]').getStringVal() AS "ID",
          a.empdetails.extract('//Dept/Emp[EmpName="Coster"]').getStringVal() AS "CHK"
         FROM emp_detail a 
         where empno=7  
               AND a.empdetails.existsNode('//Dept/Emp[@Empid="2"]') =1
    Thank you...

    Karthick_Arp wrote:
    I'm not very good at that... But if your XML code should not be more like this

    SQL> Insert into EMP_DETAIL
    2     (EMPNO, ENAME, EMPDETAILS)
    3   Values
    4     (7, 'Martin', XMLTYPE('
    5    
    6      1
    7      Kevin
    8      50
    9      20092008
    10      E3
    11      3000
    12    
    .. cut ..
    

    Why? It is perfectly valid to data as attributes rather than elements and also quite common for key values.

  • Loading XML data in ListView of C++ after extraction of http data

    I'm sorry did searh but could not find any refrence related to my problem
    I am trying to load the xml data returned from a web service HTTP Post QNetworkRequest and QNetworkReply in c ++.

    My XML that gets donwloaded is as

    
     http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
      
        tu7652
        F
        Marry
        Wijaya
      
      
        23
        F
        Marry
        Wijaya
      
    
    

    In My QML, it comes to the ListView can say SearchResult.qml

    ListView {
              objectName: "resultlist"
              dataModel: feedsdatamodel
              listItemComponents: [
                ListItemComponent {
                            type: "item"
                            PeopleListItem {
                                name: ListItemData.givenName + ", " + ListItemData.sn
                                role: ListItemData.ExtFunction
                                leftPaddingText: 40
                            }
                        }
               ]
            }
     attachedObjects: [
           // The data model that contains the content of a XML file
            GroupDataModel {
                id: feedsDataModel
                sortingKeys: [
                    "givenName"
                ]
                grouping: ItemGrouping.None
            }
        ]
    

    PeopleListItem.qml

    import bb.cascades 1.0
    
    Container {
        property alias name: titleLabel.text
        property alias role: functionLabel.text
        property alias leftPaddingText: textcontainer.leftPadding
    
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom
        }
        preferredWidth: 768
        preferredHeight: 135
        Container {
    
            id: textcontainer
            topPadding: 10
    
            layout: StackLayout {
                orientation: LayoutOrientation.TopToBottom
            }
            Label {
    
                id: titleLabel
                textStyle.base: SystemDefaults.TextStyles.TitleText
                textStyle.color: Color.Black
            }
            Label {
                id: functionLabel
                textStyle.base: SystemDefaults.TextStyles.BodyText
                textStyle.color: Color.Gray
            }
        }
        Divider {
            verticalAlignment: VerticalAlignment.Bottom
        }
    }
    

    This is the function I'm using to display the QML it is called from main.qml and works correctly.

    void PeopleFinder::onSearchClicked() {
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\t" << "begin";
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\tfname:"
                << m_fname << "\tlname:" << m_lname;
    
        // Create a network access manager and connect a custom slot to its
        // finished signal
        mNetworkAccessManager = new QNetworkAccessManager(this);
    
        // create a data model with sorting keys for lastname and firstname
        Q_ASSERT(
                connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))));
    
        //Load the bew QML file of Search from here
        QmlDocument *qml = QmlDocument::create("asset:///SearchResults.qml").parent(
                this);
        qml->setContextProperty("peoplefinder", this);
    
        Page *mypage = qml->createRootObject();
        qml->setParent(mypage);
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\t s444444";
    
        // Retrieve the activity indicator from QML so that we can start
        // and stop it from C++
    //  mActivityIndicator = mypage->findChild("myIndicator");
    
        // Retrieve the list so we can set the data model on it once
        // we retrieve it
        mListView = mypage->findChild("resultlist");
    
        mNavigator->push(mypage);
    }
    

    Once the page loads in the QML it call the launch request providing c ++ file and once the
    query is completed under function is called with the data. I checked that data are downloaded properly

    void PeopleFinder::requestFinished(QNetworkReply* reply) {
        qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                << "response received";
        // Check the network reply for errors
        if (reply->error() == QNetworkReply::NoError) {
    
            // Open the file and print an error if the file cannot be opened
            qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                    << "No error";
    
            // Write to the file using the reply data and close the file
            QByteArray xml = reply->readAll();
            qDebug() << "Data: \n" << xml;
    
            // load the xml data
            XmlDataAccess xda;
            QVariant list = xda.load(xml, "ArrayOfPeople");
    
            qDebug() << "List:::\n" << list;
    
            GroupDataModel *datamodel = (GroupDataModel*)mListView->dataModel();
            // add the data to the model
            datamodel->clear();
            datamodel->insertList(list.value());
            datamodel->setSortingKeys(QStringList() << "givenName" << "sn");
            qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                    << "Datamodel set size:: " << datamodel->size();
    
            // Set the new data model on the list and stop the activity indicator
    
        } else {
            qDebug() << "\n Problem with the network";
            qDebug() << "\n" << reply->errorString();
        }
    }
    

    But now, the real problem begins as in how to convert QByteArray data type of QVariantList which can be loaded into the datamodel
    I don't want to write the data to the XML file and then pass that as a list his will is very slow, once I move test environment to the production environment.

    Please help me solve this problem

    I got it to work using xml parsing with QXmlStreamReader

  • Extract XML data using XML table NULL recovery

    Hello

    I use XMLtable to recover data using XMLtable

    XML

    "< env:Envelope xmlns:env = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

    < env:Header > < / env:Header >

    < env:Body >

    " < = Xmlns:ns1 CreditBureauResponse ' http://www.example.org "xmlns =" " http://www.example.org ">

    < ns1:Body >

    < ns1:MGResponse > & lt; MGResponse xmlns = "urn: crif - messagegateway:2006 - 08-23" > & lt; U2:AUE_RES xmlns:u2 = "urn: AUE" > & lt; U2:response > & lt; U2:CBApplicationId > 123456789 & lt; / u2:CBApplicationId > & lt; U2:ProviderApplicationNo > 123 & lt; / u2:ProviderApplicationNo > & lt; U2:PreviousPhase > D & lt; / u2:PreviousPhase > & lt; U2:ActualPhase > D & lt; / u2: ActualPhase > & lt; U2:ApplicationDeleted > 0 & lt; / u2:ApplicationDeleted > & lt; / u2:Response > & lt; / u2:AUE_RES > & lt; / MGResponse > < / ns1:MGResponse >

    < / ns1:Body >

    < / CreditBureauResponse >

    < / env:Body >

    "< / env:Envelope >.

    I would like to know where I am going wrong

    SELECT x1.*

    OF tmp_xml_aue t.

    XMLTABLE (XMLNAMESPACES ('http://schemas.xmlsoap.org/soap/envelope/"as"env","http://www.example.org"as 'ns1", default'http://www.example.org'), )

    ' / env:Envelope / env:Body / CreditBureauResponse' T.OBJECT_VALUE by the WAY

    columns MGRESPONSE xmltype PATH "ns1:Body/ns1:MGResponse/text()") X 1,

    XMLTABLE (XMLNAMESPACES ("urn: crif - messagegateway:2006 - 08-23' as"v1", default" urn: AUE' '), ' / MGResponse/AUE_RES ' PASSAGE xmltype (DBMS_XMLGEN.convert (X 1.) MGRESPONSE. GETCLOBVAL(), 1))

    columns CBAPPLICATIONID varchar2 (15) WAY "response/CBApplicationId.

    ) X 2;

    Hello

    I saw your question and I hope that the link below will help you solve your solution:

    https://Oracle-base.com/articles/Misc/XMLTable-query-XML-data-from-SQL

    If there are problems more made me know I'll like you the exact solution for your query.

    Kind regards

    Vinoth.

  • Extract XML data to a text box

    How could I get the XML data a box?

    Course code: (it will not display anything!)

    var dyoXML:XML = new XML();
    dyoXML.ignoreWhite = true;

    dyoXML.onLoad = {function (success)}
    {if (Success)}
    disemail. Text = This;
    }
    }

    dyoXML.load ("http://www.myweb.com/mails.php");

    you not set $fin in your php file.  use:

    $fin = $_POST ['end'];

    to define it.  and you should be specifying the POST method to send data to your php file.  (unless you send end via the query string that you aren't.)

  • Select the XML data

    Dear all,

    Please find a list of the steps done to read the date of conversion of currency by the last final query, that I can be able to obtain the release of the name of the Bank as the Central Bank, but impossible to extract the time, rates, currency of the XML data.

    Please tell us how to solve the problem.

    CREATE TABLE url_tab

    (

    URL_NAME VARCHAR2 (100),

    SYS URL. URIType

    );

    INSERT INTO url_tab VALUES

    ("This is a test URL',

    sys . UriFactory.getUri ("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" "")

    );

    INSERT into xml_data_tab select sys.xmltype.createXML (u.url.getClob ()) in u url_tab;

    Select Bank_name, xt1.* from

    XMLTable (XMLNamespaces (default 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref', ))

                                   ' ( http://www.GESMES.org/XML/2002-08-01 ' as "gesmes"),

    ' / / gesmes:Envelope'

    FROM (select * from xml_data_tab)

    columns

    Path of varchar2 (100) Bank_name ' / gesmes:Envelope / gesmes:Sender / gesmes:name',

    outer join left perv_t XMLTYPE PATH "Cube/Cube")

    XMLTable (XMLNamespaces ('http://www.gesmes.org/xml/2002-08-01' as "gesmes"), )

    "/ / Cube/Cube."

    FROM (select * from xml_data_tab)

    COLUMNS

    path of varchar2 (100) of rate_date "@time"

    path varchar2 (100) coin "@currency."

    path of rate varchar2 (100) '@rate') xt1 on 1 = 1

    its work for me

    SQL > with xml_data_tab like)

    2. Select XMLType)

    3'http://www.gesmes.org/xml/2002-08-01' xmlns ="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" >. "

    4 reference rate

    5

    6 the European Central Bank

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43 ') as the double DATA

    44)

    45 select Bank_name, xt1. RATE_DATE, xt2.*

    XMLTable 46 (XMLNamespaces (default 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref',

    47'http://www.gesmes.org/xml/2002-08-01"as"gesmes"),"

    48 ' / / gesmes:Envelope'

    49 FROM (select * from xml_data_tab)

    50 columns

    51 way of varchar2 (100) of Bank_name ' / gesmes:Envelope / gesmes:Sender / gesmes:name',

    52 perv_t XMLTYPE PATH 'Cube'):

    53 left outer join XMLTable (XMLNamespaces (default 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref'),

    54                         '*'

    55 in PASSING (h.perv_t)

    56 COLUMNS

    path of varchar2 (100) 57 rate_date "Cube/@time."

    58 rate_data XMLType path ' / / Cube/Cube ') xt1 on 1 = 1

    59 left outer join XMLTable (XMLNamespaces (default 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref'),

    60 ' / / cube/Cube/Cube. "

    61 FROM (select * from xml_data_tab)

    62 COLUMNS

    path of VARCHAR2 (3) currency 63 "@currency."

    number 64 path "@rate" rate) xt2 on 1 = 1;

    BANK_NAME RATE_DATE HEART RATE

    ---------------------------------------- ------------------------- --- ----------

    2015 Central Bank European-12-30 US $ 1.0926

    30-12-2015 of the European Central Bank JPY 131.66

    2015 Central Bank European-12-30 BGN 1.9558

    2015 Central Bank European-12-30 CZK 27.029

    30-12-2015 of the European Central Bank DKK 7.4625

    2015 Central Bank European-12-30 GBP.73799

    30-12-2015 of the European Central Bank HUF 313,15

    2015 Central Bank European-12-30 PLN 4.24

    30-12-2015 of the European Central Bank, RON 4.5296

    2015 Central Bank European-12-30 SEK 9.1878

    2015 Central Bank European-12-30 CHF 1.0814

    BANK_NAME RATE_DATE HEART RATE

    ---------------------------------------- ------------------------- --- ----------

    2015 Central Bank European-12-30 NOK 9.616

    30-12-2015 of the European Central Bank 7.637 HRK

    30-12-2015 of the European Central Bank RUB 79.754

    30-12-2015 of the European Central Bank TRY 3.1837

    2015 Central Bank European-12-30 AUD 1.499

    30-12-2015 of the European Central Bank BRL 4.259

    2015 Central Bank European-12-30 CAD 1.5171

    2015 Central Bank European-12-30 CNY 7.091

    2015 Central Bank European-12-30 HKD 8.4685

    30-12-2015 of the European Central Bank IDR 15081.33

    30-12-2015 of the European Central Bank, ILS 4.2606

    BANK_NAME RATE_DATE HEART RATE

    ---------------------------------------- ------------------------- --- ----------

    30-12-2015 of the European Central Bank INR 72.535

    30-12-2015 of the European Central Bank 1284.79 KRW

    2015 Central Bank European-12-30. 18.8867 MXN

    30-12-2015 of the European Central Bank MYR 4.6887

    2015 Central Bank European-12-30 NZD 1.5959

    30-12-2015 of the European Central Bank PHP 51.281

    30-12-2015 of the European Central Bank SGD 1.5449

    2015 Central Bank European-12-30 THB 39.334

    30-12-2015 of the European Central Bank ZAR 16.8847

    31 selected lines.

  • The value of XML data

    Hi all

    I am Oracle 11 g

    I have XML data as below

    < lines >

    < line-diff op = 'delete' line-stat = "oos" >

    < host rank = "targ" >

    < name of col = 'GUID' val = "7932504" / >

    < name of col = 'SCRTY_ROLE_ID' val = '1' / >

    < name of col = hex "GGROWHASH" = "o" val = 'ffffffffffffffff' / >

    < / row >

    < / line-diff >

    < line-diff op = 'delete' line-stat = "oos" >

    < host rank = "targ" >

    < name of col = 'GUID' val = "7933046" / >

    < name of col = 'SCRTY_ROLE_ID' val = '1' / >

    < name of col = hex "GGROWHASH" = "o" val = 'ffffffffffffffff' / >

    < / row >

    < / rows >

    Need to extract value and show as below

    OPERATION GUID SCRTY_ROLE_ID

    Remove 7932504 1

    Remove 7933046 1

    Please help on this.

    Appreciate your help.

    Thank you

    We can somewhat simplify the XQuery for @Gaz in Oz:

    WITH data(text) AS
    (SELECT
            '
                
                   
                      
                      
                      
                   
                
                
                   
                      
                      
                      
                   
                
                
                   
                      
                      
                      
                   
                
         '
    FROM dual
    )
    SELECT r.*
       FROM data x,
            XMLTABLE('rows/row-diff'
                    PASSING XMLTYPE(x.text)
                    COLUMNS operation     VARCHAR2(12) PATH '@op',
                            guid          NUMBER       PATH 'row/col[@name="GUID"]/@val',
                            scrty_role_id NUMBER       PATH 'row/col[@name="SCRTY_ROLE_ID"]/@val'
                   ) r
    ;
    
    OPERATION GUID SCRTY_ROLE_ID

    ------------ ---------- -------------

    delete 7932504 1
    delete 7933046 1
    Update 7933999 1

    3 selected lines.

  • Can I create an XSD from XML data into a CLOB?

    Environment:


    Oracle 11.2.0.3 EE on Solaris.


    Highly an XML newbie so please be nice!

    I spent the past few days pouring through the documentation and various articles, including this one, but... I need help.

    I am trying to extract XML data stored in a CLOB and produce a flat file for the user's consumption.

    They sent me what they think is the XSD for XML data, but when I look at the data in the CLOB I don't see tags in the XSD.

    I would like to produce a XSD based on real data to compare with what they sent.

    Is this possible?

    I am able to query XML data using the tags that I see in data using XMLTable and it works fine.

    Any help is greatly appreciated.

    -gary

    Welcome to the side of the world, where you're going to love it and curse, like any other piece of XML technology.

    So if I understand correctly, the scope of your operation is to extract information from an XML file and then write this information to the disk, correct?

    A few questions

    -Why did the XML stored in a CLOB instead of an XMLType column?  Without knowing the history of the system, it is a pertinent question.

    -What size are the XML?  I ask this question, it is because when the XML is stored in the columns of XMLType (relational structure object or XML BINARY SECUREFILE format), then Oracle can parse the XML much more easily when it is stored as a CLOB.  If the XML is small enough, you can see no difference in performance between the two.

    The Oracle DB itself has no built in the ability to generate a schema from an XML file.  To do this, you need to use a third-party tool that has this feature in.  For example, XML Spy can do.  Other tools as well, but that's what comes to mind first is what I use.  The only thing to remember is that the scheme he built is only an XML instance.  Other XML instances can be different and not valid against the schema you generated, but still valid against the original schema unknown.

    You can save the schema in the database and then use the XML to create an XMLType instance related to the schema and then validate the XML in this way.  An example XML DB FAQ and here's another one Re: validation of XML schema

    Hope that helps you continue.

Maybe you are looking for

  • 'Thotkey' failed

    I suddenly started up the following message to the start-Failed to retrieve the "Thotkey. Error code 0 x 0031402, 0 x 00000002.Can anyone advise me on the corrective measures please.concerningGeraint

  • Group Policy to deploy software will not work on a remote site

    I currently have 3 domain controllers in my environment.  2 (DC1 & DC2) are on my main site (Site A) and 1 (DC3) is on my remote site (Site B).When the network between Site A and B link is down users who connect remote Site B (locally) do not receive

  • Impossible to update the computer, the error 80070643

    I forgot to update my computer for many times. I wonder what the problem with my computer. My computer is already crashed 2 times and I bought it in September 2010. It's windows 7. Can someone help me? Thank you very much. :)

  • Aspire gel mouse/Touchpad V7 - 482PG when connect power cord (Windows 10)

    Greetings, I'm having this strange problem in my V7 after upgrade to Windows 10: When I plug the power cord of the keyboard and the touchpad and mouse gel (I use a Microsoft Bluetooth Mouse and touchpad in my V7 is a Synaptic). -If I unplug the power

  • Restore the default debugger (Windows 7)

    It is a very specific question that applies to all versions of Visual Studio... Whenever you install the suite or Visual C++ on a system, it has its own internal debugger which replaces Dr. Watson by default whenever an application crashes.  This can