Advantages of storing data in XML

Hi --
I am working with Oracle Database for long time but i haven't used XML much during this time. I am just trying to figureout the advantages of storing the data in XML (XMLType column).
If i have millions of records in multiple tables, is there any advantage in terms of performance & management of data when i store the data in XMLType.
For example:
If i am storing employee details in a table, i can create bunch of columns in a table and store the data, or i can create an XMLType column and store the complete data in that column. I am trying to figureout whether storing in XML format is better than in separate columns, especially if i have lot of data.
Thanks for your time & help
Anil

Refer
http://www.oracle.com/technology/oramag/oracle/01-nov/o61xml.html

Similar Messages

  • Storing data in XML file

    Hi,
    I am a student and very new to XML. I know what it is but I never had developed anything in it.Now I am doing an assignment for which I need your help.
    I have to store Customer data in XML file after he enters it in GUI.Customer is having the following fields:
    String name1=BuyerGui.name.getText().trim();
    String street1=BuyerGui.street.getText().trim();
    int zipcode1=Integer.parseInt(BuyerGui.zipCode.getText().trim());
    String city1=BuyerGui.city.getText().trim();
    String country1=BuyerGui.country.getText().trim();
    String email1=BuyerGui.eMailAddress.getText().trim();
    I may have to update it some times.
    I am working in Java 4.2. I heard that I can use JAXP but no idea how to do it.
    Anybody help me with sample code because I dont have verymuch time for my assignment.
    Thanks in advance,
    Sai Ram

    Here is sun's tutorial on JAXP with samples:
    http://java.sun.com/xml/tutorial_intro.html
    -jay

  • Storing data from XML files in Oracle DB

    Hi!
    I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
    public class xmlwritedb
    public static void main(String args[]) throws SQLException
    String tabName = "EMP"; // Table into which to insert XML data
    String fileName = "emp.xml"; // XML document filename
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Initialize a JDBC connection
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
    // Insert XML data from file (filename) into
    // database table (tabName)
    OracleXMLSave save = new OracleXMLSave(conn, tabName);
    URL url = save.createURL(fileName);
    int rowCount = save.insertXML(url);
    System.out.println(" successfully inserted "+rowCount+
    " rows into "+ tabName);
    conn.close();
    But it does not work.
    OracleXMLSave object does not see file name.
    Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
    Thank you.
    Maya.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
    If a java exception is thrown probably during ur install u might have forgotten
    grant javauserpriv to scott;
    grant javasyspriv to scott;
    Thanks
    [email protected]
    <HR></BLOCKQUOTE>
    Thank you!!!

  • Write / store xml data in Xe and retrieve stored data using pl/sql

    Hi to all,
    i'm searching a tutorial on:
    A - how to write / store xml data in Xe and retrieve stored data using pl/sql
    I don't want to use other technologies, because i use htmldb and my best practice is with pl/sql.
    I was reading an ebook (quite old maybe) however it's about oracle 9 and it's talking about xmltype:
    1 - I don't understand if this is a user type (clob/varchar) or it's integrated in Oracle 9 however i will read it (it's chapter 3 titled Using Oracle xmldb).
    Please dont'reply here: i would be glad if someone can suggest me a good tutorial / pdf to achieve task A in Oracle XE.
    Thanx

    Thank you very much Carl,
    However my fault is that i've not tried to create the table via sql plus.
    Infact i was wrong thinking that oracle sql developer allows me to create an xmltype column via the create table tool.
    however with a ddl script like the following the table was created successfully.
    create table example1
    keyvalue varchar2(10) primary key,
    xmlcolumn xmltype
    Thank you very much for your link.
    Message was edited by:
    Marcello Nocito

  • Storing WDDX or XML Data

    At the moment I am storing results from form data in a wddx
    packet in a mediumtext field.
    It all works fine but i'm sure there must be a cleaner
    smarter solution. I have had to enable CLOBS on the datasource
    recently.
    It doesnt seem the best way of storing the information.
    Does anybody know of a nicer solution, I am using mySQL but i
    would be quite happy to move it over to MSSQL if I need to.
    I have a feeling MSSQL has some sort of XML storage
    functionality.
    I don't really like the idea of writing to a file, it seems
    far to 80's and i should imagine it gets harder and harder for
    coldfusion to retrieve the file, the larger it gets.
    Hope you can help
    Regards
    Matt

    Matt,
    We have been using WDDX to store form data in the data base
    for a long time. I would say that storing it in XML is a better
    route because most databases (SQL Server and Oracle is what I have
    the most experience with) do have the capability to rip through XML
    using X-path, etc. The best way though, that we have found out is
    to have a "Properties" table. So it has a "PropertyName" column, a
    "PropertyValue" column, a unique ID, and a Foreign Key ID to say a
    "Report" table that is storing the form (config) data for. So then
    you would query the "Properties" table, and get all the needed
    values from it, and then do whatever it is you need to do in your
    code based on those values.
    Having a "Properties" table leverages itself way better to
    reporting on the properties, where you can write a query to get
    that information instead of having CF to dump that information.
    Hope this helps.
    Johann

  • Why we need to conver Context  Node data into XML file----Export to Excel

    Hi All,
    Let me clarify my dought........today i have gone through the concept of  "Exporting Context Data Using the Webdynpro Binary cache" in SAP Online Help.
    From the SAP Online Help pdf document, i have found that, the context node data has been converted first in to XML file,after that file had been stored in the web dynpor binary cache...bla....bla.........
    Here my qtn is why they had converted context node data into XML file. With out doing that can not we export context node data to excel file..?
    Regards
    Seshu
    Edited by: Sesshanna D on Dec 19, 2007 7:25 AM

    Hi Sesshanna,
    it is not neccessary to do that but xml has the advantage, that it can be easily transformed into every output format that might occur in later project stages.
    If it's simply about blowing out some Excel, I suggest using an OSS library such as jexcelAPI or Jakarta POI and building the Excel how you need it.
    regards,
    Christian

  • How to insert the data from XML to a table

    Hi,
    I'm using Oracle 10g Express Edition
    I need help in How to insert the data from XML file into the table.
    Below is the example i'm working on..
    I have create ridb user with below mentioned privileges:
    Account Status Locked Unlocked
    Default Tablespace: USERS
    Temporary Tablespace: TEMP
    User Privileges :
    Roles:
    CONNECT
    RESOURCE
    Direct Grant System Privileges:
    CREATE DATABASE LINK
    CREATE MATERIALIZED VIEW
    CREATE PROCEDURE
    CREATE PUBLIC SYNONYM
    CREATE ROLE
    CREATE SEQUENCE
    CREATE SYNONYM
    CREATE TABLE
    CREATE TRIGGER
    CREATE TYPE
    CREATE VIEW
    & table is created TRIALZIPCODES below mentioned is the DDL:
    CREATE TABLE TRIALZIPCODES
    STATE_ABBR VARCHAR2(20) NOT NULL
    , ZIP_CODE NUMBER(10, 0) NOT NULL
    , ZIP_CODE_EXT VARCHAR2(20)
    Below is the XML FILE: which is stored in C:\OracleProject Folder
    File name: trial.xml
    <?xml version="1.0" ?>
    <metadata>
    - <Zipcodes>
    - <mappings Record="4">
    <STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
    <ZIPCODE>94301</ZIPCODE>
    </mappings>
    - <mappings Record="5">
    <STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
    <ZIPCODE>80323</ZIPCODE>
    <ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
    </mappings>
    </Zipcodes>
    </metadata>
    PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
    create or replace
    PROCEDURE TRIAL AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    begin
    -- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
    -- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
    -- the name of the table as specified in our DTD
    DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
    -- the name of the data set as specified in our DTD
    DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
    -- for getting the output on the screen
    dbms_output.enable(1000000);
    -- open the XML document in read only mode
    v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    -- for inserting the XML data into the table
    insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
    insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
    dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
    DBMS_XMLStore.closeContext(insCtx);
    END;
    END TRIAL;
    For the first time when i complied i got the errors as :
    Procedure RIDB.PROCEDURE1@RIDB
    Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
    Error(16,14): PL/SQL: Item ignored
    Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    Error(29,1): PL/SQL: Statement ignored
    Error(33,1): PL/SQL: Statement ignored
    Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    Error(36,1): PL/SQL: Statement ignored
    Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
    SQL Statement:
    grant execute on utl_file to ridb
    So, it got compiled successfully but when i execute it gives me error as:
    Source does not have a runnable target.
    What does this mean?
    So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
    So can i edit the init.ora with notepad.When i tried to do that it says permission denied
    In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
    but there is also other file initXETemp in the same path do i need to do the changes in it.
    I have tried even editing the SPFILE as mentioned below:
    C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
    So i had reinstall the software again.
    Could you please let me know how to proceed..

    hi,
    I have created the directory from sys database
    CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
    & grant read,write access to the user
    grant read,write on directory XML_DIR2 to RIDB;
    & i had change the tag name in the xml file as shown below:
    <?xml version = '1.0'?>
    <metadata>
    <Zipcodes>
    <mappings Record="4">
    <STABBRE>CA</STABBRE>
    <ZIPCODE>94301</ZIPCODE>
    </mappings>
    <mappings Record="5">
    <STABBRE>CO</STABBRE>
    <ZIPCODE>80323</ZIPCODE>
    <ZIPCODEEXT>9277</ZIPCODEEXT>
    </mappings>
    </Zipcodes>
    </metadata>
    TRIALZIPCODE table as shown below:
    CREATE TABLE "RIDB"."TRIALZIPCODE"
    (     "STABBRE" VARCHAR2(20 BYTE),
         "ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
         "ZIPCODEEXT" NUMBER
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    I have tried two methods as shown below:
    Procedure 1:
    create or replace
    PROCEDURE TRIAL_V2 AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    cnt NUMBER;
    xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
    --XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
    BEGIN
    insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
    DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
    DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
    DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
    DBMS_XMLStore.setRowTag(insCtx, 'mappings');
    cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
    DBMS_XMLStore.closeContext(insCtx);
    END;
    Procedure 1 was compiled with out errors but when i execute i got the error as :
    Source does not have a runnable target.
    Procedure 2_
    CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    cnt NUMBER;
    xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
    --XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
    BEGIN
    INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
    SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
    extractvalue(x.column_value, 'mappings/ZIPCODE'),
    extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
    FROM TABLE(
    XMLSequence(
    EXTRACT(
    xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
    'metadata/Zipcodes/mappings'
    ) x
    END;
    END TRIAL_V3;
    Procedure 2 was complied without errors but when i execute i got the error as:
    Connecting to the database RIDB.
    ORA-22288: file or LOB operation FILEOPEN failed
    The system cannot find the file specified.
    ORA-06512: at "SYS.DBMS_LOB", line 523
    ORA-06512: at "SYS.XMLTYPE", line 287
    ORA-06512: at "RIDB.TRIAL_V3", line 12
    ORA-06512: at line 2
    Process exited.
    Disconnecting from the database RIDB.
    Could you please let me know how to proceed...

  • Internal Table Data to XML

    Hi
    I have a requirement of writing internal table data to XML. Any idea where i should start.
    I have pretty good experience with ABAP and basic knowledge in XML.
    There are good blogs which talk about transformations and other stuff but they are not able to give me clear path to my solution.
    Could somebody give me a basic example or some reference material where i can move the data in internal table (assume Sales order details of a day) to XML.
    Thanks

    Refer the program -
    In this implementation we will only focus on the creation of the XML file and the transfer to the user. You can not create a XML document directly. You have to use a so called ixml factory first. 
    TYPE-POOLS: ixml.
    DATA: l_ixml TYPE REF TO if_ixml.
    l_ixml = cl_ixml=>create( ).
    This iXML factory can create an empty XML document object named l_document.
    DATA:  l_document TYPE REF TO if_ixml_document.
            l_document = l_ixml->create_document( ).
    At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
    DATA: l_element_root TYPE REF TO if_ixml_element.
    This node we have to give a name and add it (create_simple_node) to the document object l_document, which will be the parent of this node.
    l_element_root  = l_document->create_simple_element(
                name = 'flights'
              parent = l_document ).
    Next we can add child nodes to there parent node using the same method of the document object.
    DATA: l_element_airline TYPE REF TO if_ixml_element,
    l_element_airline  = l_document->create_simple_element(
                   name = 'airline'
                 parent = l_element_root  ).
    An attribute can be add easily using the method set_attribute of the element node.
    l_rc = l_element_airline->set_attribute( name = 'code' value = 'LH401' ).
    Now we have finished the document object. Regretfully it can not be displayed in any form due to the fact that it is a binary object. 
    The next step is to convert the created document to a flat file. To achieve this we have to create a stream factory, which will help us to create an output stream.
    DATA: l_streamfactory   TYPE REF TO if_ixml_stream_factory.
    l_streamfactory = l_ixml->create_stream_factory( ).
    In this case, we will convert the document into an output stream which is based on an internal table of type x.
    TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
            END OF xml_line.
    DATA:  l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i,
            l_ostream         TYPE REF TO if_ixml_ostream.
    l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
    When we have created the output stream we can do the rendering from the document into the stream. The XML data will be stored in the internal table automatically.
    DATA: l_renderer        TYPE REF TO if_ixml_renderer.
    l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                            & nbsp;              document = l_document ).
    l_rc = l_renderer->render( ).
    In the last step we upload the file to the sapgui
    l_xml_size = l_ostream->get_num_written_raw( ).
    CALL METHOD cl_gui_frontend_services=>gui_download
       EXPORTING
         bin_filesize = l_xml_size
         filename     = 'c:\temp\flights.xml'
         filetype     = 'BIN'
       CHANGING
         data_tab     = l_xml_table
       EXCEPTIONS
         OTHERS       = 24.
    This finished the first step-of-three. As mentioned before the next log will focus on the conversion from xml files (back) to abap tables.
    REPORT  z_xit_xml_dom_create.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
             END OF xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_ostream         TYPE REF TO if_ixml_ostream,
            l_renderer        TYPE REF TO if_ixml_renderer,
            l_document        TYPE REF TO if_ixml_document.
      DATA: l_element_flights TYPE REF TO if_ixml_element,
            l_element_airline TYPE REF TO if_ixml_element,
            l_element_flight  TYPE REF TO if_ixml_element,
            l_element_from    TYPE REF TO if_ixml_element,
            l_element_to      TYPE REF TO if_ixml_element,
            l_element_dummy   TYPE REF TO if_ixml_element,
            l_value           TYPE string.
      DATA: l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i.
      DATA: lt_spfli          TYPE TABLE OF spfli.
      DATA: l_spfli           TYPE spfli.
      START-OF-SELECTION.
      Fill the internal table
        SELECT * FROM spfli INTO TABLE lt_spfli.
      Sort internal table
        SORT lt_spfli BY carrid.
      Start filling xml dom object from internal table
        LOOP AT lt_spfli INTO l_spfli.
          AT FIRST.
          Creating a ixml factory
            l_ixml = cl_ixml=>create( ).
          Creating the dom object model
            l_document = l_ixml->create_document( ).
          Fill root node with value flights
            l_element_flights  = l_document->create_simple_element(
                        name = 'flights'
                        parent = l_document ).
          ENDAT.
          AT NEW carrid.
          Create element 'airline' as child of 'flights'
            l_element_airline  = l_document->create_simple_element(
                        name = 'airline'
                        parent = l_element_flights  ).
          Create attribute 'code' of node 'airline'
            l_value = l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
          Create attribute 'name' of node 'airline'
            SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
          ENDAT.
          AT NEW connid.
          Create element 'flight' as child of 'airline'
            l_element_flight  = l_document->create_simple_element(
                        name = 'flight'
                        parent = l_element_airline  ).
          Create attribute 'number' of node 'flight'
            l_value = l_spfli-connid.
            l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
          ENDAT.
        Create element 'from' as child of 'flight'
          CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
          l_element_from  = l_document->create_simple_element(
                      name = 'from'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpfrom.
          l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
        Create element 'to' as child of 'flight'
          CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
          l_element_to  = l_document->create_simple_element(
                      name = 'to'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpto.
          l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
        Create element 'departure' as child of 'flight'
          l_value = l_spfli-deptime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'departure'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'arrival' as child of 'flight'
          l_value = l_spfli-arrtime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'arrival'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'type' as child of 'flight'
          CASE l_spfli-fltype.
            WHEN 'X'.
              l_value = 'Charter'.
            WHEN OTHERS.
              l_value = 'Scheduled'.
          ENDCASE.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'type'
                      value = l_value
                      parent = l_element_flight ).
        ENDLOOP.
        IF sy-subrc NE 0.
          MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
        ENDIF.
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
        l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
      Saving the XML document
        l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xml'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    <?xml version="1.0"?>
    <flights>
         <airline code="AA" name="American Airlines">
              <flight number="0017">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>110000</departure>
                   <arrival>140100</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0064">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>090000</departure>
                   <arrival>172100</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="AZ" name="Alitalia">
              <flight number="0555">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>190000</departure>
                   <arrival>210500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0788">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>120000</departure>
                   <arrival>085500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0789">
                   <from airport="TYO">TOKYO,JP</from>
                   <to airport="FCO">ROME,IT</to>
                   <departure>114500</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0790">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="KIX">OSAKA,JP</to>
                   <departure>103500</departure>
                   <arrival>081000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="DL" name="Delta Airlines">
              <flight number="1984">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>100000</departure>
                   <arrival>182500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="1699">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>171500</departure>
                   <arrival>203700</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0106">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>193500</departure>
                   <arrival>093000</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="JL" name="Japan Airlines">
              <flight number="0407">
                   <from airport="NRT">TOKYO,JP</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>133000</departure>
                   <arrival>173500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0408">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="NRT">TOKYO,JP</to>
                   <departure>202500</departure>
                   <arrival>154000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="LH" name="Lufthansa">
              <flight number="2407">
                   <from airport="TXL">BERLIN,DE</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>071000</departure>
                   <arrival>081500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="2402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SXF">BERLIN,DE</to>
                   <departure>103000</departure>
                   <arrival>113500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>133000</departure>
                   <arrival>150500</arrival>
                   <type>Charter</type>
              </flight>
              <flight number="0401">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>183000</departure>
                   <arrival>074500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0400">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>101000</departure>
                   <arrival>113400</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="QF" name="Qantas Airways">
              <flight number="0005">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>225000</departure>
                   <arrival>053500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0006">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>205500</departure>
                   <arrival>150500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="SQ" name="Singapore Airlines">
              <flight number="0988">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>163500</departure>
                   <arrival>001500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0158">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="JKT">JAKARTA,ID</to>
                   <departure>152500</departure>
                   <arrival>160000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0015">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>160000</departure>
                   <arrival>024500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0002">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>170000</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="UA" name="United Airlines">
              <flight number="0941">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>143000</departure>
                   <arrival>170600</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3504">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>150000</departure>
                   <arrival>103000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3516">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>162000</departure>
                   <arrival>054500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3517">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>104000</departure>
                   <arrival>125500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
    </flights>
    Regards,
    Amit
    Reward all helpful replies.

  • Calling stored procedure with XML XSU

    Hi Guys,
    I am using XML SQL Utility api for inserting xml data in to oracle database.Now my requirement is I have to return inserted record sequence value(i.e primary key) back and have to resend it to insert child table data as a foreign key.We can do with PL SQl. Can you guys suggest me how to call a stored procedure using xml sql utility.
    Thanks,
    Srinivas.

    If anyone has figured this one out let me know. I'm getting the same problem. Only in my case I've tried both the "OraOLEDB.Oracle" provider and the "MSDAORA" provider and I get an error either way. Also my procedure has 2 in parameters and 1 out parameter. At least now I know I'm not the only one with this issue. :)
    '*** the Oracle procedure ***
    Create sp_getconfiguration(mygroup in varchar2, myparameter in varchar2, myvalue out varchar2)
    AS
    rec_config tblconfiguration.configvalue%type;
    cursor cur_config is select configvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter;
    begin
    open cur_config;
    fetch cur_config into rec_config;
    close cur_config;
    myvalue := rec_config;
    end;
    '** the ado code ****
    dim dbconn as new adodb.connection
    dim oCmd as new adodb.connection
    dim ors as new adodb.recordset
    dbconn.provider = "MSDAORA" 'or dbconn.provider = "OraOLEDB.Oracle"
    dbconn.open "Data Source=dahdah;User ID=didi;Password=humdy;PLSQLRSet=1;"
    set ocmd.activeconnection = dbconn
    cmd.commandtext = "{call fogle.sp_getconfiguration(?,?)}"
    'i've also tried creating a public synonym called getconfiguration and just refering to procedure by that.
    ' "{call getconfiguration(?, ?)}"
    ' "{call getconfiguration(?,?, {resultset 1, myvalue})}"
    'and numerous numerous other combinations
    set oPrm = cmd.createparameter("MYGROUP", advarchar, adparaminput, 50, strGrouptoPassIn$)
    cmd.parameters.append oPrm
    set oPrm = cmd.createParameter("MYPARAMETER", advarchar, adParamInput, 50, strParameterToPassIn$)
    cmdParameters.append oPrm
    set rs = cmd.execute

  • 10.1.3 Migration Issue with data-sources.xml

    Hi:
    Running into lots of migration issues for an application built in 10.1.3 EA, migrating to 10.1.3. production, mostly in the BC project. Here's one: the database connections built in EA were not carried over to prod, so they needed to get re-built. No biggie. But now the data-sources.xml file in the model project has duplicate entries for my data sources. I have tried directly editting that file and removing the duplicates, but when I go to run my application (ADF Faces & ADF BC) JDeveloper hangs. When I abort JDev and re-start it, the duplicate entries are back in data-sources.xml (and yes, I did save the file after making the changes). It seems that the xml file is built dynamically from definitions stored elsewhere. Where is the source? What will I need to modify to get the changes to take?
    Thanks.
    Johnny Lee

    There is new control over when/whether JDeveloper add/updates your data-sources.xml file for the embedded server. The settings are located here:
    Tools | Embedded OC4J Server Preferences | Current Workspace | Data Sources
    There are some settings there that control whether/when we update the data-sources.xml

  • SAX, incor. data for XML element, XML 1.1 doc (1.0 ok) in JRE 6 (JRE 5 ok)

    Hello,
    for some reason, the test case below fails when driven with Java 6. Looks like, when long string data is stored in a XML element, DocumentHandler's characters() method will be provided with incorrect data.
    With XML 1.0, parsing works fine in all my tests, Apache Xerces, JRE 5, JRE 6.
    With XML 1.1., parsing works fine with Apache Xerces, JRE5 but not with JRE6.
    I've checked it with latest JRE 6 update 4.
    Anyone else xperiencing such problems with XML1.1 parsing when using JAXP bundled with Java 6?
    I've tried to file a bug at bugdatabase, but for some reason I got no response for my issue - so I'm trying the forum now ;-)
    Thanx for comments
    Merten
    import java.io.StringReader;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import junit.framework.TestCase;
    import junit.framework.TestResult;
    import junit.framework.TestSuite;
    /** snippet to demonstrate problem in SAXParser */
    public class ProblemWithSAXParser extends TestCase
    public static void main(String[] args)
    TestResult result=junit.textui.TestRunner.run(suite());
    System.exit(result.wasSuccessful() ? 0 : 1);
    private static junit.framework.Test suite()
    final TestSuite ts=new TestSuite();
    ts.addTestSuite(ProblemWithSAXParser.class);
    return (ts);
    /** small DocumentHandler, just waiting for one and only XML element <c></c> */
    class MySAXDocumentHandler extends DefaultHandler
    boolean listening=false;
    public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
    throws SAXException
    System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
    if("c".equals(qName))
    listening=true;
    public void endElement(final String uri, final String localName, final String qName) throws SAXException
    System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
    if("c".equals(qName))
    listening=false;
    public void characters(final char ch[], final int start, final int length) throws SAXException
    if(listening)
    final String str=new String(ch, start, length);
    System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
    + str);
    sb.append(str);
    private final StringBuffer sb=new StringBuffer();
    /** return what I got for XML element <c></c> */
    public String toString()
    return (sb.toString());
    /** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
    * content in the XML element */
    public void testWithSunAndApache() throws Exception
    // test XML element content for <c> element
    final StringBuffer plain_str=new StringBuffer("");
    for(int i=0; i < 500; i++)
    plain_str.append("0123456789 This is some text ").append(i).append(". ");
    final String xml_orig=plain_str.toString();
    // SAX parsers, one Sun, one (original) Apache Xerces
    // accept that Apache Xerces is not in path ...
    final String prop_name="javax.xml.parsers.SAXParserFactory";
    final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
    final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
    System.setProperty(prop_name, prop_val_sun);
    final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
    System.out.println("SaxParser Sun= " + sax_sun);
    assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
    System.setProperty(prop_name, prop_val_apache);
    SAXParser sax_apache;
    try
    sax_apache=SAXParserFactory.newInstance().newSAXParser();
    catch(final Throwable t)
    System.err.println("no Apache Xerces in path? " + t);
    sax_apache=null;
    System.out.println("SaxParser Apache= " + sax_apache);
    assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
    // i==0: XML 1.0, i==1: XML 1.1
    for(int i=0; i <= 1; i++)
    assert i == 0 || i == 1;
    final String xml_version=(i == 0 ? "1.0" : "1.1");
    final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
    sb.append(xml_orig);
    sb.append("</c>");
    final String xml=sb.toString();
    // parse it!
    final StringReader string_reader_sun, string_reader_apache;
    string_reader_sun=new StringReader(xml);
    final InputSource input_source_sun=new InputSource(string_reader_sun);
    string_reader_apache=new StringReader(xml);
    final InputSource input_source_apache=new InputSource(string_reader_apache);
    final MySAXDocumentHandler my_handler_sun, my_handler_apache;
    my_handler_sun=new MySAXDocumentHandler();
    my_handler_apache=new MySAXDocumentHandler();
    sax_sun.parse(input_source_sun, my_handler_sun);
    if(sax_apache!=null)
    sax_apache.parse(input_source_apache, my_handler_apache);
    final String xml_sun=my_handler_sun.toString();
    final String xml_apache=my_handler_apache.toString();
    assertNotNull(xml_sun);
    assertNotNull(xml_apache);
    System.out.println("xml version " + xml_version);
    System.out.println("xml " + xml);
    System.out.println("xml_orig " + xml_orig);
    System.out.println("xml_sun " + xml_sun);
    System.out.println("xml_apache " + xml_apache);
    // test the data returned from DocumentHandler
    if(sax_apache!=null)
    assertEquals(xml_orig, xml_apache);
    assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
    assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
    }

    thanx, DrClap, haven't seen the "code" button for some reason, code is attached again
    The output of my test is like this for JRE6 (truncated)
    xml_sun 456789 This is is some text 0. 0123456789 This is some text 1.
    xml_apache 0123456789 This is some text 0. 0123456789 This is some text 1.
    Notice, xml_sun not only starts wrong ("0123" missing) - for some reason, the text there is not "This is some text" but "This is is some text" - very interesting in a way. I guess there's an issue with repeated text chunks ...
    So, the data in my XML element is kind of changed, the length of the string is okay but the characters are "misplaced" or so :-) I thought about a problem with StringBuffer first, but the StringBuffer works fine for Apache ... so I really think there's an issue with JRE 6's parser for XML 1.1
    Merten
    import java.io.StringReader;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import junit.framework.TestCase;
    import junit.framework.TestResult;
    import junit.framework.TestSuite;
    /** snippet to demonstrate problem in SAXParser */
    public class ProblemWithSAXParser extends TestCase
    public static void main(String[] args)
      TestResult result=junit.textui.TestRunner.run(suite());
      System.exit(result.wasSuccessful() ? 0 : 1);
    private static junit.framework.Test suite()
      final TestSuite ts=new TestSuite();
      ts.addTestSuite(ProblemWithSAXParser.class);
      return (ts);
    /** small DocumentHandler, just waiting for one and only XML element <c></c> */
    class MySAXDocumentHandler extends DefaultHandler
      boolean listening=false;
      public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
        throws SAXException
       System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
       if("c".equals(qName))
        listening=true;
      public void endElement(final String uri, final String localName, final String qName) throws SAXException
       System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
       if("c".equals(qName))
        listening=false;
      public void characters(final char ch[], final int start, final int length) throws SAXException
       if(listening)
        final String str=new String(ch, start, length);
        System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
          + str);
        sb.append(str);
      private final StringBuffer sb=new StringBuffer();
      /** return what I got for XML element <c></c> */
      public String toString()
       return (sb.toString());
    /** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
      * content in the XML element */
    public void testWithSunAndApache() throws Exception
      // test XML element content for <c> element
      final StringBuffer plain_str=new StringBuffer("");
      for(int i=0; i < 500; i++)
       plain_str.append("0123456789 This is some text ").append(i).append(". ");
      final String xml_orig=plain_str.toString();
      // SAX parsers, one Sun, one (original) Apache Xerces
      // accept that Apache Xerces is not in path ...
      final String prop_name="javax.xml.parsers.SAXParserFactory";
      final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
      final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
      System.setProperty(prop_name, prop_val_sun);
      final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
      System.out.println("SaxParser Sun= " + sax_sun);
      assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
      System.setProperty(prop_name, prop_val_apache);
      SAXParser sax_apache;
      try
       sax_apache=SAXParserFactory.newInstance().newSAXParser();
      catch(final Throwable t)
       System.err.println("no Apache Xerces in path? " + t);
       sax_apache=null;
      System.out.println("SaxParser Apache= " + sax_apache);
      assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
      // i==0: XML 1.0, i==1: XML 1.1
      for(int i=0; i <= 1; i++)
       assert i == 0 || i == 1;
       final String xml_version=(i == 0 ? "1.0" : "1.1");
       final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
       sb.append(xml_orig);
       sb.append("</c>");
       final String xml=sb.toString();
       // parse it!
       final StringReader string_reader_sun, string_reader_apache;
       string_reader_sun=new StringReader(xml);
       final InputSource input_source_sun=new InputSource(string_reader_sun);
       string_reader_apache=new StringReader(xml);
       final InputSource input_source_apache=new InputSource(string_reader_apache);
       final MySAXDocumentHandler my_handler_sun, my_handler_apache;
       my_handler_sun=new MySAXDocumentHandler();
       my_handler_apache=new MySAXDocumentHandler();
       sax_sun.parse(input_source_sun, my_handler_sun);
       if(sax_apache!=null)
        sax_apache.parse(input_source_apache, my_handler_apache);
       final String xml_sun=my_handler_sun.toString();
       final String xml_apache=my_handler_apache.toString();
       assertNotNull(xml_sun);
       assertNotNull(xml_apache);
       System.out.println("xml version " + xml_version);
       System.out.println("xml        " + xml);
       System.out.println("xml_orig   " + xml_orig);
       System.out.println("xml_sun    " + xml_sun);
       System.out.println("xml_apache " + xml_apache);
       // test the data returned from DocumentHandler
       if(sax_apache!=null)
        assertEquals(xml_orig, xml_apache);
       assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
       assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
    }

  • Use of cache_scheme in data-sources.xml

    Hi guys.
    I have posted a couple of similar topics before - without any response ! I can't believe with all of the gurus out there that NOBODY knows the answer to this ! :-)
    Anyway, we are providing a 'vanilla' type implementation of Oracle's Connection Pooling - just using Oracle's DataSource to open and close connections, and having Oracle dynamically take care of the pooling itself. ( Apparently, under this scenario, even max and min connections are set as required ).
    However, if I specify the cache_scheme property within data-sources.xml, will it take effect using this basic implementation ? In other words, will changing it's value effect the behaviour once the max limit is reached and more connections are requested ?
    Many thanks.
    Steve.

    Timo,
    thanks for your respone! I managed to configure the application to use a data-source connection created on the application server. Also in order to be able to deploy the same EAR to a number of containers on different DB's.
    I know it's possible to connect to a DB without using a data-sources.xml file .. but it seemed like my application was storing some 'old' connection information because it was able to connect to the db without having the data sources configured on the AS.
    Do you need to restart JDeveloper after unchecking the 'Bunde default data-sources.xml during deployment' checkbox? Because it is working correctly right now ... .
    Thanks,
    Koen Verhulst

  • Saving adobe form data to XML

    Am trying to see what happens when user fills in adobe form and clicks submit. What will be sent back to server? Filled PDF or XML? If its XML, does it get stored on the user's machine in some temporary files?? If not, atleast where does it get stored on the server?
    Am basically trying to develop a functionality where user clicks submit and all the form data gets stored in an XML file on the local machine. Any inputs?

    Hi Narayana,
    You can use Web Dynpro Java with embedded Interactive PDF forms; and within your WDJ application, you can call various 'models': web services, EJBs and BAPIs/RFCs etc.
    So to pass data to an SAP system, you don't automatically need the XML data as a BAPI is sufficient. Check out <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#backend">these SDN tutorials</a> to do this.
    Cheers,
    Francois

  • Getting data via "XML Data" connectivity

    Hi,
    I need to retrieve data in Dashboard Design SP2 from one table stored on a SQL Server 2000. As I need to refresh the data I only have the option to use the "XML Data" connection (we are using BO4.0 Edge and can't use QaaWS).
    However, I am completly new in this XML topic... In which way should data be delivered so that I can use it in Dashboard Design (in Data Manager -> "XML Data" I have to input a "XML Data URL"...)?
    Thanks!

    Hi steve,
    Please refer below tutorial. It shows an example to create dashboard with XML file as data source.
    [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0efea0a-f515-2e10-2daa-cc5a4d23c1a8]
    Hope it helps you.
    Regards,
    Nikhil Joy

  • Read data from xml files and  populate internal table

    Hi.
    How to read data from xml files into internal tables?
    Can u tell me the classes and methods to read xml data..
    Can u  explain it with a sample program...

    <pre>DATA itab_accontextdir TYPE TABLE OF ACCONTEXTDIR.
    DATA struct_accontextdir LIKE LINE OF itab_accontextdir.
    DATA l_o_error TYPE REF TO cx_root.
    DATA: filename type string ,
                 xmldata type xstring .
    DATA: mr      TYPE REF TO if_mr_api.
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
    WRITE xmldata.
    TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.
    LOOP AT itab_accontextdir INTO struct_accontextdir.
        WRITE: / struct_accontextdir-context_id,
               struct_accontextdir-context_name,
               struct_accontextdir-context_type.
        NEW-LINE.
        ENDLOOP.</pre>
    <br/>
    Description:   
    In the above code snippet I am storing the data in an xml file(you know xml is used to store and transport data ) called 'xml_accontextdir.xml' that is uploaded into the MIME repository at path 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'.
    The below API is used to read a file in MIME repo and convert it into a string that is stored in ' xmldata'. (This is just a raw data that is got by appending the each line of  xml file).
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
        Once the 'xmldata' string is available we use the tranformation to parse the xml string that we have got from the above API and convert it into the internal table.
    <pre>TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.</pre>
    Here the trasnsformation 'id ' is used to conververt the source xml 'xmldata' to resulting internal table itab_accontextdir, that have same structure as our xml file 'xml_accontextdir.xml'.  In the RESULT root of the xml file has to be specified. (In my the root is 'shiva'). 
    Things to be taken care:
    One of the major problem that occurs when reading the xml file is 'format not compatible with the internal table' that you are reading into internal table.  Iin order to get rid of this issue use one more tranformation to convert the data from the internal table into the xml file.    
    <pre>TRY.
          CALL TRANSFORMATION id
            SOURCE shiv = t_internal_tab
            RESULT XML xml.
        CATCH cx_root INTO l_o_error.
      ENDTRY.
      WRITE xml.
      NEW-LINE.</pre>
    <br/>
    This is the same transformation that we used above but the differnce is that the SOURCE and RESULT parameters are changed the source is now the internal table and result is *xml *string. Use xml browser that is available with the ABAP workbench to read the xml string displayed with proper indentation. In this way we get the format of xml file to be used that is compatable with the given internal table. 
    Thank you, Hope this will help you!!!
    Edited by: Shiva Prasad L on Jun 15, 2009 7:30 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 11:56 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 12:06 PM

Maybe you are looking for

  • Automatic GR/IR Account Clearing using F.13

    Hi, I want to clear the GR/IR Clearing account using automatic functionality(T.Code-F.13). If the Dr and Cr amounts are ZERO and matches with reference to purchase order in GR/IR clearing account those items i want to clear using F.13(Automatic Clear

  • Memory leak issue in AJAX Truclinet protocol

    Hi, I am using LR 11.5 installed in 4GB RAM and it is a 32 bit machine. Observed below things when trying to exceute a test with Ajax Truclient script even with 1 user. 1. Unable to run the test for longer duration 2. Abnormal termination of mdrv pro

  • How to print form into pdf format using smart forms in abap

    please let me know how to print form into pdf format using smart forms in abap. Moderator message: please search for available information/documentation. Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM

  • What is the by default optimizer in 9i and 10g?

    Hi All, What is the by default optimizer in 9i and 10g? Thanks, Vishal

  • Why can't I install firefox in the language of MY chosing?

    I get sometimes very tired of preassumptions on websites that are hard to change. The Firefox download takes that to the extremes. Why can't I just install and UK version and get all the time prompted to download the NL version. I am working internat