Exporting DB data to XML based on a pre-defined XSD

Hi,
I am new to PL/SQL and would need some good examples of code how to export database extries into an XML file based on a predefined XSD.
Input:
TABLE1
fields: ID (PK), NAME, X, Y, BLOB
TABLE2
fields: ID (FK), DESCRIPTION
Both tables have a relationships. Inside the BLOB is a saved XML file that also needs to get exported. I would need a sample of SQL or PL/SQL code how to export a BLOB into an XML.
Thanks!

Hi,
You can use dbms_metada built-in package in order to generate database structure(metadata) in an XML file. This package is very complex and flexible. You can get more examples on tahiti.oracle.com or psoug.org as damorgan mentioned.
As i read from your question, you need to export-extract table rows-entities in a file, simply. You also need a predefined XSD. Once i need to export table data programatically. You can find more utilities by googling. If you wish, you can reach my package here . However it is not completely covers your req. but i also post simple output in order to understand whether it is helpful or not for your requirements.
Reg.
PROCEDURE ExportFile
--oracle directory name
pis_DirectoryName in VARCHAR2,
--file name
pis_FileName in VARCHAR2,
--table name that will be exported
pis_TableName IN ALL_TABLES.TABLE_NAME%TYPE,
--filter criteria,if exists
pis_WhereCondition IN VARCHAR2 DEFAULT NULL,
--if table has more columns how fields will be seperated
pis_FieldDelimiter IN VARCHAR2 DEFAULT ',',
--row delimiter, CHR(10) for newline
pis_RecordDelimiter IN VARCHAR2 DEFAULT CHR(10),
--if some columns will not be included
pis_ExceptedFieldList IN VARCHAR2 DEFAULT NULL,
--1 for fields enclosed by ", such as "column_value"
pin_FieldEnclosedByQuote IN NUMBER DEFAULT 0,
--if column name will not be included, set as 0
pin_IncludeColumnName IN NUMBER DEFAULT 0,
--if field names included
pis_FieldNameDelimiter IN VARCHAR2 DEFAULT ':'
SQL> create table t
  2  (
  3  i number,
  4  xml_data blob
  5  );
