How to load XML file to DB

Hi All,
My requirement is I have a XML file, its data should be stored in Database.
Below is the sample XML file.
<?xml version="1.0"?>
<PaymentInfoMessageResponse>
<PaymentInfoResponse>
<TransactionType>940</TransactionType>
<SequenceNum>04</SequenceNum>
<CompanyCode>902</CompanyCode>
</PaymentInfoResponse>
<StatusCode>OK</StatusCode>
<StatusDetail>OK</StatusDetail>
<ResponseItemCount>2</ResponseItemCount>
</PaymentInfoMessageResponse>
I have a table with columns name say TransType,SeqNum
the value 940,04 from XML file should be saved in TransType,SeqNum Column respectively
I am using file adapter with native format builder,selecting file type as complex type and
In design schema,I'm not able to proceed,i'm getting error in POP up as:
Native Format builder:error
No global elements exist.
How can i proceed or any other way to load XML file to DB.
urgent Help/suggestion is required.
Thanks in advance

HI all,
1)If my input is .txt file.
we can use file adapter,using native builder,sample it,
delimited/fixed length, we can do normal file read and file write/DB write.It works fine.
2)If my input file is xml file,we can't use native builder format(Because it doesn't support
delimited/fixed length/complex character in native format builder).
so,as said in the above reply,i took a sample XML file & converted to XSD using
File Menu > New > All Technologies tab > General > XML > XML Schema from XML Document.
It compiles fine.
Now,if i use file adapter(read) -- BPEL -- File adapter(write).
Inside Transform,i am mapping filereadVariable and filewrite Variable correctly.
If my input file is Abc.xml and its contents in read file are:
<?xml version="1.0"?>
<PaymentInfoMessageResponse>
<PaymentInfoResponse>
<TransactionType>940</TransactionType>
<SequenceNum>04</SequenceNum>
<CompanyCode>902</CompanyCode>
</PaymentInfoResponse>
<StatusCode>OK</StatusCode>
<StatusDetail>OK</StatusDetail>
</PaymentInfoMessageResponse>
In write folder,my contents are
<PaymentInfoMessageResponse>
<imp1:PaymentInfoResponse>
<imp1:TransactionType/>
<imp1:SequenceNum/>
<imp1:ReceiptTime/>
<imp1:CompanyCode/>
</imp1:PaymentInfoResponse>
<imp1:StatusCode/>
<imp1:StatusDetail/>
</PaymentInfoMessageResponse>
Now,if i use file adapter(read) -- BPEL -- DB adapter(merge).
Inside Transform,i am mapping filereadVariable and DBmerge Variable correctly.
If my input file is Abc.xml and its contents in read file are:
<?xml version="1.0"?>
<PaymentInfoMessageResponse>
<PaymentInfoResponse>
<TransactionType>940</TransactionType>
<SequenceNum>04</SequenceNum>
<CompanyCode>902</CompanyCode>
</PaymentInfoResponse>
<StatusCode>OK</StatusCode>
<StatusDetail>OK</StatusDetail>
</PaymentInfoMessageResponse>
My output in em console is like this.
<CeStatementHeadersIntCollection>
<top:CeStatementHeadersInt>
<top:statementNumber/>
<top:bankName/>
</top:CeStatementHeadersInt>
</CeStatementHeadersIntCollection>
NO data is being inserted into DB.
I can write my XMl file into write folder as it is using opaque object(No native format translation)
I can write XML file into DB using BLOB data type.
But my requirement is:
I have a table with columns name say TransType,SeqNum
the value 940,04 from above XML file should be saved in TransType,SeqNum Columns respectively.
Can i do it using DOM parser/SAX parser?
So any suggestion/help required
Thanks in advance

