XMLType and Extract

Hello,
Example XML
v_xml : multiple := '<Item fld1=1 fld2=2 fld=3>
<subitem>value 1 </subitem>
<Item fld1=1 fld2=2 fld=4>
<subitem>value 2 </subitem>';
My requirement is to fetch subitem for all unique combination for tag ITEM and it ids i.e. fld1 and fld2. As per example it can be repeated.
I am trying to extract using
select *
from example('/item[@fld1='||'1').
How I can add/compare fld2 as well in above query. i.e. I want to uniquely identify each row using fld1 and fld2.
Thanks in advance.

Hello,
Example XML
v_xml : multiple := '<Item fld1=1 fld2=2 fld=3>
<subitem>value 1 </subitem>
<Item fld1=1 fld2=2 fld=4>
<subitem>value 2 </subitem>';
My requirement is to fetch subitem for all unique combination for tag ITEM and it ids i.e. fld1 and fld2. As per example it can be repeated.
I am trying to extract using
select *
from example('/item[@fld1='||'1').
How I can add/compare fld2 as well in above query. i.e. I want to uniquely identify each row using fld1 and fld2.
Thanks in advance.

Similar Messages

  • Extracting data from XML using xmltype and extract

    Hello all,
    I want to write a pl/sql functions that takes a clob as an input and return a some data extracted from the data passed into it.
    the input will be an xml similar to the following:
    <FIXML xsi:schemaLocation="http://www.finacle.com/fixml executeFinacleScript.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Header>
            <ResponseHeader>
                <RequestMessageKey>
                    <RequestUUID>IVR201306180841060310000000000000000</RequestUUID>
                    <ServiceRequestId>executeFinacleScript</ServiceRequestId>
                    <ServiceRequestVersion>10.3</ServiceRequestVersion>
                    <ChannelId>IVR</ChannelId>
                </RequestMessageKey>
                <ResponseMessageInfo>
                    <BankId>01</BankId>
                    <TimeZone></TimeZone>
                    <MessageDateTime>2013-06-18T05:36:55.918</MessageDateTime>
                </ResponseMessageInfo>
                <UBUSTransaction>
                    <Id/>
                    <Status/>
                </UBUSTransaction>
                <HostTransaction>
                    <Id/>
                    <Status>SUCCESS</Status>
                </HostTransaction>
                <HostParentTransaction>
                    <Id/>
                    <Status/>
                </HostParentTransaction>
                <CustomInfo/>
            </ResponseHeader>
        </Header>
        <Body>
            <executeFinacleScriptResponse>
                <ExecuteFinacleScriptOutputVO>
                    <executeFinacleScript_customData>
                        <DataCategory>ACC</DataCategory>
                        <New_Data>0001019300101001</New_Data>
                    </executeFinacleScript_customData>
                </ExecuteFinacleScriptOutputVO>
            </executeFinacleScriptResponse>
        </Body>
    </FIXML>'
    I want to extract the value of new_data.
    I wrote the following anonymous block to test the code :
    declare
    xparam xmltype;
    v_xpath varchar2(500);
    begin
    xparam:=xmltype('<FIXML xsi:schemaLocation="http://www.finacle.com/fixml executeFinacleScript.xsd"  xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Header>
            <ResponseHeader>
                <RequestMessageKey>
                    <RequestUUID>IVR201306180841060310000000000000000</RequestUUID>
                    <ServiceRequestId>executeFinacleScript</ServiceRequestId>
                    <ServiceRequestVersion>10.3</ServiceRequestVersion>
                    <ChannelId>IVR</ChannelId>
                </RequestMessageKey>
                <ResponseMessageInfo>
                    <BankId>01</BankId>
                    <TimeZone></TimeZone>
                    <MessageDateTime>2013-06-18T05:36:55.918</MessageDateTime>
                </ResponseMessageInfo>
                <UBUSTransaction>
                    <Id/>
                    <Status/>
                </UBUSTransaction>
                <HostTransaction>
                    <Id/>
                    <Status>SUCCESS</Status>
                </HostTransaction>
                <HostParentTransaction>
                    <Id/>
                    <Status/>
                </HostParentTransaction>
                <CustomInfo/>
            </ResponseHeader>
        </Header>
        <Body>
            <executeFinacleScriptResponse>
                <ExecuteFinacleScriptOutputVO>
                    <executeFinacleScript_customData>
                        <DataCategory>ACC</DataCategory>
                        <New_Data>0001019300101001</New_Data>
                    </executeFinacleScript_customData>
                </ExecuteFinacleScriptOutputVO>
            </executeFinacleScriptResponse>
        </Body>
    </FIXML>');
    v_xpath:='//New_Data/text()';-
    dbms_output.put_line(xparam.EXTRACT(v_xpath).GETSTRINGVAL());
    end;
    but I get the following Error:
    dbms_output.put_line(xparam.EXTRACT(v_xpath).GETSTRINGVAL());
    end;
    Error at line 1
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 46
    the problem is that when I remove : xmlns="http://www.finacle.com/fixml" attribute from the root node the code works correctly.
    of course , I can simply use replace to remove it, but I want to know what is causing the error.
    I am using oracle database 10g

    Let me explain that the issue is not only related to Oracle.
    If you google a bit for default namespace and Xpath you will find many topic.
    Basically when you have an XML having a definition of namespace without a prefix:
    i.e.:
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Example XHTML document</title>
      </head>
      <body>
        <p>Sample content</p>
      </body>
    </html>
    this means that all unprefixed elements are belonging to this default namespace.
    In this case an Xpath equal to '//title/text()' will not get anything because it is assuming to find the element title within a null namespace. But title in this case is automatically assigned to the default namespace.
    When you specify a prefix in a namespace then all elements without prefix are associated to namespace NULL. Using a default namespace is causing a lot of headache.
    These links can be giving a clearer picture:
    http://www.edankert.com/defaultnamespaces.html
    Assuming that you have data like this:
    WITH mydata AS
    (   SELECT '
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Example XHTML document</title>
      </head>
      <body>
        <p>Sample content</p>
      </body>
    </html>' xmldata FROM DUAL
    SELECT xmltype (xmldata).EXTRACT ('//title/text()').getstringval ()
      FROM mydata;
    This query will not give anything back to you. You will have to specify:
    SELECT xmltype (xmldata).EXTRACT ('//title/text()', 'xmlns="http://www.w3.org/1999/xhtml"').getstringval ()
      FROM mydata;
    Note also that you should be able to get the default namespace when it is specified (without prefix) by using:
    SELECT xmltype(xmldata).getnamespace() from mydata;
    Post your Oracle version to see if it something related to your version. In mine I got this:
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 20 18:32:58 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH mydata AS
      2  (   SELECT '
      3  <html xmlns="http://www.w3.org/1999/xhtml">
      4    <head>
      5      <title>Example XHTML document</title>
      6    </head>
      7    <body>
      8      <p>Sample content</p>
      9    </body>
    10  </html>' xmldata FROM DUAL
    11  )
    12  SELECT xmltype(xmldata).getnamespace() from mydata;
    XMLTYPE(XMLDATA).GETNAMESPACE()
    http://www.w3.org/1999/xhtml
    SQL>
    If this would work, then it would be enough to add the optional additional parameter namespace. In case it is null it will be set as xmlsn="" and it will work anyway:
    Please note that it will work both if the XML has a default namespace or not
    i.e.:
    with default namespace:
    SQL> DECLARE
      2     xparam         XMLTYPE;
      3     v_xpath        VARCHAR2 (500);
      4     v_ns           VARCHAR2 (500);
      5  BEGIN
      6     xparam :=
      7        xmltype ('
      8  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ns="http://www.w3.org/1999/xhtml" >
      9    <head>
    10      <title>Example XHTML document</title>
    11    </head>
    12    <body>
    13      <p>Sample content</p>
    14    </body>
    15  </html>');
    16     v_xpath := '//title/text()';
    17     v_ns := 'xmlns="' || xparam.getnamespace () || '"';
    18     DBMS_OUTPUT.
    19      put_line (
    20        'Value of title:' || xparam.EXTRACT (v_xpath, v_ns).getstringval ());
    21  END;
    22  /
    Value of title:Example XHTML document
    PL/SQL procedure successfully completed.
    SQL>
    and without default namespace
    SQL> DECLARE
      2     xparam         XMLTYPE;
      3     v_xpath        VARCHAR2 (500);
      4     v_ns           VARCHAR2 (500);
      5  BEGIN
      6     xparam :=
      7        xmltype ('
      8  <html xmlns:ns="http://www.w3.org/1999/xhtml" >
      9    <head>
    10      <title>Example XHTML document</title>
    11    </head>
    12    <body>
    13      <p>Sample content</p>
    14    </body>
    15  </html>');
    16     v_xpath := '//title/text()';
    17     v_ns := 'xmlns="' || xparam.getnamespace () || '"';
    18     DBMS_OUTPUT.
    19      put_line (
    20        'Value of title:' || xparam.EXTRACT (v_xpath, v_ns).getstringval ());
    21  END;
    22  /
    Value of title:Example XHTML document
    PL/SQL procedure successfully completed.
    Regards.
    Al
    Message was edited by: AlbertoFaenza
    IF removed as it is working anyway.

  • I need help. My ipad 2 was stuck in recovery mode. i tried to connect it to itunes and restore but after downloading the file and extracting the software there is a pop up message that says "the device is full" i dont know what to do. Its been 2 days now.

    I need help. My ipad 2 was stuck in recovery mode. i tried to connect it to itunes and restore but after downloading the file and extracting the software there is a pop up message that says "the device is full. Deleting files and emptying your recycle been will help you restore." how am i going to erase files if i can't open my ipad. i dont know what to do. Its been 2 days now. please help. thanks.

    yes i am sure. This are the exact words... "The iPad "iPad" could not be restored. The disk you are attempting to use is full. (Removing files and emptying the recycle bin will free up additional space". i tried some options, hard reset, redsnow, tinyumbrella but still it's stuck.

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • Front end Backend Modeling Configuration Reporting and Extraction.

    Hi..All
    Can Any one plz explain the terms "Front end","Back end" related to Modeling,Configuration,Reporting and Extraction.
    Thanks & Regards
    Jonn
    <u>[email protected]</u>

    Hi,
    Frontend is the reporting aspect, i.e Workbooks, queries, Web reporting, Crystal reports, etc.
    Its called the frontend as that's what the users see and they don't see what goes on in the 'backend' i.e Config and Extraction, data manipulations, etc.
    Modeling is used to design the cube, ODS, etc. Also modeling concepts can be used to design frontend queries as well.
    Cheers,
    Kedar

  • How to browse a file and extract its contents

    i want to browse a file and extract its contents.My code is given below but its not working .Can anybody help me please
    JFileChooser fc = new JFileChooser();
              int returnVal = fc.showOpenDialog(jfrm);
              if (returnVal == JFileChooser.APPROVE_OPTION)
              File file = fc.getSelectedFile();
              //This is where a real application would open the file.
              fileName=file.getName();
              //This is a file function to extract data from a file.
              //It reads data from a file that can be viewed on cmd
              jlab3.setText(fileName);
              try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
              DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screen
              fileName1=in.readLine();
              jlab3.setText(fileName1);
              in.close();
    catch (Exception e)
              System.err.println("File input error");
              }

    JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(jfrm);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File file = fc.getSelectedFile();
    //This is where a real application would open the file.
    fileName=file.getName();
    //This is a file function to extract data from a file.
    //It reads data from a file that can be viewed on cmd
    jlab3.setText(fileName);
    try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
    DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screenHere you are reading the first line of the file
      fileName1=in.readLine();
    //}and here you are displaying the line in a (I suppose) JLabel. A JLabel is not very suitable for displaying a file content, except is the file contain few characters !!!
    jlab3.setText(fileName1);
    in.close();
    catch (Exception e)
    System.err.println("File input error");
    }If you want to read the complete file content you must uncomment lines inside while instruction, like this
    while (in.available() > 0) {  // I prefer to test in.available like this, instead of !=
      // append text to a StringBuffer (variable named sb here) or directly in a textarea.
      sb.append(in.readLine());
    ...

  • Unable to select and extract object...

    I am currently attempting to edit a recently converted raster to vector image. I have the file opened and selected after having used the "live trace" function to revise it and save as a vector image. Now I would like to select and extract a portion of the image to work with but I am neither able to select and extract the object of focus from within the general picture. When I attempt to use the pointer selection tool to select the object of focus, the entire image becomes selected with a blue border. If I try to use the magic wand nothing happens. If I try to use the lasso tool I can draw around the object of focus but when I close the lasso it simply disappears leaving nothing selected. I've even tried to "ungroup" the image but option is grayed out (unavailable). Any insights into what I am doing incorrectly? By the way, the live trace function becomes active whenever I click anywhere within the general image.

    RUConscious,
    Expanding the Live Trace should make it accessible and editable just like any other vector artwork where you may Direct Select individual/multiple Anchor Points, Select paths, etc.
    Maybe a closeup of the issue area, with a hint at what exactly you wish to do, would help the helpers, preferably including the relevant part of the Layers panel (which may be moved).
    Apart from that, others may tell you that I am too old, or silly, to apply Live Trace.

  • File Read and Extract

    Hi,
    I have a script which runs and generates log files. Rather than manually read through these log files, I'd like to code a program which will take the file, read through it and extract the data I wish to extract.
    For example, it may read:
    bla bla bla
    bla bla bla
    23/03/05 - 151105 Files
    bla bla bla
    23/03/05 - Elapsed Time: 3m 50s
    bla bla bla
    24/03/05 - 51250981502 files
    bla bla
    24/03/05 - Elapsed Time: 59m 12s
    bla bla
    etc etc.
    So I want to ignore the "bla bla bla", pick out my keywords, such as file, time and print out the number next to it, preferably to a nice little html file or something :)
    I am able to read files and I think I can pick out keywords using string tokenizers, although this is more advanced than tokenizers I've used before. I used a buffer to split the file and read it line by line.
    I'm pretty stumped, although this seemed like a straight forward thing to do at the time....
    Any advice to get me going?
    Thanks!

    you could use a reg ex to match on xx/xx/xx and still read line by line.
    or you could use Integer.parseInt and always parse the first two characters of a line, if they parse they are integers, but maybe blah has integers in the first two positions as well.

  • DataSources and extract structures generation

    Hi,
    How would I generate the DataSources and extract structures using transaction LBWE? It seems that there are no push buttons to say to generate the DataSources and extract structures from LBWE? Would clicking on the DataSources and extract structures and click on the continue button be enough?
    Thanks

    I check from LBWE maintenance structure column, and the fields are there on the left hand side for the selection criteria.
    How would I check "..<i>fields you have enhaced are ready to use</i>...." from LBWE.
    From RSA6, I would doubleclick on the LIS datasource, and I see no enhanced fields and therefore could not see if they are hidden.
    "<i>Did you check in LBWE if your strcutures have the fields ready to use?" </i>How would I do this? Maybe this is the problem.
    Thanks
    Message was edited by:
            NoNoNo ...

  • Data source and Extract Structure

    Hi all,
    I have a doubt on Data source and Extract Str,
    when i used one info cube with some char and kf's
    after i did extraction shall we change the extract strcuture prequently other wise better to use all the predefined extract strcuture hide in data source.
    if i hide in datasource after extraction i want to use some of hide fields, so we can use it? if we can use how can we extract data for that specified hide fields to bw side.

    If you wont to create the genaric data source at that time
    you can create cube with some char and kf.
    after extraction you wont to modify the structure ? if you mofify
    the structure then replicate the data source and delete the data
    and upload the data from r/3 to bw.its not correct way every time modifying the
    structure.if you put hide means that fields are not coming to
    bw side.if put modify the hide field ,first goto rsa6 edit data source
    remove the hide check box and save after come to bw replicate the data source
    delete the data and load the data (if you wont full data for hide field)
    if you dont load full load means only available upto data only what ever field you modify the
    hide to unhide,

  • Load Metadata and Extract Metadata tasks in EPMA hfm app not appearning

    Hello,
    I have deployemed a hfm app in EPMA.
    But the options of Load Metadata and Extract metadata does not appear under Load task and Extract task.
    Version of EPMA is 9.3.1.3.
    Is this some limitation with this version of EPMA or have I done something wrong during the installation.
    The user has all the privileges for this app.
    Please help.
    Thanks and Regards
    Hemanth

    Sorry,
    Posted in a wrong forum.
    Thanks
    Hemanth

  • I created in iMovie, and extracted audio from one of the clips to use in the title sequence.  All is well, export to iDVD and it plays OK, but when I burn the DVD the audio for the titles does not play. Any suggestions?

    I created in iMovie, and extracted audio from one of the clips to use in the title sequence.  All is well, export to iDVD and it plays OK, but when I burn the DVD the audio for the titles does not play. Any suggestions?

    I am on a MacBook Pro with OS 10.6.7 running iMovie '11 and iDVD 7.1.1.  Thanks for any input.

  • Datasources and Extract structure

    Hi guys,
    I am pretty confused about DataSources and Extract structure.
    Can someone please explain it me in simple words.

    Hi Zubin,
    Data Source is a consoliated list of fields available and the extract structure is a data dictionary structure which illustrates the fields with additional technical elements like DATA ELEMENT , DOMAIN ans so on...
    To make it more clear look at this description from F4 help:
    A DataSource is an object for retrieving data. The DataSource is localized in the OLTP system.
    It has
    an extract structure,
    an extraction type, and
    an extraction method.
    The extract structure describes the fields of the internal table that contain the extracted data. The extraction type describes which type of extractor the DataSource uses. The extraction method extracts the data and transfers it into an internal table with the same type as the extract structure.
    The DataSource also contains information on the type of data that it stages, for example, attributes, transactional data, hierachies, or texts. It can also support different types of data update.
    Extract Structure for a DataSource
    The extraction structure for a data source shows the format in which the DataSource, or the extractor for the DataSource, transfers its data.
    A data element must be assigned to each field of the extraction structure. This allows in the Business Information Warehouse an intelligent mapping between field names and InfoObjects using just this data element.
    The extract structure must be created in the DDIC as a dictionary structure or transparent table. A view is not permitted here since it would then not give you the option to add an append.
    Appends enable you to convert your individual requirements and own "Business Logic" in the extraction process. You can fill the fields in the append using function enhancements.
    Hope this helps
    Thanks,
    Raj

  • Can we connect one R/3 to two BW systems and extract data?

    Can we connect one R/3 to two BW systems and extract data succesfully ? kindly through light on this issue.
    Thanks and regards.
    Ankush Shejul

    Of course you can.
    Just have to have the RFC destinations in place and use the
    CALL FUNCTION '....' DESTINATION '....'
    commands in ABAP, check out the ABAP forums for more info.

  • TOTAL AND EXTRACTS IN TMG

    hi experts,
                while going through the postings in forums regarding
      events in table maint. generator I came across the terms
      extracts and total . Can anybody please explian to me what is this extract and total?
    regards
    pankaj

    Hi Pankaj.
    I would like to suggest a couple of references,
    [SAP HELP Library - Standard Reference for Converting the Data Containers TOTAL and EXTRACT|http://help.sap.com/saphelp_nw04/helpdata/en/33/96613cb44b6c4de10000000a11405a/content.htm]
    [SAP HELP Library - Standard Reference for Extended Table Maintenance Events - Before Saving the Data in the Database - TOTAL and EXTRACT|http://help.sap.com/saphelp_nw04/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm]
    [SDN - Reference - Events in Table Maintenance - Issue - TOTAL and EXTRACT|Problem: Events in Table Maintenance;
    [SDN - Reference - Events in table maintenance generator - Table Total and Extract for getting the table records|events in table maintenance generator;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

Maybe you are looking for

  • Could not load MMXCore Routines module because it does not work with Photoshop CS6?

    What is this - should I be concerned? Thanks, DrDisk

  • Ipv6 + oracle application server 10.1.3.3

    Hi, Installed oracle application server 10.1.3.3 on hpux 11.31. I want to access through IPV6 address like http://[ipv6]:7777. what i have to do to access through ipv6 address. i tried by specifying <category id="start-parameters"> <data id="java-opt

  • Org str

    Hello,   I am new to SAP HR. Can anybody help create Personnel area and sub area. I need the steps in detail please. Thanks, Mahti

  • Call Photoshop Action from other APP?

    Hi Everyone, Anybody has any experience to run any Photoshop action using a binary .EXE file? For example, I want to let Photoshop execute a filter action from my own application? I know that DROPLET can do this, what I did is that I use System("Drop

  • Screen freezes when I try to watch downloaded movie

    I downloaded a rented movie and when I go to watch it the screen freezes. No controls come up or anything. No part of the page responds- not the minimize, close out, etc functionality is gone. Really the problem started when I downloaded a newer vers