Table created.
SQL>
SQL> insert into t values (1, rawtohex('
  2  <books>
  3     <book>
  4        <author>bla bla bla</author>
  5        <title>falan filan</title>
  6     </book>
  7  </books>') );
1 row created.
SQL>
SQL> create or replace directory TEST_DIR as 'c:\test';
Directory created.
SQL> BEGIN
  2    UTL_EXP.ExportFile(pis_DirectoryName  => 'TEST_DIR',
  3                       pis_FileName       => 'test.xml',
  4                       pis_TableName      => 't',
  5                       pis_WhereCondition => 'i = 1');
  6  END;
  7  /
PL/SQL procedure successfully completed.
SQL>
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
C:\Users\Mennan>type c:\test\test.xml
1,
<books>
   <book>
      <author>bla bla bla</author>
      <title>falan filan</title>
   </book>
</books>,
C:\Users\Mennan>

Similar Messages

  • How To Export BW Data to XML File

    Hello All-
    I am currently trying to find out how to <b>export </b>data in BW to an XML File. I have read previous posts but would like to know if one option is using Open Hub Services (through an Infospoke) toprovide me with the data I need while outputting a file in XML.  We are currently on BW 3.5. Thank you.
    Claudia

    Hi Claudia,
    Yes, you can export the data available in BW to XML files using Open Hub Service.
    See the links below:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f12a03d-0401-0010-d9a7-a55552cbe9da
    http://help.sap.com/saphelp_nw04/helpdata/en/33/f3843b0af3de0ee10000000a114084/content.htm
    Cheers!
    Amit

  • I want to export acquired data via XML to a remote URL/web service. Is there some online reference for EXACTLY what XML features are available in 6.1?

    Is there any online reference to the XML methods available in 6.1?
    I would like to set up a LabView system that acquires data from local hardware, and then sends acquired data as XML "packets" to a remote web service. I can't seem to find any online reference to this when I search the site. I don't want the "gee golly 6.1 is cool" marketing stuff. Just a simple technical reference to abilities.

    If you're looking for more technical information about all the new features of 6.1, try the LabVIEW 6.1 Upgrade Notes. Here's what they say about the XML functions:
    "Use the Flatten to XML function located on the Functions»Advanced»Data Manipulation palette to convert any LabVIEW data type to the XML format according to the LabVIEW XML schema. Use the Unflatten from XML function located on the same palette to convert a data type in the XML format into LabVIEW data.
    For these conversions, LabVIEW uses a predefined XML schema that is described in labview\help\LVXMLSchema.xsd."
    Kelly Holmes
    LabVIEW Documentation
    Kelly H
    LabVIEW Documentation
    National Instruments

  • Report Export - No data when query based on Application Context

    I updated my Query Region source to use a Global Application Context and now the Report Export (to .csv) download has no data. This appears to run the query again in under a different session_id perhaps(?)
    In a before header process I set the session_id to access a couple of date values set by the user via LOVs - the 'Search' button and an After Submit Process sets the context values which are accessed in the where clause, i.e
    where date_attribute between to_date( SYS_CONTEXT('MY_CTX', 'START_DATE'), 'dd-Mon-yyyy')
    and to_date( SYS_CONTEXT('MY_CTX', 'END_DATE'), 'dd-Mon-yyyy')
    If you know any solution or alternative approach I'd be very grateful for your tips. I like Apex because you can leverage core Oracle database technology but then in some case you do hit these little troubles!
    Thanks
    Craig

    Thanks for the link to the posts.
    I considered the Security Attribute but thought that was somewhat inappropriate for just the one page I am setting the context; I understand the Security Attribute function would set 'My_Ctx' values on all page requests.

  • How to export a data as an XML file from oracle data base?

    could u pls tell me the step by step procedure for following questions...? how to export a data as an XML file from oracle data base? is it possible? plz tell me itz urgent requirement...
    Thankz in advance
    Bala

    SQL> SELECT * FROM v$version;
    BANNER
    Oracle DATABASE 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS FOR 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    5 rows selected.
    SQL> CREATE OR REPLACE directory utldata AS 'C:\temp';
    Directory created.
    SQL> declare                                                                                                               
      2    doc  DBMS_XMLDOM.DOMDocument;                                                                                       
      3    xdata  XMLTYPE;                                                                                                     
      4                                                                                                                        
      5    CURSOR xmlcur IS                                                                                                    
      6    SELECT xmlelement("Employee",XMLAttributes('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",                       
      7                                  'http://www.oracle.com/Employee.xsd' AS "xsi:nonamespaceSchemaLocation")              
      8                              ,xmlelement("EmployeeNumber",e.empno)                                                     
      9                              ,xmlelement("EmployeeName",e.ename)                                                       
    10                              ,xmlelement("Department",xmlelement("DepartmentName",d.dname)                             
    11                                                      ,xmlelement("Location",d.loc)                                     
    12                                         )                                                                              
    13                   )                                                                                                    
    14     FROM   emp e                                                                                                       
    15     ,      dept d                                                                                                      
    16     WHERE  e.DEPTNO=d.DEPTNO;                                                                                          
    17                                                                                                                        
    18  begin                                                                                                                 
    19    OPEN xmlcur;                                                                                                        
    20    FETCH xmlcur INTO xdata;                                                                                            
    21    CLOSE xmlcur;                                                                                                       
    22    doc := DBMS_XMLDOM.NewDOMDocument(xdata);                                                                           
    23    DBMS_XMLDOM.WRITETOFILE(doc, 'UTLDATA/marco.xml');                                                                  
    24  end;                                                                                                                  
    25  /                                                                                                                      
    PL/SQL procedure successfully completed.
    .

  • Using XML-based object structures to represent data in code/at run-time

    Hello,
    I have quite a "high level" question which has be bothering me for some time, and I haven't found the subject tackled in any books. I believe J2SE/J2EE is not an important divide here.
    Lets say I want to develop a J2SE game application with two programs: a "level designer", and a "level viewer", and I want to store the level files in an XML format.
    My question, and I use this example only to try and illustrate it, is:
    when coding the level designer or viewer, is it reasonable to use an XML-based object hierarchy for representing a level in code/at run-time, i.e. using the standard Java DOM APIs? Or should one (as I would have done before XML came along) develop a set of classes much closer to modelling the real form of a level, and then add a means to convert those objects to/from to XML format?
    This second option of course I would use/would have used if I wasn't thinking about XML, but isn't it sometimes easier to just read in an XML file into a DOM representation and just use the data straight out of that structure, rather than go through the bother of parsing the XML into a set of unrelated objects defined by a different family of classes? What shapes your decision here? And if the second option is best, what is the easiest way of converting to/from the XML?
    Thank you for any advice.
    Greg

    Hi Christian,
    Can I ask: what about if your domain was quite 'close' to an object/DOM representation of XML?
    For instance, what if a game operated by acting out a theatrical script, a spoken conversation, between two characters, perhaps somehow influenced at points by the user, and a particular level was just a different script for the characters.
    One could imagine that the object representation of this would in the end be quite similar to how you'd represent XML, i.e. like a tree of nodes, where each node was a line from the script, and some nodes were a decision point where different nodes could be chosen from.
    Would you still want to avoid using XML-based classes to represent the underlying 'game', or is there a point where you would 'give it' to the similarity and use existing XML structures directly?
    Thank you for any advice
    Greg

  • 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

  • Pdf file not exporting data as xml

    Hi
    I have created a pdf form in adode livecycle version 8, I have saved it as a adobe acrobat 7 dynamic xml form.
    when a user has completed the form I need to export the data as an xml file however there is no data from the form in the xml file.
    does anyone know what the problem is?
    Regards

    Have you saved the PDF as Reader Extended PDF, Enable Additional Features to be able to save data's form?
    You must do this is Adobe Acrobat Pro

  • Best way to transfer XML based data

    All,
    I am looking for the best possible way of transferring XML based data from a server to a web based client.
    XML file is generated on server and its size is massive. I am looking for all possible alternatives and possibly the best way.
    Could it be AJAX, SOAP, parsing through a servlet, creating value objects?
    I appreciate all inputs.
    Thanks,
    S.

    You can make a bootable copy of your system now, but you won't be able to boot from it with the new computer. They are not usually backwards compatible with the OS. But when you first boot into the new system, use SetUp Assistant to migrate the data from the cloned copy. That will work just fine.

  • Need to generate XML based on Data template

    Hi,
    I'm unable to submit (the second submit) my request using the demo links (XDO 5.6.3 or XDO 5.7) provided in http://bipublisher.us.oracle.com/?tab=samples&header=dataTemplate to generate the XML based on the data template.
    Heard that these links are available for Oracle EBS internal use. I work with EBS-CRM. I need to generate XML based on a data template and use the XML in the template. Data template has two queries for a template.
    Pls help.
    Thanks,
    Impha

    Impha
    Please use the internal mailing list for your questions the forum is meant for external customers. If you do not know the ML name - drop me a mail
    Tim

  • XML export "unable to export the data."

    Strictly speaking I am just using the GUI, not trying to do this programmatically.  But this is related to a development project & I figure the dev forum will have better insight.
    Attempting to do a simple export of a plain table from Access. right-click table>export>XML>"OK">checkdata only>"OK"
    ...unable to export the data.
    A very unhelpful error message with zero indication of the reason or how to correct it.  This is a single, simple table.  Exporting other formats is fine.
    What should I even be looking for as a cause for this?  How hard is it to dump a table into XML with tags for <record> or <row> and tags for the column names?

    What you call a simple export Access may not. What are the data types of the fields in this table? Can you post a copy of your table, with only some test data, to a public place like a free OneDrive account?
    Surely I agree you should be afforded a better error message regardless.
    -Tom. Microsoft Access MVP

  • Export data to XML from JSP possible?

    I have a small JSP to retrieve data in a Browse form. Is there information on how to save information retrieved in a Browse (or Edit) form to XML output in order for a spreadsheet application (e.g. Excel) to pull up the data? I have not noticed this in the help files. Are there sample codes examples that illustrate this?
    Is exporting data to XML even possible using JDeveloper 9.0.3?

    You can call write XML on your ViewObject to get an XML representation.
    If you are using IE you can change the content type for a page to :
    <%@ page contentType="application/vnd.ms-excel" %>
    This will open excel within your browser. It seems to deal nicely with any data in the page that is formatted in HTML <table> elements.
    Matt

  • XML Export Duplicates Data

    Background: 
         I cut a 24 page form down to 5 pages for testing the XML Import and Export functions.
         I then filled out the 5 page form completely and exported the data to an XML file.
         I added 1 additional field to to Page1 that was not previously there and put the entire 24 page document back together.
         I then imported my saved XML into the new larger document and everything looked fine. The first 5 pages were populated as expected.
         The rest of the form was completed and then exported to a new XML file.
         The section on page 1 where I added an additional field is duplicated after page 5 and then moves on 2 page 6.
    The structure of the raw XML file appears as follows:
    <form1>
    -      <page1>
                 <Main>
                        List of original data fields and data
             </Main>
       </page1>
        <page2>
        </page2>
        <page3>
        </page3>
        <page4>
        </page4>
        <page5>
        </page5>
         <page1> 
                 <Main>
                        List of data fields and data with new field added in.
             </Main>
       </page1>
        <page6> etc...
    When I import the XML file into my Access 2003 database, I receive an error message that there is duplcate data. The first Main section is imported and the revised one is dropped.  The same thing happens if I open the XML in Excel.  I see the original data structure and not the new one with the additional field.
    Any thoughts?

    yup. you can do this by "Approve Multiple Assets" option available in your publish destination.
    click on "Approve Multiple Assets", Select required asset types and select query as "Assets of selected asset type(s) in site: <yoursite>" and click on Approve.
    This will approve all your assets in one go.
    hope it helps.

  • Exporting form field data to xml

    Hello,
    I want to export pdf form data to xml file.
    I don't want to use adobe Livecycle Designer.
    I want to save the data in xml file where pdf file is present.
    i have created button as export.
    when user clciks on export button, the data has to be exported to xml file.
    how can i do this using Java script, is there any sample code available?
    Please help me
    Thanks in avance,

    thanks for your help.
    I want to save form data to xfdf file, on click of button.
    I have written below code in one .js file.
    Export = app.trustPropagatorFunction(function(oDoc, sPath, bXDP, sPackets)
    app.beginPriv();
    oDoc.exportXFAData(sPath, bXDP);
    app.endPriv();
    TrustedExportXFAData = app.trustedFunction(function(oDoc, sPath, bXDP, sPackets)
        var bSuccess = false;
        app.beginPriv();
        try {
            Export(oDoc, sPath, bXDP, sPackets);
            bSuccess = true;
        catch(e){
            app.alert(sPath  + " NOT exported!\n" + e.message + "\n" + e.name);
        app.endPriv();
        return( bSuccess );
    on button mouseup action i am calling trusted function as
    TrustedExportXFAData(this, "/c/testing", "True", "*");
    I am getting error as /c/testing NOT exported
    Secuirty settings prevent access to this property or method.
    NotAllowedError.
    Please help me to solve this issue.a

  • 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.

Maybe you are looking for