How to read and save the following XML-Doc?

Hi all,
I have a XML-Document:
<root>
<employees>
<emp1>
<ename>Test1</ename>
<empno>1</empno>
<sal/>
<ord>
<item>1</item>
</ord>
</emp1>
<emp2>
<ename>Test2</ename>
<empno>2</empno>
<sal>1000</sal>
<comm>200</comm>
<ord>
<item>3</item>
</ord>
</emp2>
</employees>
</root>
This should I save in the databse table:
CREATE TABLE XML_DOC
ID NUMBER(38),
FATHERTAG NUMBER(38),
TAGNAME VARCHAR2(250),
TAGCONT VARCHAR2(4000)
And tha data should be saved in the following format:
=======================================
| ID | FATHERTAG | TAGNAME | TAGCONT|
| 1 | | root | |
| 2 | 1 | EMPLOYEES | |
| 3 | 2 | EMP1 | |
| 4 | 3 | ENAME | Test1 |
| 5 | 3 | EMPNO | 1 |
| 6 | 3 | SAL | |
| 7 | 3 | ORD | |
| 8 | 7 | ITEM | 1 |
| 9 | 2 | EMP2 | |
Has anyone any Idea how to realize it?
Regards

Leonid,
Why don't you just store the xml document in the database as an xmltype? You could then build a view over the object-relational table to pull the data out into the format you want.
The following code Example is from one of my favorite DBA's Johnathan Gennick and can be found at this link.
http://www.oracle.com/technology/oramag/oracle/03-jan/o13xml.html
CREATE VIEW cd_master (Title, Artist, Website, Description) AS
SELECT extractValue(value(x),'/CD/Title'),
extractValue(value(x),'/CD/Artist'),
extractValue(value(x),'/CD/Website'),
extractValue(value(x),'/CD/Description')
FROM CD331_TAB x;

