Xml Data Extraction

I´ve a XmlType Column with the below xml and the the basic question is:
How could be the select instruction to select the Length of the DNAME column (element) ?
Table: Tmp_Xml
Column: xmltext
Oracle 9i
Sorry, but I´m confused about that.
Thanks in advanced
<Tablespace>
<Name>SYSTEM</Name>
<Status>ONLINE</Status>
<Table>
<Name>DEPT</Name>
<Analyzed></Analyzed>
<Column>
<Id>1</Id>
<Name>DEPTNO</Name>
<Type>NUMBER</Type>
<Length>22</Length>
</Column>
<Column>
<Id>2</Id>
*<Name>DNAME</Name>*
<Type>VARCHAR2</Type>
*<Length>14</Length>*
</Column>
<Column>
<Id>3</Id>
<Name>LOC</Name>
<Type>VARCHAR2</Type>
<Length>13</Length>
</Column>
</Table>
</Tablespace>

This should work on 9i, but I don't have access to that version to verify.
SELECT Extract(xmltext, '/Tablespace/Table/Column[Name="DNAME"]/Length/text()').getStringVal() ln
    FROM tmp_xml;

Similar Messages

  • XML data extraction in 8.1.7

    Hi,
    I am new to xmlparser. I have the following xml file as CLOB in oracle 8.1.7 dB. I need to extract the data, based on the user request. If the user requests "Collateral Assets", then i have to extract the data group, related to that "Collateral Assets".
    If the user requests "Liabilities", then i have to extract the data group, related to that "Liabilities".
    Can anybody help, with sample source code. I need to use XMLDOM api's.
    Thanks
    <cashflowSummaryReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Projects\Reports\cashflowSummaryReport.xsd">
         <name1>Cashflow CDO Summary Report</name1>
         <description1>Sample Cashflow for documentation</description1>
         <analysisDate1>2001-01-01</analysisDate1>
         <links>
              <link>
                   <name>Reports Main</name>
                   <location>summary.html</location>
              </link>
              <link>
                   <name>RiskMetrics Group</name>
                   <location>http://www.riskmetrics.com</location>
              </link>
         </links>
         <dataGroup>
              <name>Collateral Assets</name>
              <description>Summary of collateral assets</description>
              <links>
                   <link>
                        <name>View Collateral Assets separately</name>
                        <location>cashflowSummaryReport_collateral.html</location>
                   </link>
              </links>
              <header>
                   <keyHeader>
                        <title>Detail</title>
                   </keyHeader>
                   <columnHeader>
                        <title>Value</title>
                   </columnHeader>
              </header>
              <data>
                   <key>
                        <value>Total Par Value</value>
                   </key>
                   <column>
                        <value>150000000</value>
                   </column>
              </data>
              <data>
                   <key>
                        <value>Number of Obligors</value>
                   </key>
                   <column>
                        <value>98</value>
                   </column>
              </data>
         </dataGroup>
         <dataGroup>
              <name>Liabilities</name>
              <description>Summary of liabilities by tranche/notes</description>
              <system>S+P</system>
              <links>
                   <link>
                        <name>View Liabilities separately</name>
                        <location>cashflowSummaryReport_liabilities.html</location>
                   </link>
              </links>
              <header>
                   <keyHeader>
                        <title>Tranche / Notes</title>
                   </keyHeader>
                   <columnHeader>
                        <title>Notional</title>
                   </columnHeader>
                   <columnHeader>
                        <title>Market Price</title>
                   </columnHeader>
                   <columnHeader>
                        <title>Coupon</title>
                   </columnHeader>
                   <columnHeader>
                        <title>OC Trigger</title>
                   </columnHeader>
                   <columnHeader>
                        <title>Current OC</title>
                   </columnHeader>
                   <columnHeader>
                        <title>IC Trigger</title>
                   </columnHeader>
                   <columnHeader>
                        <title>Current IC</title>
                   </columnHeader>
              </header>
              <data>
                   <key>
                        <value>Senior notes - floating</value>
                        <link>CashFlowReport_Senior notes - floating.html</link>
                   </key>
                   <column>
                        <value>90000000</value>
                   </column>
                   <column>
                        <value>90000000</value>
                   </column>
                   <column>
                        <value>LIBOR+0.50%</value>
                   </column>
                   <column>
                        <value>-</value>
                   </column>
                   <column>
                        <value>-</value>
                   </column>
                   <column>
                        <value>-</value>
                   </column>
                   <column>
                        <value>-</value>
                   </column>
              </data>
         </dataGroup>
    </cashflowSummaryReport>

    There is no native XML data types in 8i.

  • XML data extraction and new row display

    I have a table named, SAPDATABROWSER, which has multiple columns and rows. A column named SAPTEXT (DataType: CLOB) consist of xml data. Each XML data is different in terms of number of nodes, but has the same following structure:
    <SAP_BAPI_PROP>
    <SelectedProperty>
    <Structure>
    <Field></Field>
    <Length></Length>
    <FieldValue></FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>
    </SAP_BAPI_PROP>
    So now what I would like to do is, to extract the values: Field, FieldValue and Length from every row (total 72) and display the result as following,
    Field FieldValue Length
    XXXX YYYY ZZZZ
    PPPP QQQQ RRRR
    AAAA BBBB CCCC
    MMMM NNNN OOOO
    Again, each row (total 72) has multiple nodes inside XML data, i.e there are multiple Field,Length and FieldType Nodes and no two XML row/data are similar!
    I am using the following code:
    SELECT
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/Field/text()'),
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/Length/text()' ),
    EXTRACT (xmltype (saptext), '/SAP_BAPI_PROP/SelectedProperty/Structure/FieldValue/text()' )
    FROM sapdatabrowser ;
    The above code generate result as following:
    /SAP_BAPI_PROP/..../Field/text() /SAP_BAPI_PROP/..../Length/text() /SAP_BAPI_PROP/..../FieldValue/text()
    1. XXXXPPPPAAAA YYYYQQQQBBBB ZZZZRRRRCCCC
    2. MMMM NNNN OOOO
    Any suggestions?! Thank you very much. :)

    Thank you everyone for your input. But I am still stuck. Let me start with my SQL version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionI believe my explaination was not clear so let me rephrase my question. Following is a screenshot of the Table SAPDATABROWSER
    http://img585.imageshack.us/img585/2724/55760509.jpgSo there are total 72 rows, and my interest is in Column 6, SAPTEXT (type:CLOB). Each of the row has following structure:
    <SelectedProperty>
    <Structure>
    <Field></Field>
    <Length></Length>
    <FieldValue></FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>Each row has multiple nodes Field, Length, FieldValue.... etc. Now I would like to extract ALL: Field, Length and FieldValue nodes from ALL rows and display them in following format
    Field                  Length                   FieldValue
      1                       1                           1
      2                       2                           2
      3                       3                           3
      4                       4                           4Example Output:
    ROW 1:
    <SelectedProperty>
    <Structure>
    <Field>X</Field>
    <Length>Y</Length>
    <FieldValue>Z</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    <Structure>
    <Field>P</Field>
    <Length>Q</Length>
    <FieldValue>R</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>
    ROW 2:
    <SelectedProperty>
    <Structure>
    <Field>A</Field>
    <Length>B</Length>
    <FieldValue>C</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    <Structure>
    <Field>M</Field>
    <Length>N</Length>
    <FieldValue>O</FieldValue>
    <Type></Type>
    <Priority></Priority>
    </Structure>
    </SelectedProperty>Required Output:
    Field                  Length                   FieldValue
      X                       Y                           Z
      P                       Q                           R
      A                       B                           C
      M                       N                           O

  • Extract XML data based on column tag

    Dear All,
    i want to extract the XML data type based on column selection.
    For example:
    i have the below xml in my database stored as XMLTYPE() data.
    <c1>10</c1><c2>0011</c2><c3>DEBIT</c3><c4>USD</c4>
    i want to extract the column tag c2&c3 alone. Is there any query to extract the same.
    Waiting for your response.Thanks in Advance.

    Hi,
    How do I set the web service option up correctly?  The XMLs are being created behind the scenes on what data to be used but I don't know how to make the menu only pick the xml based on the menu option.
    I have one XML that populates the menu options and specific XML's that has the data that goes with each menu option. The menu population works great but it doesn't pull the other XML's to populate the charts. This is the part that I need help.
    How do I use the web service to fix this? Any help would be very much appriecated.  I could even send you my dashboard if it helps so you can see what I've gotten so far (it's not all prettied up yet since I wanted to see if it's doable first)
    I'm new to Xcelsius so I apologize if these are newbie questions.
    Thanks,
    Jay

  • Problem with extracting Xml data source fields

    Post Author: new_crystal
    CA Forum: Crystal Reports
    Hi,
    I am creating a report which has a xml data source.
    I have a field named fieldvalue in the xml, I need to present this fieldvalue in a column format based on the name of the column heading which is another field in the database called fielddata
    here is what i want
    fielddata1     fielddata2    fielddata3 .......
    fieldvalue1    fieldvalue2   fieldvalue3......
    i have dragged the fieldvalue 3 times in the report and applied different formula for each one of them
    here is the eg. of the formula
    if ( = "A" ) then
    but it is not giving me the correct values pulled from the data source. for the first column it is pulling correctly but for the rest of the columns it is giving values as 0's.
    Can anyone help me out in this? It is pretty urgent!
    Thanks

    Post Author: tel
    CA Forum: Crystal Reports
    I have no idea how to format it in Crystal Reports (i'm new to it too), but if worse comes to worse, you can create an XSLT stylesheet to convert the XML into a format that is easier for Crystal to use. 
    In case you don't know XSLT is a programming language that is designed to convert one XML format into another.

  • Have XML data in a string, can't extract it to the XML bean class

    Hi All, I have a string that contains XML data, for example,
    string str has "<one>1<\one><two>2<\two>". i have the XML beans classes,
    but i am unable to get this data out of the string and add it to the xml bean
    classes.
    I anybody has a clue as to how to code this, please help ASAP.
    Thanks,
    kuneev

    Hi Kunnev,
    Lets say I have an xsd
    <?xml version="1.0"?>
    <xs:schema
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:bea="http://www.bea.com/xmlbeans/Sample.xsd"
         targetNamespace="http://www.bea.com/xmlbeans/Sample.xsd"
         elementFormDefault="qualified"
         attributeFormDefault="unqualified">
    <xs:element name="Person">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="FirstName" type="xs:string" />
    <xs:element name="LastName" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    Now after I compile this I would get XMLBean classes
    Like Person is a xmlBean class. The code snippet below shows how I can convert
    a string into a xmlbean of type Person.
    XmlOptions xopt = new XmlOptions();
    xopt.setDocumentType(Person.type);
    Person x0 = (Person) XmlObject.Factory.parse(
    "<xml-fragment>" +
    "<FirstName>desc---1</FirstName>" +
    "<LastName>desc---2</LastName>" +
    "</xml-fragment>", xopt);
    Person pp = (Person)x0;
    Now pp is a XMLBean object which can be added to the tree.
    Let me know if you have any questions.
    Thanks a lot,
    Vimala
    "kuneev" <[email protected]> wrote:
    >
    Hi All, I have a string that contains XML data, for example,
    string str has "<one>1<\one><two>2<\two>". i have the XML beans classes,
    but i am unable to get this data out of the string and add it to the
    xml bean
    classes.
    I anybody has a clue as to how to code this, please help ASAP.
    Thanks,
    kuneev

  • Convert XML data to byte array...

    Hello All,
    In my application, i have an XML file and the corresponding XSD file. This XML file is having some date, which i want to convert into an byte[] and then save it in a file. 
    How i can convert the XML data in the byte[]? Here as an example of the xml file and the byte[] data which i want to save in a file.
    <?xml version="1.0" encoding="utf-8"?>
    <HeadersInfo>
    <header>
    <id>0</id>
    <Name>H1</Name>
    </header>
    <header>
    <id>1</id>
    <Name>H2</Name>
    </header>
    </HeasersInfo>
    In the above example 'id' field is of type 'uint' and 'name' field is of type 'string' with max length of '5'. So in this case my byte array should be as shown below:
    00 00 00 01 48 31 00 00 00
    00 00 00 02 48 32 00 00 00
    Here underlines values are for the 'id' parameter where as values in bold are for 'Name' parameter for all the header values in sequence. Name parameter is null (0x00) padded.
    Thanks in advance,
    IamHuM

    Hi,
    the following example extract the id, name values using LINQ To Xml and writes it to a memory stream using a binary writer and returns the result as a byte array:
    internal static byte[] GetXmlAsByteArray()
    var document = XDocument.Parse("<HeadersInfo>"
    + " <header><id>1</id><Name>H1</Name></header>"
    + " <header><id>2</id><Name>H2</Name></header>"
    // additional testing
    + " <header><id>32767</id><Name>H1234</Name></header>"
    + " <header><id>305419896</id><Name>H56789</Name></header>"
    + "</HeadersInfo>");
    const int NameLength = 5; // Max length for a name
    byte[] zeroBytes = new byte[NameLength]; // Helper to fill name
    using (var ms = new MemoryStream())
    using (var writer = new BinaryWriter(ms))
    // write each header
    foreach (var header in document.Root.Elements("header"))
    int id = (int)header.Element("id");
    string name = (string)header.Element("Name");
    byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(name);
    Console.WriteLine("id: {0}, Name: {1}", id, name);
    // Write id
    writer.Write(GetUIntBytes((uint)id));
    // Write name NameLength (5) max, otherwise padded
    if (nameBytes.Length > NameLength)
    writer.Write(nameBytes, 0, NameLength);
    else
    writer.Write(nameBytes, 0, nameBytes.Length);
    if (nameBytes.Length < NameLength)
    writer.Write(zeroBytes, 0, NameLength - nameBytes.Length);
    byte[] result = ms.ToArray();
    // dump array
    foreach (var value in result)
    Console.Write("{0:X2} ", value);
    Console.WriteLine();
    return result;
    public static byte[] GetUIntBytes(uint value)
    if (BitConverter.IsLittleEndian)
    // swap bytes
    value = ((value & 0x00ff) << 24)
    | ((value & 0xff00) << 8)
    | ((value & 0x00ff0000) >> 8)
    | ((value & 0xff000000) >> 24);
    return BitConverter.GetBytes(value);
    For a general purpose solution you should create a class and split the example into separate methods to extract the data and write the values (integers, strings).
    Regards, Elmar

  • Spry Tabbed XML data panels within HTMLPanel not working.

    Many thanks for reading.
    s
    I trying to provide a rapid solution using adobe's samples
    to make Spry Tabs work within an html panel (in order to avoid
    many links in my page).
    I am using the following code:
    initial page with html panel with the ready products.js to parse the links:
    <script src="../SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryPagedView.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryDOMUtils.js" type="text/javascript"></script>
    <script  src="../SpryAssets/SpryHTMLPanel.js" type="text/javascript"></script>
    <script language="JavaScript" type="text/javascript" src="../SpryAssets/SpryDataExtensions.js"></script>
    <script src="SpryNestedXMLDataSet.js" type="text/javascript"></script>
    <script src="../SpryAssets/products.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="TabbedPanels/SpryTabbedPanels.css"/>
    <script src="TabbedPanels/SpryTabbedPanels.js"></script<script type="text/javascript">
    var ds1 = new Spry.Data.XMLDataSet("ajaxbibliaxmlbridgetitle.php", "root/row[katigoria=1]", {sortOnLoad: "ID_BIBLIOU", sortOrderOnLoad: "ascending"});
    var pv1 = new Spry.Data.PagedView( ds1 ,{ pageSize:10 });
    var pv1PagedInfo = pv1.getPagingInfo();
    //var TabbedPanels1 = new Spry.Widget.TabbedPanels();          
    </script>
    </head>
    <body class="twoColFixRtHdr">
    <div id="container">
    <div id="sidebar1">
      <div id="productPageLinks">
       <ul>
        <li><a href="index.php">Index</a></li>
        <li><a href="booklist.php">Product List</a></li>
            <li><a href="test.php">Σχετικά με τη Βιβλιοθήκη</a></li>
       </ul>   
      </div>
    </div>
    <div id="mainContent">
    <br />
    <div class="HTMLPanelLoadingContent"> Waiting</div>
    <div class="HTMLPanelErrorContent"> error </div>
    </div>
    </div>
    </body>
    </html>
    Products.js (adobe'S change to can load xml dataset)
    var mainPanel = null;
    // Our initialization function which unobtrusively attaches
    // click handlers on the product links within the page.
    function InitProductPage()
    mainPanel = new Spry.Widget.HTMLPanel("mainContent" , { evalScripts: true });
        var observer = {onPostUpdate: function(){ Spry.Data.initRegions('mainContent'); 
    mainPanel.addObserver(observer);
    // For every link on the page which points to a product page,
    // attach an onclick handler that will intercept clicks and
    // and fire off a request to load the URL via the HTMLPanel.
    // For these links, we want to load the static product page
    // and extract out the content underneath the "mainContent"
    // node.
    Spry.$$("#productPageLinks a").addEventListener("click", function(e)
      mainPanel.loadContent(this.href, { id: "mainContent" });
      return false;
    }, false);
    // For every link on the page which points to a product HTML
    // fragment, attach an onclick handler that will intercept clicks and
    // and fire off a request to load the URL via the HTMLPanel.
    // For these links, we are loading HTML fragments, so there is no
    // need to specify an ID to extract out. The HTMLPanel will insert
    // all of the content recieved.
    Spry.$$("#productFragmentLinks a").addEventListener("click", function(e)
      mainPanel.loadContent(this.href);
      return false;
    }, false);
    // Add our InitProductPage() function as a load listener
    // so that it gets executed once the page has fully loaded.
    Spry.Utils.addLoadListener(InitProductPage);
    XML data and stuff all loaded correctly
    What I am trying to do is to load a second page from a link in my initial page
    that contains a Tabbed Panel.
    The page loads but no panel functionality exists. The first Panel load correctly but behaves as a simple html page .
    I have searched several hours the forums and playing around by moving the definition of Spry.Widget.TabbedPanels within
    the initial HTMLPanel page and other spots but this  produced js errors as expected (because the tab panel definitions exist in bookcategories.php)
    which is loaded only when it is called.
    Any ideas?
    Page to load is like this :
    <bookcategories.php>
    <link rel="stylesheet" type="text/css" href="TabbedPanels/SpryTabbedPanels.css"/>
    <script src="TabbedPanels/SpryTabbedPanels.js"></script>
    <script language="JavaScript" type="text/javascript" src="../SpryAssets/SpryDataExtensions.js"></script>
    </head>
    <body >
    <div id="container">
    <div id="mainContent">
             <div class="TabbedPanels" id="TabbedPanels1">
      <ul class="TabbedPanelsTabGroup">
              <li class="TabbedPanelsTab">SOmething ... </li>
              <li class="TabbedPanelsTab">Something else </li>
    <
      </ul>
      <div class="TabbedPanelsContentGroup">
              <div class="TabbedPanelsContent">Blah Blah
                  <div spry:region="pv1" id="bibliapv"><br />
                    <br />
                  <div spry:state="ready">
                      <table width="775" height="42"  >
                        <tr style="color:#900"; >
    <th etc>
                        </tr>
                        <tr spry:repeat="pv1" spry:even="even" spry:odd="odd">
                          <td >       {ID_}
                         </td>
                          <td>{Writer}</td>
                          <td>{Book_Title}</td>
                           </tr>
                      </table>
                    </div>
                  </div>
              <div class="TabbedPanelsContent">Tab 2 Content</div>
    <div class="TabbedPanelsContent">Tab 3 Content</div>
       <div class="TabbedPanelsContent">Tab 4 Content</div>
      </div>
    </div>
    </div>
    <br class="clearfloat" />
    </div>
    <script type="text/javascript">
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
    </script>
    </body>
    </html>
    Many thanks

    Ok I went back through everything and checked to make sure my
    files were in the right places both my SpryTabbedPanels.css and my
    SpryTabbedPanels.js are in the SpryAssets folder and they work fine
    until I try and add data from an xml file to them then the tabs
    populate with the info but become unclickable and the content area
    has every bit of content in on tab. Below is what I have let me
    know what I'm doing wrong I am using Spry 1.6
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xmlns:spry="
    http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    <script src="SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryTabbedPanels.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.XMLDataSet("solutions3.xml",
    "solutions/solution");
    //-->
    </script>
    <link href="SpryAssets/SpryTabbedPanels.css"
    rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div spry:region="ds1">
    <div id="TabbedPanels1" class="TabbedPanels">
    <ul class="TabbedPanelsTabGroup">
    <li spry:repeat="ds1" class="TabbedPanelsTab"
    tabindex="0">{name}</li>
    </ul>
    <div class="TabbedPanelsContentGroup">
    <div spry:repeat="ds1"
    class="TabbedPanelsContent">{desc}</div>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    <!--
    var TabbedPanels1 = new
    Spry.Widget.TabbedPanels("TabbedPanels1");
    //-->
    </script>
    </body>
    </html>

  • Xml data into non-xml database.. solution anyone?

    Hi,
    My current project requires me to store the client's data on our servers. We're using Oracle9i. Daily, I will download the client's data for that day and load it into our database. My problem is that the data file is not a flat file so I can't use sql*loader to load the data. Instead, the data file is an xml file. What is the best way to load xml data into a non-xml database? Are there any tools similar to sql*Loader that will load xml data into non-xml database? Is it the best solution for the client to give me an XML dump of their data to load into our database, or should I request a flat file? My last resort would be to write some sort of a script to parse the xml data into a flat file, and then run it through sql*loader. Is this the best solution? One thing to note is that these files could be very large.
    Thanks in advance.
    -PV

    I assume that just putting the XML file into an
    extremely large VARCHAR field is not what you want.
    Instead, you want to extract data elements from the
    XML and write them to columns in a table in your
    database. Right?Yes. Your assumption is correct.
    It sounds like you already have a script that loads a
    flat file into your database. In that case I would
    write an XSL transformation that converts the client's
    XML into a correctly-formatted flat file.Thank you. I'll look into that. Other suggestions are welcome.

  • XML data into an Array

    Hey,
    I have successfully loaded an external XML data file into my
    movie. Now I would like to save the node values into an array so i
    can manipulate and call as required...Is this possible or is there
    a better way to go about this?

    Well since you have the XML object loaded, all you would need
    to do is extract the nodes and data you needed then push them onto
    the array..
    If you are not too sure how to go about this, give us the XML
    schema (xml structure) of what was loaded and what you need and we
    can shoot you some basic code to get it done.

  • Can I create an XSD from XML data in a CLOB?

    Environment:
    Oracle 11.2.0.3 EE on Solaris.
    Very much an XML newbie so please be kind! 
    I have spent the past few days pouring through the documentation and various blogs, especially this one, but ... I need some help.
    I am trying to extract XML data stored in a CLOB and produce a flat file for the user's consumption.
    They have sent me what they think is the XSD for the XML data but when I look at the data in the CLOB I don't see the tags documented in the XSD.
    I'd like to produce an XSD based on the actual data to compare with what they've sent.
    Is this possible?
    I am able to query the XML data using the tags I see in the data using XMLTable and it's working fine.
    Any help is greatly appreciated.
    -gary

    Welcome to the XML side of the world, where you will love it and curse it, just like any other piece of technology.
    So as I understand it, the scope of your operation is to extract information from an XML file and then write that information to disk, correct?
    Some questions
    - Why is the XML stored in a CLOB instead of an XMLType column?  Without knowing the system history, it is a valid question.
    - How big are the XML?  The reason I ask this is because when the XML is stored in XMLType columns (of Object Relational structure or SECUREFILE BINARY XML format), then Oracle can parse the XML substantially easier than when it is stored as a CLOB.  If the XML is fairly small, you may see no performance difference between the two.
    The Oracle DB itself has no built in ability to generate a schema from an XML file.  In order to do that, you would need to use some third party tool that has that functionality built in.  For example, XML Spy can do this.  Other tools can as well, but that is what came to mind first as it is what I use.  The one thing to remember is that the schema it builds represents that one instance of XML.  Other instances of XML may be different and not validate against the schema you generated, but still have been valid against the unknown original schema.
    You can register the schema in the database and then use the XML to create an XMLType instance associated to the schema and then validate the XML that way.  One example can be found at XML DB FAQ and here is another example Re: XML Schema validation
    Hope that helps you continue on.

  • How to read XML data stored in CLOB in Concurrent prog Output

    Hi All,
    I'm trying to Generate the XML Data as concurrent Program output. I have a PL/SQL package which generated the XML data by using SQL/XML functions. I'm storing the generated XML data in a CLOB variable. But when i try to read the data using fnd_file.put_line(fnd_file.OUTPUT,XML_Data) it doesn't display data more than 32767 bytes.
    Please help me out to understand what could be done to read the data in chunks. I have tried many logic's to print chunks of data but the output tags are either chopped off and errors out saying Tag not found.
    My logic is as below:
    v_handler:= DBMS_XMLGEN.newContext(v_xml_query);
    --Sets NULL handling options
    DBMS_XMLGen.SetNullHandling(v_handler, dbms_xmlgen.EMPTY_TAG ) ;
    --Set special character handling
    DBMS_XMLGEN.setConvertSpecialChars(v_handler, TRUE);
    -- Specified whether to use an XML attribute to indicate NULLness of particular entity in the XML document
    DBMS_XMLGen.useNullAttributeIndicator(v_handler,TRUE);
    -- set Checking invalid chars
    DBMS_XMLGEN.setCheckInvalidChars(v_handler, TRUE);
    -- get the xml data as required
    v_xml_data:= DBMS_XMLGEN.getXMLtype(v_handler);
    SELECT XMLROOT(v_xml_data.extract('/*'),VERSION '1.0').getClobVal() into v_new_xml_Data from dual;
    -- get the length of the xml generated
    v_clob_len := dbms_lob.getlength(v_new_xml_Data);
    FND_FILE.PUT_LINE(FND_FILE.LOG,'The Clob length is :'|| v_clob_len);
    -- logic to process string more than 32767 Processing by each character
    v_offset :=1;
    while (v_offset <= v_clob_len)
    LOOP
    v_char := dbms_lob.substr(v_new_xml_Data, 1, v_offset);
    IF (v_char = CHR(10))
    then
    fnd_file.new_line(fnd_file.output, 1);
    else
    fnd_file.put(fnd_file.output, v_char);
    end if;
    v_offset := v_offset + 1;
    END LOOP;
    FND_FILE.PUT_LINE(FND_FILE.LOG,'The offset is :'|| v_offset);
    FND_FILE.NEW_LINE(FND_FILE.OUTPUT, 1);
    THe above logic is for character by character which is a performance burden? Please let me know if there is any other work around for this

    Hi,
    Thanks for Replying. I have refered http://blog.oraclecontractors.com/?p=69 and then i added that piece of code. Basically, i'm trying to generate a report using XML publisher. To generate the XML data i'm writing a pl/sql package with SQl/XML functions. DBMS_XMLGEN would help me convert the XML Data as is. When the concurrent program runs this XML data will merge with RTF layout and generate required report. I'm able to generate the Report for data less then 32767 bytes. More than the limit i need to pass chunks of XML data to read as output. That's the reason i'm using fnd_file.output. But it reads only 32767 size at a time.
    WHen i use the given logic, it works perfectly fine, but it loops for each character, for example if you have 30,000 characters it loops the same, which is peformance burden.
    So i tried to write the logic of chunks but still i get the error that XML tag is not found or missing. I'm hoping this is very common issue, but after all my trails, i didn't find the right solution.
    the other logic i tried was :
    v_new_xml_data varchar2(32767)
    v_iterations := CEIL(v_clob_len/v_chunk_length); -- v_chunk_length is 32767 and v_clob_length is length of the XML data stored inthe clob variable
    For i in 0..v_iterations
    LOOP
    FND_FILE.put_line (fnd_file.log,'the loops v_pos :'||i||' and v_clob_length :'||v_clob_len);
    v_new_xml_data := DBMS_LOB.SUBSTR ( V_XML_DATA,v_chunk_length,(i*v_chunk_length)+1);
    FND_FILE.PUT_LINE (FND_FILE.OUTPUT,v_new_xml_data); -- read the output for every 32767 chunks
    FND_FILE.PUT_LINE(FND_FILE.LOG, 'Chunk length is :'||((i*v_chunk_length)+1));
    END LOOP;
    FND_FILE.put_line (fnd_file.log,'out of loop');
    FND_FILE.put_line (fnd_file.log,'length of new xml is '||v_clob_len);
    Please, let me know if you need Further clarifications on the same.

  • Parsing XML data stored as CLOB in DB and save attribute values in table

    Hello,
    I have a CLOB column in table that is holding XML data as follows,
    <banners>
    <banner-image id="0">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>www</click-through-url>
    <make>Acura</make>
    </banner-image>
    <banner-image id="1">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>gfrty</click-through-url>
    <make>BMW</make>
    </banner-image>
    </banners>
    Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
    BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
    0 | BANNER | http.gif | www | Acura
    1 | BANNER | http.gif | gfrty | BMW
    And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
    So, I would appreciate if someone can help me find a generic way of doing this,
    Thank you in advance,
    Madhu.

    This is not a reply.. sorry.
    I took have a similar problem only..
    can you pls help me
    XML structure.
    <PODetails>
    <POHeader>
    <CurrencyID>INR</CurrencyID>
    <ExchangeRate>1</ExchangeRate>
    <RefNo>0080000110</RefNo>
    <VendorID>1200</VendorID>
    <TransDate>2006-12-20</TransDate>
    <DocRelationshipId>PURCHASE</DocRelationshipId>
    <LocationID>0000102327</LocationID>
    </POHeader>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>L HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>3.000</Quantity>
    <PriceValue>2509.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>M HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>2.000</Quantity>
    <PriceValue>1673</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1556</ItemID>
    <Size>39FS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>1.000</Quantity>
    <PriceValue>836.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    </PODetails>
    The DB is ORACLE 9i
    This is stored in a XML table of type XMLTYPE.
    THIS I USED THE .extract function to get the values of the nodes.
    POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
    select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
    FROM xmltable a
    WHERE a.existsnode('//POItemDetails/ItemID')=1
    Pls Help..
    Regds,
    Santhoshkumar.G.

  • XML DATA INSERTION INTO TABLE

    I have xml data in this format and need to store in the lineitem table by generating three new values for each row ie line identifier(sys_guid),begin_date and end_date.
    <LineItems>
    <LineItem>
    <BASE_TYPE>SRV</BASE_TYPE>
    <ORDER_NUM>124089304</ORDER_NUM>
    <WIP_STATUS>S</WIP_STATUS>
    <WIP_STATUS_DATE>8/1/2006 8:44:55 PM</WIP_STATUS_DATE>
    <order_date>6/21/2006 12:00:00 AM</order_date>
    <IP_DATE>6/21/2006 12:00:00 AM</IP_DATE>
    </LineItem>
    <LineItem>
    <BASE_TYPE>SRV</BASE_TYPE>
    <ORDER_NUM>124089304</ORDER_NUM>
    <WIP_STATUS>S</WIP_STATUS>
    <WIP_STATUS_DATE>8/1/2006 8:44:55 PM</WIP_STATUS_DATE>
    <order_date>6/21/2006 12:00:00 AM</order_date>
    <IP_DATE>6/21/2006 12:00:00 AM</IP_DATE>
    </LineItem>
    </LineItems>
    and using this method to insert
    SELECT EXTRACTVALUE(VALUE(T), 'LineItem/BASE_TYPE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_NUM'),
    EXTRACTVALUE(VALUE(T), 'LineItem/WIP_STATUS'),
    EXTRACTVALUE(VALUE(T), 'LineItem/WIP_STATUS_DATE')),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_DATE')),
    EXTRACTVALUE(VALUE(T), 'LineItem/IP_DATE')),
    EXTRACTVALUE(VALUE(T), 'LineItem/SHIP_BY_DATE')),
    EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_SRC'),
    EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_LOC'),
    EXTRACTVALUE(VALUE(T), 'LineItem/CUSTOMER_NUM'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ACCOUNT_TYPE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/OVERPACK_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/INTERNATIONAL_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/MULTIPLE_SYSTEM_TIES'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_TIE_NUM'),
    EXTRACTVALUE(VALUE(T), 'LineItem/TIE_STATUS'),
    EXTRACTVALUE(VALUE(T), 'LineItem/PK_GEN'),
    EXTRACTVALUE(VALUE(T), 'LineItem/QTY_REQD'),
    EXTRACTVALUE(VALUE(T), 'LineItem/WORKCENTER_ID'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SI_NUMBER'),
    EXTRACTVALUE(VALUE(T), 'LineItem/MFG_SCHED_FACILITY_ID'),
    EXTRACTVALUE(VALUE(T), 'LineItem/MFG_FACILITY_ID'),
    EXTRACTVALUE(VALUE(T), 'LineItem/PILOT_NAME'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ENG_HOLD_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SHORT_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/OVR_SHORTAGE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/USER_HOLD_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SHIP_TO_ADDRESS_SEQ_NUM'),
    EXTRACTVALUE(VALUE(T), 'LineItem/CALICO_REF_NUM'),
    EXTRACTVALUE(VALUE(T), 'LineItem/CONFIG_ID'),
    EXTRACTVALUE(VALUE(T), 'LineItem/TOTAL_UNITS_QTY'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORDER_TYPE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SKU'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUB_ASSEMBLY_NUMBER'),
    EXTRACTVALUE(VALUE(T), 'LineItem/BASE_ASM_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/QTY_REQ'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORIGINAL_PART_NUMBER'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUBSTITUTE_PART_NUMBER'),
    EXTRACTVALUE(VALUE(T), 'LineItem/QTY_EXTENDED'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ISSUE_CODE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_PART_DESC'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_COMMODITY_CODE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_PRINT_ON_TRAVELER_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/ORIG_BOX_CODE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_PART_DESC'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_COMMODITY_CODE'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_PRINT_ON_TRAVELER_FLAG'),
    EXTRACTVALUE(VALUE(T), 'LineItem/SUBST_BOX_CODE')
         BULK COLLECT INTO
    V_BASE_TYPE,
    V_ORDER_NUM,
    V_WIP_STATUS,
    V_WIP_STATUS_DATE,
    V_ORDER_DATE,
    V_IP_DATE,
    V_SHIP_BY_DATE,
    V_CUSTOMER_SRC,
    V_CUSTOMER_LOC,
    V_CUSTOMER_NUM,
    V_ACCOUNT_TYPE,
    V_OVERPACK_FLAG,
    V_INTERNATIONAL_FLAG,
    V_MULTIPLE_SYSTEM_TIES,
    V_ORDER_TIE_NUM,
    V_TIE_STATUS,
    V_PK_GEN,
    V_QTY_REQD,
    V_WORKCENTER_ID,
    V_SI_NUMBER,
    V_MFG_SCHED_FACILITY_ID,
    V_MFG_FACILITY_ID,
    V_PILOT_NAME,
    V_ENG_HOLD_FLAG,
    V_SHORT_FLAG,
    V_OVR_SHORTAGE,
    V_USER_HOLD_FLAG,
    V_SHIP_TO_ADDRESS_SEQ_NUM,
    V_CALICO_REF_NUM,
    V_CONFIG_ID,
    V_TOTAL_UNITS_QTY,
    V_ORDER_TYPE,
    V_SKU#,
    V_SUB_ASSEMBLY_NUMBER,
    V_BASE_ASM_FLAG,
    V_QTY_REQ,
    V_ORIGINAL_PART_NUMBER,
    V_SUBSTITUTE_PART_NUMBER,
    V_QTY_EXTENDED,
    V_ISSUE_CODE,
    V_ORIG_PART_DESC,
    V_ORIG_COMMODITY_CODE,
    V_ORIG_PRINT_ON_TRAVELER_FLAG,
    V_ORIG_BOX_CODE,
    V_SUBST_PART_DESC,
    V_SUBST_COMMODITY_CODE,
    V_SUBST_PRINT_ON_TRAVELER_FLAG,
    V_SUBST_BOX_CODE
    FROM TABLE(XMLSEQUENCE(EXTRACT(P_PODETAILS_XML, '/LineItems/LineItem'))) T
    but getting performace problem. I'm able to insert 100 lines items in 3 sec but requirement is further less.
    Any help..... ????
    thanks in adavance..

    hi..
    me too having same type of XML data to be inserted into oracle table
    i've to write procedure for this
    can u help me plz.....

  • R12 Payment Process Request Status Report adding extra columns to XML data.

    In 11i, we had modified the Preliminary Payment Report to include extra columns ( invoice distributions). In r12 , that report is obsolete and Oracle introduced a new report "Payment Process Request Status Report". This request uses BI Publisher to generate the final report output. I am unable to modify the template since the XML output of the report does not
    contain the invoice distribution account data. We need to know how can we modify the XML data to include the extra columns.
    For Funds Disbursement Process ( Payment Instruction File) , Oracle provides IBY_FD_EXTRACT_EXT_PUB extensibility package to construct custom XML element structure that can be added to the payment XML extract generated by Oracle Payments. Do we have something similar for this report ? Are there any other options available ?
    Thanks

    Hi
    The same package "IBY_FD_EXTRACT_EXT_PUB" works for payment process request status report also. Please add the logic to get the distribution data in this package and you will see the new XML tags in this report also.
    Hope this helps.
    Vinit

Maybe you are looking for

  • BAD SERVICE AND RUBBISH PRODUCT

    Firstly i have managed to stop 2 different family members from changing their service to BT, they would thank me if only they knew. I have only been a customer for 6 months, for the past 2 months i have had vision and broadband issues and am now chas

  • 'Edit Locally' command Error -- IISProxy?

    Hi, We have a problem with 'Edit Locally' command since we are using Windows Authentication. Our architecture is: SAP EP 6.0 SP2 Patch 28 (Solaris) IIS Proxy (Windows 2003) The situation is: If we access to SAP Portal using old url (directly to Solar

  • Can only get my daughters iphone 4 to connect to internet at home what are we doing wrong?

    cannot get internet on new iphone 4 anywhere but home.

  • How to upgrade iWeb 2.0.4 to 3.x

    Hi, I bought a MacBook 2008 early. This MacBook include iWeb 2.x. Last month I upgraded some iLife '08 application to '11 but I couldn't upgrade iWeb '08 to newer. Last iWeb version is 3.0.4. How can I upgrade iWeb 2.x to 3.x? Please help me! Thx! Ba

  • OSX 10.4.9 - Can't Process Installation CD

    My MacbookPro keeps on having these kernel panics. As in, I'll start it up and it'll only load up till the blue screen, then the "restart your mac" thing pops up. Oh and vertical blue lines appear across the screen as it displays the panic. So I call