Similar Messages

  • How to load XML files ? HELP!

    Hi folks.
    We have an old Oracle database 7.3..
    So we need to load XML files into its tables.
    As we understand Oracle Loader doesn't help us.
    Is the way to load that files?
    Thanks in advance
    Alex

    I know you realize 7.3 is old but this is sort of like trying trying to view a DVD when you only have a VCR. Simple answer would be buy a DVD player, i.e. upgrade to a more recent version of Oracle where you will get many features to handle XML.
    How do you want the XML loaded, all as a single object? That could be a CLOB column if 7.3 had them, I am not sure. You would probably have to write PL/SQL and something with UTL_FILE (if 7.3 had that) to load it.
    If you want to put it multiple columns based on its tags, you would be better off parsing it using PERL (or something) into a CSV and loading that in SQL*Loader.
    I assume as this is using XML it is a reasonably recent design, combining that with an ancient version of the database is just going to lead to endless headaches.

  • How to load XML File to BW Delta Queue via Webpage

    Hello altogether,
    I am trying to load an CSV file via Webpage (the Webpage have to change the csv file in a xml/soap file) into BW Delta Queue.
    Steps that I have made:
    - Create an InfoSource
    - Create an BW Data Source with Soap Connection
    - Create an initial Delta without Data Transfer
    - Create a Web Service with TC - SE37 - Utilities -> More Utilities -> Create Web Service
    If I test the Web Service with TC - Soamanager (BW 7.0), the data entered here, are transferred to the BW Delta Queue.
    If I test the function module ( TC - SE37), the data also transferred to the Delta Queue.
    Now I think, that I have an error in the html file or the html file is not conform to the wsdl document?? Or should I have to create a virtual interface, but I don't find a possibility to creat it...???
    Can you please help me????
    The coding of the WSDL Document and the Website is attached (I can also send you the coding and error message via mail, if you want). Sorry I don't know how to display here the coding. I try it with symbol "click to display the text code", but afterwards I get an error message from the website...   So let me please know your mail address and I send it via mail....
    I hope, that somebody can help me!!!!!
    Edited by: Alina99 on Sep 8, 2009 11:44 AM
    Error Message from BW:
    ...sap-env:envelope..... soap-env:body><soap-env:fault><faultcode>soap-env:Client</faultcode></faultstring xml:lang="eng">Virtual Interface Method&gt;_-BI0_-QI6AZ_XML_APPL2_RFC::urn:sap-com:document:sap:soap:functions:mc-style&lt;not supported</faultstring>.......
    Edited by: Alina99 on Sep 8, 2009 11:56 AM

    Hello,
    I have done all the necessary config in BW. However, as I mentioned earlier, we are still not up with XI so I am trying to load XML to BW delta queue.  The question still remains, how do I make make the XML file (on my desktop say) point to the BW so the InfoPackage picks up and places in the delta queue?  Even if I had XI, there has to be a way whereby BW looks for the XML file.  That is what I want to know and stuck at.
    Any detailed step by step help will be appreciated as always.
    Cheers

  • How to load XML file to table (non-XML) with SQL*Loader -- issue with nulls

    I have been attempting to use SQL*Loader to load an XML file into a "regular" Oracle table. All fields work fine, unless a null is encountered. The way that nulls are represented is shown below:
    <PAYLOAD>
    <FIELD1>ABCDEF</FIELD1>
    <FIELD2/>
    <FIELD3>123456</FIELD3>
    </PAYLOAD>
    In the above example, FIELD2 is a null field and that is the way it is presented. I have searched everywhere and have not found how I could code for this. The issue is that if FIELD2 is present, it is coded like: <FIELD2>SOMEDATA</FIELD2>, but the null is represented as <FIELD2/>. Here is a sample of the control file I am using to attempt the load -- very simplistic, but works fine when fields are present:
    load data
    infile 'testdata.xml' "str '<PAYLOAD>'"
    TRUNCATE
    into table DATA_FROM_XML
    FIELD1 ENCLOSED BY '<FIELD1>' AND '</FIELD1>',
    FIELD2 ENCLOSED BY '<FIELD2>' AND '</FIELD2>',
    FIELD3 ENCLOSED BY '<FIELD3>' AND '</FIELD3>')
    What do I need to do to account for the way that nulls are presented? I have tried everything I could glean from the web and the documentation and nothing has worked. Any help would be really appreciated.

    I hadn't even got that far. can you direct me to where the docs are to import data that is stored within xml but that you don't need any xml functionality, that just happens to be the format the data is stored in? thx

  • How to load XML files into ORACLE8i database?

    SAP data is being extracted into XML format (via IDOC) files which are being transferred to an ORACLE8i box. There will be a large amount of data transferred on a daily basis which will include updates and inserts. From all the information that I have read on this subject there are 2 options available :
    1. XML-SQL Utility - which converts XML into INSERT, UPDATE or DELETE SQL. There does not appear to be that much functionality available by this method for decodes, transformations on the input data.
    2. SQL*Loader - There was a statement in 1 piece of documentation stating that SQL*Loader could be used for loading XML format data files. I cannot however find any further information on how this is achieved or how it works.
    If anyone has any experience in loading XML format data files using either of the above methods (preferably SQL*Loader as it has more functionality) then could you please provide me with examples or guidance on this matter? Any help would be greatly appreciated as I am not familiar with XML format data files. I am from an Oracle 7.3 background but do not have much experience with Oracle 8 onwards.
    Disclaimer.
    Any views expressed in the above paragraphs are my own and not that of Hewlett Packard Ltd.

    We are loading XML into our database using CLOB datatypes. We don't use the XSU for inserts as it is too slow. We parse the incoming XML document into a PL/SQL record type and then build a generic insert. This might not work well if you have many tags to parse into columns. We also store the entire XML CLOB into a column without parsing the individual tags into separate columns. We then use Intermedia Text for fast, index-based searching within the XML column.
    Check out The Oracle XML Portal website for code examples on how to do this:
    www.webspedite.com/oracle

  • How to load xml file data

    hi ,
    I know how to load data from csv file...
    Anyone can guide me for how to load data from xml file
    i need step by step guidence
    from
    naman

    hi naman shah,
    you can used XML DOM in SAP in order to read data from xml file
    first step to do that, you need to read the xml file using OPEN DATASET
    after that you convert the content of the file to XML DOM class in SAP using function modul SDIXML_XML_TO_DOM
    after that you can read / manipulate the data from xml.
    for the XML DOM class documentation in SAP, please refer to http://help.sap.com/saphelp_crm50/helpdata/en/bb/576637dca511d4990b00508b6b8b11/frameset.htm
    hopes it helps
    regards
    eddhie

  • How to load XML files into oracle

    I am new to XML.I have a few XML files.I want to load them into oracle.I have oracle client on my win2000 machine version 8.1.6.3.
    I cannot find Loadjava.jar file in ORACLE_HOME\bin directory.
    Where is the XSU-dsl and the XDK utility?Do i need to down load it?

    This forum is dedicated to the XML Features of 9iR2, and to a lesser extent 9i. Questions related to XML and earlier versions of the database should be posted in Technologies -> General -> XML...
    I will move this thread to the appropriate forum if required.

  • How to load XML file as is to database table  ?? CLOB

    I want to store a XML file into the database and then use
    Intermedia search facility to search the document. How can i
    achieve it. Searching the document has been pretty well
    explained. But i don't find an example showing storing a file as
    is to a table in a CLOB. If somebody can guide me it will be
    helpful. I'm new to intermedia stuff.
    I'm using oracle 8.1.7 database.
    Pls mail me at [email protected]
    Thanx in advance
    Arun

    Please check the feature of the day "Searching for content and
    structure in XML documents". Note that works with 9i.
    http://otn.oracle.com/products/oracle9i/daily/nov30.html
    I want to store a XML file into the database and then use
    Intermedia search facility to search the document. How can i
    achieve it. Searching the document has been pretty well
    explained. But i don't find an example showing storing a file as
    is to a table in a CLOB. If somebody can guide me it will be
    helpful. I'm new to intermedia stuff.
    I'm using oracle 8.1.7 database.
    Pls mail me at [email protected]
    Thanx in advance
    Arun

  • How to load XML file for Custom Pod in 7.5?

    I'm developing a custom pod for our Connect 7.5 deployment, and I'm attempting to load an XML file that resides in the assets/ folder of my project. I run the pod in Flash Builder 4.5 to debug and it works just fine. Whenever I load the pod into our Connect 7.5 solution, it appears as if none of the events for the URLLoader are triggered.
    Is there something else I need to do? Please help!  Note - I have tried loading XML both from an actual URL and locally. Both work fine in the IDE just not when pod is in Connect.
    Thanks

    Did you follow the guidelines in the Connect 6 SDK documentation? This document was applicable from version 6 through 7.5.
    http://help.adobe.com/en_US/Connect/6.0/SDK/help.pdf
    Your SWF needs to be named index.swf to work, as I recall.

  • How to Load XML files into Oracle 8 database.

    My company is currently using Oracle Aplications V. 10.7 character mode and intend to migrate to V.11.0.3 in the next months.
    We want to import data (XML format) in the OE module using Open Interfaces.
    How to proceed ?

    This forum is dedicated to the XML Features of 9iR2, and to a lesser extent 9i. Questions related to XML and earlier versions of the database should be posted in Technologies -> General -> XML...
    I will move this thread to the appropriate forum if required.

  • Loading XML file

    Hi All,
               How to load xml file from backend.
              i have 5 xml files in databse. i need to get the xml files from database sequentially .means i need to get in a for loop.
    how can i do this.
    any one can help?
    thanks
    Raghu

    is your front end in Flex?
    Sammi

  • Can I load xml file from SWC without using @embed

    I'm developing a mobile application in which I need to load xml files from File.applicationDirectory. This works great if the xml files are part of the main application swf. But I would like to move these xml files into a SWC so they could be shared across multiple applications.
    Using FlashBuilder 4.5, when a SWC is built, I can specify files to embed in the library that are not assets (Assets Tab of Flex Library Build Path). For various design reasons, I do NOT want to embed the xml files via @embed.
    When the swc is built and I open it up using a zip utility, I see the xml files in there just fine. So they are being bundled with the SWC. But how can I load these files in my main application that does not involve using @embed? When the main application is built, the swc setting for link type is "merged into code".
    I wouldn't expect the application to automatically pull out the xml files from the swc and place them in the File.applicationDirectory on the mobile device. I've tried loading from there just in case but file.exists is false (as expected).
    I've searched the web (and continue to do so) and all the answers seem to be to use @embed. Is there another way?
    Randy

    It's actually a lot easier than you think.
    Just reference the file like any'ol URL using a path relative to the SWC's src directory.
    So if you include the file "assets/xml/some.xml", just use that same string like you would any remote resource.
    For example:
    var loader:URLLoader = new URLLoader( new URLRequest("assets/xml/some.xml"));
    I believe it would also work like this "/assets/xml/some.xml", but I prefer relative paths so the link doesnt break if moved out of the SWC...

  • Loading XML file to BI 7

    Hi,
    I have a requirement to load XML file from Application server to BI 7. Most of the documents I saw online are related to BW 3.X.
    does any one have good examples of how this can be done in BI 7.
    thanks

    hi
    check the SAP documentation for loading XML file to BI
    http://help.sap.com/saphelp_nw70/helpdata/en/fe/65d03b3f34d172e10000000a11402f/frameset.htm

  • Loading XML file into DB Table

    Hi
    I m quite new to the loading XML file into database table.
    It will be great if anyone could guide me to through.
    Now,
    i have an XML file which has to be loaded into the DB table.
    what are the steps involved in doing this. How do i go from here ??
    your help is greatly appriciated ???
    Thank you so much!!
    -Shashi

    OK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
    (there are multiple ways - and this is not the most simple one)
    Based on Oracle 11gR1
    -- sqlplus /nolog
    clear screen
    set termout on
    set feed on
    set lines 40
    set long 10000000
    set serveroutput on
    set lines 100
    set echo on
    connect / as sysdba
    col filename for a80
    col xml      for a80
    -- Create schema “OTN”
    drop user OTN cascade;
    purge dba_recyclebin;
    create user OTN identified by OTN;
    grant dba, xdbadmin to OTN;
    EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
    prompt pause
    pause
    clear screen
    -- Create directory
    connect OTN/OTN;
    show user
    drop directory OTN_USE_CASE;
    CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
    SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from   dual;
    prompt pause
    pause
    clear screen
    -- Directory Listing - Tom Kyte
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace
      and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    {public static void getList(String directory)
                       throws SQLException
    {   File path = new File( directory );
        String[] list = path.list();
        String element;
        for(int i = 0; i < list.length; i++)
        {   element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    prompt pause
    pause
    clear screen
    -- The content of the global temporary table
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list;
    -- "COMMIT" will clear / truncate the global temporary table...
    prompt pause
    pause
    clear screen
    -- Combined: Reading XML content from multiple XML files
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list where filename like '%.xml'
    and rownum <= 10;
    prompt pause
    pause
    clear screen
    select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from dir_list dl
    where dl.filename like '%.xml' and rownum <= 2;
    prompt pause
    pause
    clear screen
    -- If you can select it you can insert it...
    -- drop table OTN_xml_store purge;
    create table OTN_xml_store of xmltype
    xmltype store as binary xml
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    set time on timing on
    insert into OTN_xml_store
    select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
    from dir_list dl
    where dl.filename like '%.xml';
    set time off timing off
    commit;
    select count(*) from OTN_xml_store;
    prompt pause
    pause
    clear screen
    -- If you can select it you can create resources and files
    set time on timing on
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select count(*) from dir_list where filename like '%.xml';
    set serveroutput on size 10000
    DECLARE
    XMLdoc XMLType;
    res BOOLEAN;
    v_foldername varchar2(4000) := '/public/OTN/';
    cursor c1
    is
    select dl.filename FNAME
    , XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
    from dir_list dl
    where dl.filename like '%.xml'
    and rownum <= 100;
    BEGIN
    -- Create XDB repository Folder
    if (dbms_xdb.existsResource(v_foldername))
    then
    dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
    end if;
    res:=DBMS_XDB.createFolder(v_foldername);
    -- Create XML files in the XDB Repository
    for r1 in c1
    loop
    if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
    then
    dbms_output.put_line(v_foldername||r1.fname);
    null;
    else
    dbms_output.put_line('Loop Exception :'||sqlerrm);
    end if;
    end loop;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('Others Exception: '||sqlerrm);
    END;
    set time off timing off
    commit;
    prompt pause
    pause
    clear screen
    -- FTP and HTTP
    clear screen
    prompt
    prompt *** FTP - Demo ***
    prompt
    prompt pause
    pause
    host ftp
    -- open localhost 2100
    -- user OTN OTN
    -- cd public
    -- cd OTN
    -- ls
    -- bye
    clear screen
    prompt
    prompt *** Microsoft Internet Explorer - Demo ***
    prompt
    prompt pause
    pause
    host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
    prompt pause
    pause
    -- Accessing the XDB Repository content via Resource View
    -- Selecting content from a resource via XBDUriType
    clear screen
    prompt set long 300
    set long 300
    prompt Relative Path - (path)
    SELECT path(1) as filename
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 10
    prompt pause
    pause
    clear screen
    prompt Absolute Path - (any_path)
    select xdburitype(any_path).getClob() as xml
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 1;
    prompt pause
    pause
    -- CLEANUP ENVIRONMENT
    clear screen
    prompt
    prompt >>>>> Clean UP !!! <<<<<<
    prompt
    prompt Cleanup environment and drop user...!!!
    prompt
    pause
    clear screen
    conn / as sysdba
    alter session set current_schema=OTN;
    begin
    dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
    commit;
    end;
    alter session set current_schema=sys;
    drop user OTN cascade;
    Based on http://www.liberidu.com/blog/?p=1053

  • How to open XML file in Netscape

    How to open XML file in Netscape.....
    XML file is opening correctly in IE, but giving error in Netscape.Error is
    Error loading stylesheet: Parsing and XSLT stylesheet failed....
    Reply me soon..............

    You may check these tips:
    How to Access Local File Systems from J2ME devices using FileConnection API
    http://www.java-tips.org/content/view/109/73/
    Opening and reading a file on the mobile device
    http://www.java-tips.org/content/view/352/73/

Maybe you are looking for

  • SOA 11g: Intergation with BAM 11g failed with ThreadPool has stuck threads

    Hi, I have installed BAM and SOA server on local host. Now while integrating BAM with BAMAdapter it's going into long running state and finally failing with below error. <Notice> <Diagnostics> <mars.as.local> <soa_server1> <[ACTIVE] ExecuteThread: '1

  • Attachment from item master to SO

    The Client (on 11.5.10) needs to carry forward the attachments from item master to the SO. None of the document categories were carried to SO. I created a new document category in OM and enabled it for Forms 'Sales Orders' and 'Item master'. But this

  • IC CS4 is showing a lot of excess changes

    Hi Everyone, I've got an issue with IC CS4 and I'm not sure where to look so hopefully someone can shed some light, now I'm a novice with IC so bear with me.  Here's what one of my user is experiencing. One of our article keeps showing up in incopy w

  • How do I remove Adobe Reader from Safari

    Last week, I downloaded an updated version of Adobe Reader. I did not select it as my Safari pdf reader. Nonetheless, it has replaced Preview as the default pdf reader in Safari. How do I get rid of Adobe Reader as the default pdf reader in Safari an

  • Page never completely loads (busy circle)

    In Firefox the green busy circle (in the upper tab) stays in an endless loop indicating that it's trying to load something. Is this "normal"?  Perhpas it does this when there are audio clips that are set to not autoplay? I ran a site report. No error