Help on parsing and storing XML data

Hi :
I have a huge file with a format similar to this.
<EmployeeDB>
<employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Prag</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
</EmployeeDB>
I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
What I want to do is store each employee's XML as a seperate record.
For example: My table data should look like this
EmployeeID(Number) EmployeeXML (XMLType)
1 <employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
2 <employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
What I need is a code to take the document and insert the records as above.
Please send me the code if you have to [email protected]

Yes, I am using oralce 9i release 2

Similar Messages

  • Help on parsing and storing XML file

    Hi :
    I have a huge file with a format similar to this.
    <EmployeeDB>
    <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    <employee>
    <name>Prag</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    </EmployeeDB>
    I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
    What I want to do is store each employee's XML as a seperate record.
    For example: My table data should look like this
    EmployeeID(Number) EmployeeXML (XMLType)
    1 <employee>
    <name>Steve</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    2 <employee>
    <name>Ray</name>
    <salary>20000</salary>
    <address>898 nobel drive</address>
    <city>san diego</city>
    </employee>
    What I need is a code to take the document and insert the records as above.
    Please send me the code if you have to [email protected]

    Yes, I am using oralce 9i release 2

  • How to Read and Write .XML datas   (HELP Plz...)

    hai everybody
    how to read and write xml datas... plz give clean and simple example..
    bcoz me want to produce such type of module...
    if any one help me .. thats the only way me laid in software ladder
    plz....
    thank u in advance

    thank u for giving idiot..
    but before posting i search in google also..
    but i cant get what me expect..
    thus i posted...
    then who is ................?
    sorry javacoder01
    // plz help me
    Message was edited by:
    drvijayy2k2

  • About the exporting and importing xml data file in the pdf form

    Hi all,
    I need help for importing xml data file in the pdf form. When I write some thing in the text field with fill color and typeface (font) and exported xml data using email button. When I imported that xml file in the same pdf file that is used for exporting the xml data then all the data are shown in the control but not color and font typeface. Anyone has suggestion for solving this problem. Please help me for solving this problem.
    Thank you
    Saroj Neupane

    Can you post a sample form and data to [email protected] and I will have a look.

  • Read and store XML data

    I have created a connection to a sample XML file and was wondering how you would go about reading from that data source and storing the data using JavaScript so that different data can be displayed based on user choices (e.g. dropdown list)? Can this data also be stored so that an end-user can open the PDF without needing to have a local copy of the XML file on their machine?

    I have created a connection to a sample XML file and was wondering how you would go about reading from that data source and storing the data using JavaScript so that different data can be displayed based on user choices (e.g. dropdown list)? Can this data also be stored so that an end-user can open the PDF without needing to have a local copy of the XML file on their machine?

  • Storing XML data in CLOB and relational tables

    I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Maciej Marczukajtis ([email protected]):
    I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.<HR></BLOCKQUOTE>
    Czesc Maciek,
    There are some good examples with XSQL Servlet. From what I understand you have one XML file and you need to save a portion of document in relational tables and other portion in CLOB.
    Yes, you can do that.
    You can do it many ways. I can suggest (2).
    1. Use the views
    2. call your java procedure that will do
    the xml processing, brake it down and insert
    releval frogments into different tables/columns
    null

  • Parse and render XML... and get original replicated?

    Now that I've (temporarily) got iFS working (on another machine for now). I've got an XML question: I moved the airportdefinition.xml into the folder, and then subsequently moved the airport.xml into the folder, whereupon iFS parsed it and stored it. Yeah! However when examining (or copy out) the stored data, it is somewhat different than the original:
    original:
    <?xml version="1.0"?>
    <Airport>
    <Name>airport1.fly</Name>
    <AirportCode>SFO</AirportCode>
    <AirportName>San Francisco</AirportName>
    <FolderPath>.</FolderPath>
    </Airport>
    As recreated by the renderer:
    <?xml version = '1.0' standalone = 'yes'?>
    <AIRPORT>
    <Name>airport1.fly</Name>
    <Owner RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></Owner>
    <ACL RefType="Name" ClassName="SYSTEMACCESSCONTROLLIST">Published<!--ID # 422--></ACL>
    <CreateDate format="MMM dd HH:mm">Nov 09 15:44</CreateDate>
    <Creator RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></Creator>
    <LastModifyDate format="MMM dd HH:mm">Nov 09 15:44</LastModifyDate>
    <LastModifier RefType="Name" ClassName="DIRECTORYUSER">system<!--ID # 96--></LastModifier>
    <LockState>0</LockState>
    <AIRPORTCODE>SFO</AIRPORTCODE>
    <AIRPORTNAME>San Francisco</AIRPORTNAME>
    </AIRPORT>
    We'd like (to have cake and eat it) to be able to store parsed xml (to support queryability, indexing, reporting, etc.) but also want to be able to recreate the original xml UNCHANGED.
    If we don't parse it, we can have unchanged data, but then limit the queryability. Other than storing the xml document twice (both parsed and not) is there any way to do this?
    null

    I am glad that you solve this question and share the solution with us, I will mark your reply as the answer.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to call and use xml data on UI LineChart using HTTPservice

    i want to make the LineChart component in the UI to get xml Array data from an URL (as example: http://localhost/ECG/Array) and view the data as a waveform. can anybody help me with this ??

    If you are saying that your XML is stored in a table, I'm not sure there is any method, using DAL or rule, that would know how to load XML from there. I can be wrong, but I think it has to load the XML from disk only - either as the extract file or as an external file referenced from the extract - using a Rule or DAL to go after the external file.
    Perhaps you could clarify the situation a little more and someone might offer a suggestion.

  • Parse and output XML document while preserving attribute order

    QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?
    The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
    Example: The following element
    <work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
    </work_item_type>is output as:
    <work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
    </work_item_type>As you may notice, there is no difference in these besides order of the attributes!
    I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.
    Please, someone help me out with this! I have a feeling the solution is simple
    The following take the XML from source.xml and outputs it to DEST_filename with attributes in a-z order
    Code:
    private void OutputFile(String DEST_filename, String style_filename){
         //StreamSource stylesheet = new StreamSource(style_filename);
         try{
              File dest_file = new File(DEST_filename);
              if(!dest_file.exists())
                  dest_file.createNewFile();
              TransformerFactory tranFactory = TransformerFactory.newInstance();
              Transformer aTransformer = tranFactory.newTransformer();
              aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
              Source src = new DOMSource("source.xml");
              Result dest = new StreamResult(dest_file);
              aTransformer.transform(src, dest);
              System.out.println("Finished");
         catch(Exception e){
              System.err.print(e);
              System.exit(-1);
        }

    You can't. The reason is, the XML Recommendation explicitly says the order of attributes is not significant. Therefore conforming XML serializers won't treat it as if it were significant.
    If you have an environment where you think that the order of attributes is significant, your first step should be to reconsider. Possibly it isn't really significant and you are over-reaching in some way. Or possibly someone writing requirements is ignorant of this fact and the requirement can be discarded.
    Or possibly your output is being given to somebody else who has a defective parser which expects the attributes to be in a particular order. You could quote the XML Recommendation to those people but often XML bozos are resistant to change. If you're stuck writing for that parser then you'll have to apply some non-XML processing to your output to fix it up on their behalf.

  • Master details tables and no xml data source

    Hello
    I want to create mater - details tables where details table will be repeated for each master row.
    So i created master table and placed detail table into master table cell.
    so what i want to have
    product1 quantity
                              - item1
                              - item2
    product2 quantity
                              - item3
                              - item3
    for now i have
    product1 quantity
                             - item1
                             - item2
                             - item3
                             - item3
    product2 quantity
    here is how i fill the table
    for i in 1..5 do
                ("Cell1r", "quantity" + i.ToString())
                ("Cell2r", "product" + i.ToString())           
            ] |>p
            for j in 1..2 do
                        ("Cell11", "product" + i.ToString())
                        ("Cell21", "serial" + j.ToString())
                        ("Cell31", "function" + j.ToString())
                    ]|>p
    i found an axample how to do it from xml data sourcem but have no idea and did not find how  to do it manualy(when i bing by name from code dynamicaly)

    i found hot to do it with xml source
    http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000241.html
    but how to do it manualy ?

  • Problem inserting and querying XML data with a recursive XML schema

    Hello,
    I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
    insert into category_a values
    (XMlElement("category",
          xmlattributes('categoryAAA' as "id"),
          xmlforest ('ma categ' as "name"),
          (xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))    
    The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
    Query 1
    select * from category
    Result : the whole row is returned
    Query 2
    select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
    Result: "SYS.XMLTYPE"
    now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
    Query 3
    select  xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from  category_a
    Result: null
    and also tried to extract the text portion of element <text> using this query
    Query 4
    select  xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from  category_a
    Result: "SYS.XMLTYPE".
    On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "&lt;". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
    My questions are about
    1. How to properly insert the XML data while preserving the tags (especially the opening tag).
    2. How to display the data (the text portion of the main Element or of the nested elements).
    The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
    In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
    I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "&lt;"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
    LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
    So, my third question is why are not the tags recognized during the insertion?
    Can anyone help please?

    Hello,
    indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
    I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
    Thank you very much.
    To answer your question Marco, I registered the XML Schema using the following code
    declare
      doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>';
    begin
      dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc,     LOCAL      => FALSE, 
            GENTYPES   => FALSE,  GENBEAN    => FALSE,   GENTABLES  => FALSE,
             FORCE      => FALSE,
             OPTIONS    => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
             OWNER      => USER);
    end;then, I created the Category table as follows:
    CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
        XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
    CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
      select category_v."CATEGORY_ID",category_v."CNAME",
      XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
      from  auction.category_a p, 
    xmltable ('$a/category' passing p.Object_Value as "a"
    columns  category_id varchar2(15) path '@id',
              cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
    create or replace PROCEDURE I_CATEGORY AS
    v_cname VARCHAR2(30);
    v_description clob ;
    v_category_id VARCHAR2(15);
    cursor mycursor is select category_id, cname, description from category_v;
    BEGIN
    open mycursor;
      loop
      /*retrieving the columns*/
      fetch mycursor into v_category_id, v_cname, v_description ;
      exit when mycursor%notfound;
      insert into category_xwh values
      (XMlElement("category",
          xmlattributes(v_category_id as "category_id"),
          xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
                                                               xmlelement ("Rollsup",
                                                                                  (xmlelement("all_categories",
                                                                                   xmlattributes('allcategories' as "all_category_id")))
        xmlforest (
                  v_cname as "cat_name",
                  v_description as "description")    
    end loop;
      commit;
      close mycursor;
    END I_CATEGORY;When I execute the procedure, I get the following error:
    LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
    Thanks for your help.
    Doulkifli

  • Storing XML Data in a Table

    I wan to store some XML Data in a table. The sole purpose is to break the big XML in smaller chunks so that I only work with what I need to. I am a newbie at this so any help will be appreciated.
    Sample XML:
    <root>
       <row id="1">
          <node1>hello</node1>
          <node2>hola</node2>
       </row>
       <row id="2">
          <node1>hello</node1>
          <node2>hola</node2>
       </row>
    </root>Expected Result in the table:
    ID             Data
    1             <row id="1"><node1>hello</node1><node2>hola</node2></row>
    2             <row id="2"><node1>hello</node1><node2>hola</node2></row>My file is pretty big, so if I can do this with SQL Loader or another similar process it would be handy.
    Thanks.

    If anyone needs this by any chnace:
    DECLARE
       PROCEDURE load_xml (
          p_dir        IN   VARCHAR2
        , p_filename   IN   VARCHAR2
       AS
          l_bfile           BFILE                       := BFILENAME (p_dir, p_filename);
          l_clob_xml        CLOB;
          l_xml_doc         DBMS_XMLDOM.domdocument;
          l_top_node        DBMS_XMLDOM.domnode;
          l_top_node_list   DBMS_XMLDOM.domnodelist;
          l_claim_node      DBMS_XMLDOM.domnode;
          l_attr_node       DBMS_XMLDOM.domnode;
          l_attr_map        DBMS_XMLDOM.domnamednodemap;
          l_clob_data       CLOB;
          l_claim_id        VARCHAR2 (500);
          l_root_node       DBMS_XMLDOM.domnode;
          l_new_node        DBMS_XMLDOM.domnode;
       BEGIN
          -- Open a file and store the data as CLOB
          DBMS_LOB.createtemporary (l_clob_xml, TRUE);
          DBMS_LOB.fileopen (l_bfile, DBMS_LOB.file_readonly);
          DBMS_LOB.loadfromfile (l_clob_xml
                               , l_bfile
                               , DBMS_LOB.getlength (l_bfile)
          DBMS_LOB.fileclose (l_bfile);
          -- Close file
          -- Create DOMDocument handle
          l_xml_doc := DBMS_XMLDOM.newdomdocument (l_clob_xml);
          l_top_node := DBMS_XMLDOM.makenode (DBMS_XMLDOM.getdocumentelement (l_xml_doc));
          l_top_node_list := DBMS_XMLDOM.getchildnodes (l_top_node);
          FOR x IN 0 .. DBMS_XMLDOM.getlength (l_top_node_list) - 1
          LOOP
             DBMS_LOB.createtemporary (l_clob_data, TRUE);
             l_claim_node := DBMS_XMLDOM.item (l_top_node_list, x);
             l_attr_map := DBMS_XMLDOM.getattributes (l_claim_node);
             l_attr_node := DBMS_XMLDOM.getnameditem (l_attr_map, 'id');
             l_claim_id := DBMS_XMLDOM.getnodevalue (l_attr_node);
             l_root_node := DBMS_XMLDOM.clonenode (n         => l_top_node, deep => FALSE);
             l_new_node := DBMS_XMLDOM.appendchild (n             => l_root_node, newchild => l_claim_node);
             DBMS_XMLDOM.writetoclob (l_root_node, l_clob_data);
    --         DBMS_OUTPUT.put_line (l_claim_id);
    --         DBMS_OUTPUT.put_line (l_clob_data);
    --         DBMS_OUTPUT.put_line ('---------------------------');
             INSERT INTO temp_xml_test
                         (claim_id
                        , xml_doc
                  VALUES (l_claim_id
                        , l_clob_data
             DBMS_LOB.freetemporary (l_clob_data);
          END LOOP;
          COMMIT;
          DBMS_LOB.freetemporary (l_clob_xml);
       EXCEPTION
          WHEN OTHERS
          THEN
             ROLLBACK;
             DBMS_OUTPUT.put_line (SQLCODE);
             DBMS_OUTPUT.put_line (SQLERRM);
             DBMS_LOB.freetemporary (l_clob_xml);
             DBMS_LOB.freetemporary (l_clob_data);
             RAISE;
       END;
    BEGIN
       load_xml ('INPUT_DIR', 'Audit_082008.xml');
    END;

  • Using XSU for Storing XML data

    Please how can I use the XSU API for storing XML documents in Oracle8i? I know part of the code to store a document but how do I import the XSU API?
    Do I have to download it or use it via Oracle?
    example:
    String xmlDoc = "my_xml_document";
    Connection conn = >>DriverManager.getConnection(...);
    OracleXMLSave sav = new OracleXMLSave
    (conn,"purchaseOrderTab");
    sav.insertXML(xmlDoc);But how do I use OracleXMLSave? How do I import the XSU API?
    thanks for your help
    null

    What is XSU? I think you question should be posted at the XML or XDK forum.

  • Help on creating and deleting xml child elements using Toplink please.

    Hi there,
    I am trying to build a toplink xml demo illustrating toplink acting as the layer between my java code and an xml datasource.
    After pulling my custom schema into toplink and following the steps in http://www.oracle.com/technology/products/ias/toplink/preview/10.1.3dp3/howto/jaxb/index.htm related to
    Click on Mapping Workbench Project...Click on From XML Schema (JAXB)...
    I am able to set up java code which can run get and sets against my xml datasource. However, I want to also be able create and delete elements within the xml data for child elements.
    i.e. in a simple scenario I have a xsd for departments which has an unbounded element of type employee. How does toplink allow me to add and or remove employees in a department on the marshalled xml data source? Only gets and sets for the elements seem accessible.
    In my experience with database schema based toplink demos I have seen methods such as:
    public void setEmployeesCollection(Collection EmployeesCollection) {
         this.employeesCollection = employeesCollection;
    Is this functionality available for xml backended toplink projects?
    cheers
    Nick

    Hi Nick,
    Below I'll give an example of using the generated JAXB object model to remove and add a new node. The available APIs are defined in the JAXB spec. TopLink also supports mapping your own objects to XML, your own objects could contain more convenient APIs for adding or removing collection members
    Example Schema
    The following XML Schema will be used to generate a JAXB model.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="department">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="employee" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="employee">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>---
    Example Input
    The following document will be used as input. For the purpose of this example this XML document is saved in a file called "employee-data.xml".
    <department>
         <employee>
              <name>Anne</name>
         </employee>
         <employee>
              <name>Bob</name>
         </employee>
    </department>---
    Example Code
    The following code demonstrates how to use the JAXB APIs to remove the object representing the first employee node, and to add a new Employee (with name = "Carol").
    JAXBContext jaxbContext = JAXBContext.newInstance("your_context_path");
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    File file = new File("employee-data.xml");
    Department department = (Department) unmarshaller.unmarshal(file);
    // Remove the first employee in the list
    department.getEmployee().remove(0);
    // Add a new employee
    ObjectFactory objectFactory = new ObjectFactory();
    Employee newEmployee = objectFactory.createEmployee();
    newEmployee.setName("Carol");
    department.getEmployee().add(newEmployee);
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    marshaller.marshal(department, System.out);---
    Example Output
    The following is the result of running the example code.
    <department>
         <employee>
              <name>Bob</name>
         </employee>
         <employee>
              <name>Carol</name>
         </employee>
    </department>

  • FSG schema and load xml data fails

    I want to start using xml publisher to make the FSG reports look better. Whilst Oracle provides a basic template, it doesn't allow very much control over the data.
    How do I create a xml data file and schema so that I can create a new rtf template.
    I tried loading the xml output of the FSG request but Word complained that "Invalid at top level of document Source authentication failed"

    Just found Note:297280.1 on Metalink where there is a template that can be downloaded that has all the FSG columns seperate allowing
    Reorder how the columns are displayed.
    · Add additional columns to display in your published report.
    · Add background colors to the individual column headers or data regions.
    · Change the font characteristics of each individual column.

Maybe you are looking for

  • ITunes/Quicktime error

    I was updating my iTunes. While installin it gave me the following message (Quicktime installation Failed Error Code:-3). I clicked okay and it said installation finished. I then tried to open iTunes and it gave me this message(Quicktime version 6.5.

  • Sxmb_moni in ECC

    Hi experts, My sxmb_moni transaction in ECC doesn't select the messages sent from the ECC, it never worked yet... Can you please help me make it work? Thanks a lot, Dmitry

  • For Adobe Reader

    When I convert a 13 page ebook to pdf I receive this message: Cannot extract the embedded font 'HWNDJR+13gerjrwlenkqok' some characters may not display or print correctly. I check the downloaded pdf I just created and there are characters missing fro

  • I lost all contacts and picttures when i upgraded. how do i get it back

    I lost contacts and photo's when I upgraded. How do I get the it back

  • Please help sdk question

    When the big 2.0 update comes out in june do we need mac computers to have the sdk and enterprise thing or is that just to develop apps you need a mac, or neither