Similar Messages

  • How to read values from the following XML?

    I have been using "extractValue" to get the values from a xmltype field and no problems until now.
    The xmltype now is like:
    <a>1</a>
    <b>2</b>
    <c>1221</c>
    <c>1412</c>
    <d>11111</d>
    <e>3333</e>
    I'm able to read values from 'a,b,d,e' but not from 'c'.
    Questions:
    1)- Is posible to read the values of field c?. How?
    2)- If is not posible to read the field values, Is posible to transfor the xmlfield to:
    Where I will be able to use xmltable columns and loop getting the values.
    <a>1</a>
    <b>2</b>
    <k>
    <c>1221</c>
    <c>1412</c>
    </k>
    <d>11111</d>
    <e>3333</e>
    Like always
    Thank you in advance for your help.
    Jose Galan

    SQL> with XML as
      2  (
      3   select xmltype(
      4  '<root>
      5    <a>1</a>
      6    <b>2</b>
      7    <c>1221</c>
      8    <c>1412</c>
      9    <d>11111</d>
    10    <e>3333</e>
    11  </root>'
    12  ) XMLDOC
    13    from dual
    14  )
    15  select a, b,c, d, e
    16    from XML,
    17         XMLTABLE
    18         (
    19            '/root'
    20            passing XMLDOC
    21            columns
    22            A number(5) path 'a',
    23            B number(5) path 'b',
    24            D number(5) path 'd',
    25            E number(5) path 'e',
    26            C_XML_FRAG xmltype path 'c'
    27         ),
    28         XMLTABLE
    29         (
    30           '/c'
    31           passing C_XML_FRAG
    32           columns
    33           C number(5) path '.'
    34         )
    35  /
             A          B          C          D          E
             1          2       1221      11111       3333
             1          2       1412      11111       3333
    SQL>

  • How to modify and save the data in the table control

    how to modify and save the data in the table control

    hi priya,
    kindly go thru the code below.
    PROCESS BEFORE OUTPUT.
      MODULE status_9010.
      LOOP WITH CONTROL tab_control.
        MODULE move_data_to_table.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_cancel AT EXIT-COMMAND.
      LOOP WITH CONTROL tab_control.
        MODULE move_data_from_table.
      ENDLOOP.
    MODULE move_data_to_table OUTPUT.
    This is to move the data from the internal table to *the table control
    *zmpets_mode-modecode, zmpets_range-rangeid, *zmpets_servfacto-factor are field names of the table *control columns.
      READ TABLE int_factor INDEX tab_control-current_line.
      IF sy-subrc = 0.
        zmpets_mode-modecode = int_factor-modecode.
        zmpets_range-rangeid = int_factor-rangeid.
        zmpets_servfacto-factor = int_factor-factor.
      ENDIF.
    ENDMODULE.                 " move_data_to_table  OUTPUT
    **********************************************8888
    MODULE move_data_from_table INPUT.
    *To move the data from the table control to internal *table 'INT_FACTOR'.
      int_factor-chk = line.
      int_factor-modecode = zmpets_mode-modecode.
      int_factor-rangeid = zmpets_range-rangeid.
      int_factor-factor = zmpets_servfacto-factor.
       MODIFY int_factor INDEX tab_control-current_line.
        IF sy-subrc NE 0.
          APPEND int_factor.
          CLEAR int_factor.
        ENDIF.
    ENDMODULE.                 " move_data_from_table  INPUT
    if this helps , kindly award points.
    for any clarification just mail me.
    regards,
    Anversha.S
    [email protected]

  • HT204089 I have a samsung smart TV and record free to air TV shows on my TVO I would like to purchase from iTunes a TV series called outlander but do not know how to transfer and save the episodes on my TIVO I will be using my iPad to purchase and downloa

    I Have a  samsung smart TV  and use TVO to record  free to air programmes .
    i would like to purchase from iTunes using my iPad , a TV series called outlander but do not know how to transfer and save the episodes to my TIVO
    please help

    Many videos in the iTunes store are protected so that they can only be viewed on Apple Devices signed into your iTunes account.  If that is the case then your TiVo will not be able to read the files.  If you know how to get a video file onto your TiVo from a flash drive, then just plug a flash drive into your Mac and drag one of the videos from inside the iTunes window onto the icon for the flash drive on your Desktop or in the left sidebar of a Finder window.  That will copy the actual file onto the flash drive. 

  • How to read and update the value of property file

    Hi,
    I am not able read the values from property file.
    Please tell me how to read and update the values from property file using Properties class
    This is my property file : - Config.properties its located in D:\newfolder
    Values
    SMTP = localhost
    Now i need to change the value of the SMTP
    New value :
    SMTP =10.60.1.9
    Pls Help me
    Thanks
    Merlin Rosina,

    Post a small (<1 page) example program that forum members can copy and run that demonstrates your problem.

  • How to read and parse a remote XML file with Java

    Hi.
    Using J2SE v1.4.2, I'd like to read and parse a remote file:
    http://foo.com/file.xml
    Is it possible with Java? I'd be extremely grateful if someone could provide me any webpage showing a very simple code.
    Thank you very much.

    How about the following?
         import java.io.InputStream;
         import java.net.URL;
         import javax.xml.parsers.DocumentBuilder;
         import javax.xml.parsers.DocumentBuilderFactory;
         import org.w3c.dom.Document;
         public static void main(String[] args) throws Exception {
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db = dbf.newDocumentBuilder();
              URL url = new URL("http://foo.com/file.xml");
              InputStream inputStream = url.openStream();
              Document document = db.parse(inputStream);
              inputStream.close();
         }-Blaise

  • How to read and save complex data (amplitude and phase) from pna E8361C

    Hi, all,
    I installed the PNA series driver to my PC. And I got wavefrom from the PNA but always the amplitude. How can I get also phase info from the PNA and save it to my text file?

    I did installed the driver for that PNA, I can select the format such as amplitude or phase, but I can only see one of them at one time.
    Could it be seen and save simultaneously?

  • How to read and write the data like this(is JSON?)?

    i have some data like below(is json?),how to write them into
    the database?
    i user coldfusion 7.
    {"title":"ColdFusion?","url":"
    http://www.adobe.com/cfusion/"},
    {"title":"flex blogs","url":"
    http://www.flexblogs.com/"},
    {"title":"studio","url":"
    http://www.sans.com.com/"}
    Thank you very much!

    You need to parse it and then insert the records into your
    database.
    Take a look at
    CFJSON it is a JSON
    serialiser and de-serialiser.
    Once you have converted it to native CF datatypes you can
    loop through it and insert it into your database.

  • How to get and save the incoming filename in to db in biztalk.

    Hi,
    I need to save the incoming file name in to a table in biztalk.
    Below are the steps which are needed
    1) Need to get the incoming file in orchestration
    2) Map the incoming file in to field from source to destination schema(db) - such that file name will get stored in to table with other fields directly.
    Your help is greatly appreciated.....
    Thanks,
    Vijayan
    vijayan

    Per my understanding ,
    -> you are trasforming incoming message to outbound message(for database).
    -> One of the elements in oubound message is (let's say) FileName and is inserted into database.
    -> And, you want to map incoming file name in outbound message field(FileName).
    There could be any below resolutions:
    Option1 : In orchestration, if inbound message is MsgIn and outbound message is MsgOut and destination schema element FileName is made as distinguished field then write below in construct message and message assignment shape.
    MsgOut1=MsgOut;
    MsgOut1(*)=MsgOut(*);
    MsgOut1.FileName = MsgIn(BTS.ReceivedFileName).
    //BizTalk engine promotes incoming message file name in property schema BTS.bts_system_properties.
    Option2 : ->Create schema class of destination schema using xsd.exe tool(in BizTalk server installation folder).
    ->After this , a class file will be generated.
    -> Create instance of this file and assign like below in expression shape.
    obj.FileName=MsgIn(BTS.ReceivedFileName).
    Then, in message assignment shape, assign instance to outbound message.
    MsgOut=obj.
    Thank you.
    Nishant Garg
    BizTalk Developer/Admin/Trainer

  • How to read and store the documents from other system to own system.

    Hi Experts,
    i need to read the document from other system (Say from other connected R/3 system) and then i need to save it in my system.
                     Please suggest how would i proceed?
    Any helpful suggestion will be rewarded with points.
    thanks
    Snehasish

    Hi Abaper
    I think I havent explained my problem well. Here I am explaining it again..
    I want to pull an  *.excel/ *.csv file through ABAP code.The target file that I want to access in my ABAP code is stored into another PC in the same Local area network under some directory say 'c:\temp\credit.csv'.
    I have the logon information of the target file's  PC.
    Please help me with code if anyone of you having.
    Thanks in advance.
    Rgds,
    Snehasish
    Edited by: Snehasish Das on Apr 29, 2008 2:18 PM
    Edited by: Snehasish Das on Apr 29, 2008 2:33 PM

  • How to read and store the data from an email ?

    If there is any sample code available then it will be very helpfull
    Thanks

    You're not trying very hard.
    It's at the top of this forum:
    [http://forums.sun.com/forum.jspa?forumID=43&start=0|http://forums.sun.com/forum.jspa?forumID=43&start=0]
    It's in the documentation included with the JavaMail download.
    Oh, and have you heard of this thing called "google"?
    Try searching for "JavaMail FAQ".

  • How to read and print the data that is in the BB Desktop Software backup file

    I recently backed up my BB Tour 9630 to the BB Desktop Software. I would like to know if there is a way to open this file on my desktop so I can see the data. Also, I would like to know if there is a way I can print ( hard copy ) this data from that file. Right now, I see no way to open the file.  Thanks, Jeff

    Hi,
    Check the below wiki link if it helps.
    http://wiki.sdn.sap.com/wiki/display/CRM/Howtodisplayaz-tableinanassignmentblock
    Also, you can try an option of transaction launcher.
    Hope this helps.
    Regards,
    Chandrakant

  • Read and assign the highest value

    Hi experts
           I want to read the highest value of the records in a condition basis for example matnr wise then assign that value to some records.
         how to read and assign the value, pls help me out.
    Thanks in advance.
    regards
    Rajaram

    hi
    sort itab by <fildname> descending.
    read table itab  into wa index 1.
    assign wa-fildname to the required records or variables
    regards
    vijay
    reward points if helpful

  • How to edit bitmap which is imported in flash using xml and save the edited bitmap back to xml in flash.

    hi all
    It would be appreciated if any one let me know how to edit
    bitmap which is imported in flash using xml and save the edited
    bitmap back to xml in flash.
    Is it posible to save the bitmap data in flash?
    thanks in advance

    Yes you can... but like I said before you need to upload the
    data from the changes you make to a server.
    In terms of the solution... its unlikely that you'll find one
    specifically for your needs. You will have to learn whatever you
    don't know how already and maybe adapt some existing examples to
    your needs.
    To change the visual state of a movie clip... you just do all
    the regular things that you want to do to it using flash... scale,
    rotation, drawing API , textfields etc in actionscript. If you
    don't know how to how to do that stuff, then you need to learn that
    first. That's basic actionscript.
    You can capture the visual state of a movieclip using the
    BitmapData class. That includes a loaded jpeg. You can also
    manipulate bimatp data using the same class. You should read up on
    that if you don't know how to use it or check out the examples
    below for uploading info.
    For uploading to the server:
    Here's an as2 solution that took 15 secs to find using
    google:
    http://www.quasimondo.com/archives/000645.php
    If you're using as3, google search for "jpeg encoder as3" and
    look through that info. There are also historical answers in the
    forums here related to this type of thing that might help as
    well.

  • With my new macbook I attempted to open an older spreadsheet and get the following error message:  "This spreadsheet cannot be opened because ti is too old.  To open it, save it with numbers '09 first"  So how does one do this when I only have ver3.1?

    With my new macbook I attempted to open an older spreadsheet and get the following error message:  "This spreadsheet cannot be opened because ti is too old.  To open it, save it with numbers '09 first"  So how does one do this when I only have ver3.1?

    Numbers 3.x can only open Numbers '09 and later.  You will need Numbers '09 to open Numbers '08 files.
    If it is a single file (or only a few) you can email me and I will open and convert then email back.  My email address is in the "Biography" of my profile.
    You may have Numbers '09 installed.  Look in the folder "/Applications/iWork '09"  if Numbers is in that folder launch it, open the file you tried to open, and save.  Then you should be able to open in Numbers 3.x

Maybe you are looking for

  • Table for storage location stock data

    Hi All, I have a report in which i have to pull the data for all storage locations. I need to display the Quantity of each material in storage location , Total price of individual materials(amount), and the plant information. Thanks: Siddharth

  • Backing up RMAN

    Hi, I have created RMAN in 92 database and registered the target database which is also 92. I'd like to backup the RMAN itself using export mechanism. Is there a specific table or tablespace I need to export or should I export the entire RMAN schema

  • [Solved] I can't install CS6

    hey all, I'm trying to install Adobe Audition CS6 Trial. I downloaded the packet 2 times, but I always get the same issue. During installation it stucks at AdobeHelp installation and doesn't go ahead... why??? EDIT: I killed the process about AdobeHe

  • How do you install CF 9 on OSX Mavericks

    I've tried this on a couple of machines and I continue to get an error stating "ColdFusion 9 Installer" is damaged and can't be opened.  There are a couple error messages in the console, but nothing that's immediately obvious to me.  Any help would b

  • FBL5N performance issue

    Hi SAP Experts, Users in one of our production systems are having extremely slow performance when running tcode FBL5N. I have already asked them to run the report with smaller data/selection criteria (e.g. limiting posting dates, company codes, etc)