Need to Parse or Read XML into a ResultSet

Hi, I see lots of examples of folks reading from a database, populating a ResultSet, and then putting that data into an XML document. I don't see any reference to going the other way, and was hoping some of you might have an insight on how to do this.
We have a huge historical database and want to take the older info, put it into xml format, zip it, and store the zip'd result as a blob. That's the easy part.
We want to be able to go back, to read the blob, unzip it, and then populate a ResultSet and return that to the caller. I don't see any slick methodology to either 1.) instantiate an empty ResultSet or 2.) parse/read an XML structure into a ResultSet.
Any bright ideas?
Thanks, John

@maggie: That is easily done with XPath expressions, for example:
xmlstarlet sel -t -m '//servers[@country_code="us"]' -c '.' -n vpn.xml
xmlstarlet sel -T -t -m '//servers[@country_code="us"]' -v @public_name -o " " -v @bw -n vpn.xml
xmlstarlet sel -t -m '//servers[@country_code="us"]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
xmlstarlet sel -t -m '//servers[@country_code="us" and @currentload<15]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
xmlstarlet sel -t -m '//servers[@currentload<15]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
http://www.w3schools.com/xpath/default.asp
Edit: If you use json and jshon, then you'll have to do the sorting and filtering in the shell
jshon -e servers -a -e country_code -u -p -e public_name -u -p -e bw -u <vpn.json | {
# filter country_code
while read -r country_code && read -r public_name && read -r bw; do
[ x"$country_code" = x"ca" ] && echo "$public_name $bw";
done
} | sort -k2,2nr -k1,1d # sort second field (bw) numeric reverse, if equal use dictionary sort on first (name)
Last edited by progandy (2015-05-31 05:47:50)

Similar Messages

  • Need to turn this lastName_Name_01_07_1980.xml into  Name LastName 01.07.80

    Hi all
    I am using this code to trim a string and place it into a jMenu. Now I would like to change the out the way is looks to make it easier to view.
    Like this:
    Need to turn this file name lastName_FirstName_01_07_1980.xml into FirstName LastName 01.07.80
    is this posible to do ?
    can some me how ?
      private void addItem(JMenu menu, char a)
      File dir = new File("Epod Configuration/Orders To Upload");
            File[] files = dir.listFiles();
            for (int j=0; j < files.length; j++)
                    String trim = ""+files[j];
                    int ndx;
                    if ((ndx = trim.lastIndexOf('/')) != -1) trim = trim.substring(ndx+1);
                    if (trim.charAt(0) == a)
                      System.out.println(trim);
                            JMenuItem mi = new JMenuItem(trim);
                            menu.add(mi);
      }Thanks
    Craig

    thanks for that
    but how do I put the two codes together ??
    the file name also has .xml at the end what is the bet way of getting rid of that
    this is what I have try but doesn't work
    Please help
    private void addItem(JMenu menu, char a)
        File dir = new File("Epod Configuration/Orders To Upload");
        File[] files = dir.listFiles();
        for (int j=0; j < files.length; j++)
          String trim = ""+files[j];
          int ndx;
          if ((ndx = trim.lastIndexOf('/')) != -1) trim = trim.substring(ndx+1);
          if (trim.charAt(0) == a)
            System.out.println(trim);
            String s = "lastName_FirstName_01_07_1980";
            StringTokenizer st = new StringTokenizer(s, "_");
            String last = st.nextToken();
            String first = st.nextToken();
            String month = st.nextToken();
            String day = st.nextToken();
            String year = st.nextToken();
            System.out.println(first + ' ' + last + ' ' + month + '.' + day + '.' + year);
            JMenuItem mi = new JMenuItem(trim);
            menu.add(mi);
      }

  • Reading XML into a Hashtable

    I have the following XML file:
    <fields>
    <name>J. Postma</name>
    <date>21-05-2004</date>
    </fields>
    I want to put the fields in a Hashtable. Name is the key and "J. Postma" is the value. How can I parse the XML and add the fields into a Hashtable?

    Dubwai, me too. But for only a half-day of effort,
    you can make a few helper classes that vastly simplify
    the day-to-day usage of DOM.Yes. I've done that too. To the OP, if you use DOM, realize that the text value of a single element may be in multiple Text nodes. You can't just grab the first one. You need to loop through all Text node children and concatenate their values.

  • Pull parser to read documents into container

    I decided to open new thread, as my question arised from the different problem described here. In general, I have a problem (probably related to a memory) with loading huge amount of data (474 MB) into node storage container. After suggestions I decided to delegate XmlEventReader methods not to native XML reader from Berkeley DB XML, but to other XML parser.
    Precisely, I started to override method of com.sleepycat.dbxml.XmlEventReader, pull parser written in Java and interfaced by javax.xml.stream.XMLStreamReader. However, there are some mismatchings in methods naming, constants for returned values etc.
    Can anyone suggest me any other Java pull parser, closer do Berkeley DB XML XmlEventReader and doing nearly the same job as native parser implementation ?
    TIA,
    Maciej

    Maciej,
    I've been hoping that somebody would create/post a StAX to XmlEventReader class. That interface was used as a reference when designing XmlEventReader/Writer. The eventual intent is to have a Java standard interface available as well. I was hoping for something user-contributed. Perhaps someone's done this but nobody has notified the BDB XML community if they have.
    I don't see why you are looking for something other than XMLStreamReader -- it matches well with XmlEventReader. Yes, it's necessary to map some constant values (event types among others) as well as perhaps temporarily cache some data but generally the mapping should be obvious and easy.
    Regards,
    George

  • Issues du read XML into Oracle

    Hello all,
    I try to insret XML data into Oracle, and I looked on forum for tips. I found (I think) the way to do it, but I have an error :
    Here is what I did : I created a table of XMLType (OK) :
    CREATE TABLE XML_TAB ( xmlval XMLType);
    Then I insert data directly (OK):
    INSERT INTO XML_TAB VALUES (
    xmltype('&lt;?xml version="1.0"?&gt;
    &lt;EMP&gt;
    &lt;EMPNO&gt;221&lt;/EMPNO&gt;
    &lt;ENAME&gt;John&lt;/ENAME&gt;
    &lt;/EMP&gt;'));
    Now, I want to import directly from a XML file. I try this :
    INSERT INTO Xml_tab
    VALUES
    xmltype(bfilename('xml_dir','essai2.xml'),nls_charset_id('AL32UTF8'))
    it fails with ORA-06553: PLS-306: num&eacute;ro ou types d'arguments erron&eacute;s dans appel &agrave; 'XMLTYPE' (xml_dir is setup)
    or this :
    INSERT INTO Xml_tab
    VALUES
    xmltype('D:/TMP/XML/essai2.xml',nls_charset_id('AL32UTF8'))
    it fails with ORA-06553: PLS-307: trop de d&eacute;clarations de 'XMLTYPE' correspondent &agrave; cet appel
    I try with Oracle 9i.
    Did I miss something ?
    I'm not far to succeed what I want to do. Thank's a lot for your help.
    Antoine

    Hello,
    Thanks for you answer. Oracle version is 9.2.0.4.0.
    Thanks also for the BFILENAME information. My problem remains that if I try to read by entering directly the filename, I have the PLS307 error.
    I will check the XMLDB FAQ, but I have seen several documentation, and process is always the same, as I do...except for the error.
    I will also try in 10g, to see if it works better.
    Antoine

  • Read XML into the database

    Hi,
    If I have a XML file and want to read its attributes into matching columns in a table, what is the best way to map the xml e.g. firstname to a firstname column in the table?
    <name>
    <firstname>Bill</firstname>
    <last>Gates</last>
    </name>
    Thanks

    Why do you want to do this? (Might help with the answer).

  • Read xml into oracle table

    Hi,
    How can I read an xml.file read in an oracle table (invoice varchar2(20), invoice_line number, ship_date date, country varchar2(100))?
    The xml looks like this:
    <?xml version="1.0" encoding="utf-8" ?>
    - <dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
    - <!--
    <dataset
    xmlns="http://developer.cognos.com/schemas/xmldata/1/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
    xs:schemaLocation="http://developer.cognos.com/schemas/xmldata/1/ xmldata.xsd"
    >
    -->
    - <metadata>
    <item name="Invoice #" type="xs:string" length="42" />
    <item name="Invoice Line" type="xs:string" length="10" />
    <item name="Ship Date" type="xs:date" />
    <item name="COUNTRY" type="xs:string" length="8" />
    </metadata>
    - <data>
    - <row>
    <value>26623</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    - <row>
    <value>26624</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    - <row>
    <value>26624</value>
    <value>0003</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    - <row>
    <value>26625</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    </data>
    </dataset>
    Thnx, Robbert

    Hi,
    Possible solutions will depend on your db version, which you didn't give.
    The following example assumes you're using 10gR2 :
    CREATE TABLE invoices (
    invoice varchar2(20),
    invoice_line number,
    ship_date date,
    country varchar2(100)
    DECLARE
    xmldoc xmltype := xmltype(
    '<?xml version="1.0" encoding="utf-8" ?>
    <dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
    <metadata>
    <item name="Invoice #" type="xs:string" length="42" />
    <item name="Invoice Line" type="xs:string" length="10" />
    <item name="Ship Date" type="xs:date" />
    <item name="COUNTRY" type="xs:string" length="8" />
    </metadata>
    <data>
    <row>
    <value>26623</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    <row>
    <value>26624</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    <row>
    <value>26624</value>
    <value>0003</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    <row>
    <value>26625</value>
    <value>0001</value>
    <value>2010-05-03</value>
    <value>USA</value>
    </row>
    </data>
    </dataset>'
    BEGIN
      INSERT INTO invoices (invoice, invoice_line, ship_date, country)
      SELECT invoice, invoice_line, to_date(ship_date, 'YYYY-MM-DD'), country
      FROM XMLTable(
       XMLNamespaces(default 'http://developer.cognos.com/schemas/xmldata/1/'),
       '/dataset/data/row'
       passing xmldoc
       columns
         invoice      varchar2(20)  path 'value[1]',
         invoice_line number        path 'value[2]',
         ship_date    varchar2(10)  path 'value[3]',
         country      varchar2(100) path 'value[4]'
    END;
    /If your XML document resides outside the database, you may also access it directly through a DIRECTORY object :
    CREATE OR REPLACE DIRECTORY xmldir AS 'C:\oracle\invoices\xml';
    INSERT INTO invoices (invoice, invoice_line, ship_date, country)
    SELECT invoice, invoice_line, to_date(ship_date, 'YYYY-MM-DD'), country
    FROM XMLTable(
    XMLNamespaces(default 'http://developer.cognos.com/schemas/xmldata/1/'),
    '/dataset/data/row'
    passing xmltype( bfilename('XMLDIR', 'invoices.xml'), nls_charset_id('AL32UTF8') )
    columns
       invoice      varchar2(20)  path 'value[1]',
       invoice_line number        path 'value[2]',
       ship_date    varchar2(10)  path 'value[3]',
       country      varchar2(100) path 'value[4]'
    );Some docs about XMLTable and XML querying with Oracle :
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb_xquery.htm#ADXDB1700
    Edited by: odie_63 on 24 juin 2010 20:07

  • XML Parser to insert values into a Table??

    Hi All,
    Bare with me I am new to xml technology, but apparently there's request to parse a xml file and store data in a oracle table.
    Appreciate if someone can help me to resolve this please??
    I am using Oracle 10g.
    This is the xml file which I need to parse.
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <PBOOKS>
    <BOOK>
    <KEY>0061319821</KEY>
    <ISBN>0-061-31982-1</ISBN>
    <![CDATA[<TTL>All Our Kin</TTL>]]>
    <![CDATA[<SUBTTL>Strategies For Survival In A Black Community</SUBTTL>]]>
    <![CDATA[<PAGES>192</PAGES>]]>
    </BOOK>
    </PBOOKS>
    I have a Oracle Table ( table name: Perseu ) to hold the values of this file:
    These are the fields:
    Key, ISBN, TTL, SUBTTL, Pages

    Due to the somewhat strange structure of the XML (Elements embedded inside the CDATA sections, do you have any idea why this is being done ?) the best I can come up with is
    SQL> drop table test
      2  /
    Table dropped.
    SQL> create table test of XMLType
      2  /
    Table created.
    SQL> insert into test values ( XMLTYPE(
      2  '<PBOOKS>
      3     <BOOK>
      4             <KEY>0061319821</KEY>
      5             <ISBN>0-061-31982-1</ISBN><![CDATA[<TTL>All Our Kin</TTL>]]><![CDATA[<SUBTTL>Strategies For Survival In A Black Community</S
    UBTTL>]]><![CDATA[<PAGES>192</PAGES>]]></BOOK>
      6  </PBOOKS>'))
      7  /
    1 row created.
    SQL> select BOOK, ISBN,
      2         extractValue(CDATA,'/CDATA/TTL') TTL,
      3         extractValue(CDATA,'/CDATA/SUBTTL') SUBTL,
      4         extractValue(CDATA,'/CDATA/PAGES') PAGES
      5    from (
      6           select extractValue(value(BOOK),'/BOOK/KEY') BOOK,
      7                  extractValue(value(BOOK),'/BOOK/ISBN') ISBN,
      8                  xmlType('<CDATA>' || extractValue(value(BOOK),'BOOK/text()') || '</CDATA>') CDATA
      9             from test,
    10                  table(xmlsequence(extract(object_value,'/PBOOKS/BOOK'))) book
    11         )
    12  /
    BOOK
    ISBN
    TTL
    SUBTL
    PAGES
    0061319821
    0-061-31982-1
    All Our Kin
    BOOK
    ISBN
    TTL
    SUBTL
    PAGES
    Strategies For Survival In A Black Community
    192
    SQL>
    SQL>
    SQL>

  • Need suggestion about a fast XML parser

    I have a program which needs to parse lots of XML files of sizes varing from few MBs to hundreds of MBs. It needs to parse the file in one-pass, and for which the SAX approach is best suited. I initially tried coding this program using the SAX parser provided by Java library, but it takes way-way too much time to parse the files. I then googled out Piccolo XML Parser, but it throws ArrayIndexOutOfBound exception. Furthermore, sometimes XML files could terminated prematurely.
    Can you suggest any SAX XML parser for this job?

    I am pasting here a trimmed version of my code..... sorry this is not the simplified and complete in itself version as the norm is.
    public Vector<String> search(String dumpfile, String srfor, int type, long size, boolean showTTH, boolean phpSerialize, String hubname) {
         Vector<String> results = new Vector<String>();
         try {
             SAXParserFactory factory = SAXParserFactory.newInstance();
             SAXParser parser = factory.newSAXParser();
             BufferedInputStream ubin = new BufferedInputStream(new FileInputStream(dumpfile));
             ubin.read(new byte[2]); //To discard the starting BZ flag.
             CBZip2InputStream bin = new CBZip2InputStream(ubin);
             String line = null;
             int c=0;
             line = "";
             while((c=bin.read())!='\n' && c!=-1) line = line + (char) c;
             String dnt = line;
             if (c==-1){// (line == null){
              dnt="";
              return null;
             line = "";
             while((c=bin.read())!='\n' && c!=-1) line = line + (char) c;
             if(c==-1)// (line == null)
              return null;
             if (!phpSerialize)
              results.add("Dump's Date and Time stamp: " + dnt + "\n==========================\n"+"hubname: " + line);
             else
              results.add("$" + dnt +"\n"+"|" + line);
             if(hubname!=null && !line.trim().toLowerCase().contains(hubname.toLowerCase().subSequence(0, hubname.length()))){
              results.add("No hits.");
              return results;
             while((c=bin.read())!='\n' && c!=-1);
             FilelistHandler handler = new FilelistHandler(srfor,type,size,showTTH,phpSerialize,hubname,results);
             try{
              parser.parse(bin, handler);
             }catch(org.xml.sax.SAXParseException saxe){
              saxe.printStackTrace();
             if(results.size()==1){
              results.add("No hits.");
         } catch (FileNotFoundException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (IOException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (ParserConfigurationException e) {
             e.printStackTrace();
         } catch (SAXParseException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
             System.err.println("Line: "+e.getLineNumber()+"; Col:"+e.getColumnNumber());
         } catch (SAXException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         return results;
    private class FilelistHandler extends DefaultHandler {
         static final int USER = 0;
         static final int FILE = 1;
         static final int DIR = 2;
         static final int ANY = 3;
         static final int UNKNOWN = 4;
         private Vector<String> results;
         Vector<String> dirs = new Vector<String>();
         private String srfor;
         private int type;
         private int level = -1;
         private long size;
         private boolean showTTH;
         private boolean phpSerialize;
         private String hubname;
         private String currentUser;
         private String currentIP;
         public FilelistHandler(String Srfor, int Type, long Size, boolean ShowTTH, boolean PhpSerialize, String Hubname, Vector<String> res) {
             srfor = Srfor.trim().toLowerCase();
             type = Type;
             size = Size;
             showTTH = ShowTTH;
             phpSerialize = PhpSerialize;
             hubname = Hubname;
             results = res;
         public void startElement(String uri, String lname, String qname, Attributes attrs) throws SAXException {
             String result = null;
             long currsize = 0L;
             String TTH = "";
             String value = "";
             int currType = UNKNOWN;
             if (qname.equalsIgnoreCase("Directory")) {
              value = attrs.getValue("Name");
              dirs.add(attrs.getValue("Name"));
              currType = DIR;
             } else if (qname.equalsIgnoreCase("user")) {
              currentUser = attrs.getValue("username");
              currentIP = attrs.getValue("ip");
              currType = USER;
             } else if (qname.equalsIgnoreCase("File")) {
              value = attrs.getValue("Name");
              currsize = Long.parseLong(attrs.getValue("Size"));
              TTH = attrs.getValue("TTH");
              currType = FILE;
             if (currType == FILE || currType == DIR) {
              // Searching.
              boolean found = false;
              result = currentUser + ":" + currentIP + ":" + (currType == FILE && showTTH ? TTH + ":" : "") + getPwd(dirs);
              if (result.trim().toLowerCase().contains(srfor.subSequence(0, srfor.length())) || currType == FILE && TTH.equalsIgnoreCase(srfor)) {
                  found = true;
              if (type != ANY && currType != type)
                  found = false;
              if (size >= 0 && currType == FILE)
                  if ((size == 0 && currsize != size) || (size != 0 && (((double) (Math.abs(currsize - size))) / size) > 0.1))
                   found = false;
              if (found) {
                  if (!phpSerialize) {
                   if (currType == FILE)
                       result = result + "/" + value;
                  } else {
                   int index = 0;
                   result = serializeEntity(index++, currType == FILE ? "f" : "d");
                   result = result + serializeEntity(index++, currentUser);
                   result = result + serializeEntity(index++, currentIP);
                   if (currType == FILE && showTTH)
                       result = result + serializeEntity(index++, TTH);
                   result = result + serializeEntity(index++, getPwd(dirs));
                   if (currType == FILE)
                       result = result + serializeEntity(index++, value);
                   result = "a:" + index + ":{" + result + "}";
                  results.add(result); // ADDING THE RESULT.
         public void endElement(String uri, String lname, String qname) throws SAXException {
             if (qname.equalsIgnoreCase("Directory")) {
              dirs.remove(dirs.size() - 1);
         private String getPwd(Vector<String> dirs) {
             String pwd = "";
             for (String dir : dirs) {
              pwd = pwd + "/" + dir;
             return pwd;
         private String serializeEntity(int index, String s) {
             return "i:" + index + ";s:" + s.length() + ":\"" + s + "\";";
         public Vector<String> getParsedData() {
             return results;
        }

  • Need conversion logic for the xml sending from legacy system ...!!!

    Hi Experts ,
    we have one requirement where in the legacy system ( Sender system) is sending .xml  file and PI needs to pick the file and send it to ECC Via IDOC AAE Receiver Adapter  to R/3  (SAP ECC) System .
    The problem is the  .xml file which PI receives is in a different format  which is shown below
    </tns:Header>
        <tns:Body>
            <esa:Payload>
                <esa:Header>
                    <PayloadName></PayloadName>
                    <PayloadVersion>1.0</PayloadVersion>
                    <PayloadCreated>2014-01-07T02:39:55.793Z</PayloadCreated>
                    <PayloadSize units="Bytes">432</PayloadSize>
                </esa:Header>
                <esa:Data>
                    <zcs:HUM xmlns:zcs="com.">
                        <Hum_Number>00393155965135748871</Hum_Number>
                        <Source_Storage_Location>9000</Source_Storage_Location>
                        <Destination_Storage_Location>0100</Destination_Storage_Location>
                        <Material_Number>000000000000004123</Material_Number>
                        <Batch_Number>321940071 </Batch_Number>
                        <Quantity>0000000096000</Quantity>
                        <Production_Version>A100</Production_Version>
                        <Hostname>POSPI000003</Hostname>
                    </zcs:HUM>
                </esa:Data>
            </esa:Payload>
        </tns:Body>
    </tns:Envelope>|]
    need help to  convert this  .xml into PI Standard xml  format ( i mean without esa,zcs, ..So that at PI the message gets passed  successfully without throwing  xml parser issue or xml well not formed error .)  .
    do i need to write any java code for this ?
    Please experts needs your suggestions here .
    regards,
    khan ,

    Hi Aziz,
    please make sure your pasted xml has  start and end tags
    <tns:Body> </tns:Body>.
    i don't think you need to change the external definition. make sure that you use xslt mapping first then message mapping.
    Regards,
    Muni.

  • Convert MBox into XML into Java Objects

    Hello all,
    this is a general question, i dont know weather there is such libs or not.
    However, please tell me what you know.
    i want to program a java application for searching purpose in Mbox.
    i thought its possible and easier to try to convert the emails from the MBox into XML files, and from these create java objects when i need or even convert the XML into html for viewing.
    Any suggestions are welcome.
    Also antoher solutions are greate.
    thanks in advance!
    Sako.

    I don't know what this MBox you speak of is - I assume it's not the thing I use to hook upa guitar to GarageBand. Maybe you mean it as a generic term for mailbox? The easiest solution (to my mind) would be to use a Java API provided by whatever MBox is. If there is no such thing, then if you get XML-formatted version of the messages I suppose writing code to parse the XML into Java Objects would be a good option if you wanted to do further manipulation of them, but if all you want to do is display them as HTML in a browser then just use XSLT to transform them.
    Good Luck
    Lee

  • Need Help Parsing JSON String using PLJSON

    Hello,
    I have JSON stored in a database field:
    --Query
    select data1 from table1 where id= 339207152427;
    --Results:
    [{"name":"Home"},{"code":"JPNWC74ZKW9"},{"start date":"01\/02\/2014"},{"person name":"hhh, RamS"}]
    I need to parse the above results into 3 fields in a separate table. For now, i'm just trying to parse the results using PLJSON, but am getting the ORA-20101: JSON Parser exception - no { start found error when running the following pl/sql block:
    declare
    VIN_JSON varchar2(4000);
    jsonObj json;
    listOfValues json_list;
    listElement json_value;
    begin
    select data1 into VIN_JSON from table1 where id= 339207152427;
    jsonObj := new json(VIN_JSON);
    listOfValues := jsonObj.get_values();
    for i in 1..listOfValues.count loop
    listElement := listOfValues.get(i);
    end loop;
    end;
    I believe my syntax is close, but was hoping for some further instruction.
    Thanks in advance!
    John

    I have no idea what you are trying to do or in what version so help, at this point, is not possible.
    Let's start with this:
    I need to parse the above results into 3 fields in a separate tableAnd the parsing rules?
    And what the result should be?
    You apparently want us to guess. Which is something most of us do not like to do. (and don't forget your full version number if you want help).
    PS: This forum has a FAQ: I recommend you read it as you didn't even put your listing into tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Extract part of xml into CLOB or XMLType

    I need to extract part of XML into CLOB or some another type. But I don't need only extract data, by whole part od xml with elements. How could I do it in PL/SQL?
    For example from this xml:
    <bookstore>
    <book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    </bookstore>
    I need to get:
    "<book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>"
    THX

    That's why I need to process every book alone - to know which authors belongs to single book.For that specific requirement, a single query would do.
    Assuming variable "v_xml_clob" holds the XML document :
    <bookstore>
      <name>nameOfBookstore</name>
      <address>1st Avenue 24, SF</address>
          <book category="COOKING">
            <title lang="en">Everyday Italian</title>
            <author>
              <name>Giada De Laurentiis</name>
              <birth>1956</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>30.00</price>
          </book>
          <book category="CHILDREN">
            <title lang="en">Harry Potter</title>
            <author>
              <name>Rowning</name>
              <birth>1977</birth>
            </author>
            <author>
              <name>xxx</name>
              <birth>1955</birth>
            </author>
            <year>2005</year>
            <price>29.99</price>
          </book>
    </bookstore>You can do :
    SELECT *
    FROM XMLTable(
    'for $i in distinct-values($d//book/author/name)
      where count($d//book/author[name=$i]) = 1
      return $i'
    passing xmltype(v_xml_clob) as "d"
    columns author_name varchar2(80) path '.'
    AUTHOR_NAME
    Rowning
    Giada De Laurentiis

  • How to read xml-stylesheet Processing Instruction from XML using DOM Parser

    Hi,
    I am trying to read an xml that contains xsl stylesheet PI using DOMParser. The parse() method reads the entire contents of the XML except the PI instruction. Below is the XML I am using to read
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet href="../../../lang/en-us/style0/usc_profile.xsl" type="text/xsl"?>
    <Oblix oblang="en-us" xmlns="http://www.oblix.com/" xmlns:oblix="http://www.oblix.com/">
    <ObProfile>
    </ObProfile>
    </Oblix>
    Can anyone let me know if there are any propery settings to be done for the DOM parser before parsing?. If so, what is the property to be set?.
    Thanks in Advance
    Muthu

    A COTS product builds the XML and inserts the respective xsl (xml:stylesheet) file name to be used for transforming the xml. I am trying to interrupt this xml and make some updations on an element and finally send the updated xml to the stream.
    For the above process, I parse the input XML using DOMParser and update the elements (some internal elements). While I view the final XML that would be passed to the stream, I found the <?xml-stylesheet... PI is missing.
    I somehow managed using a temp fix by doing the below. I manually pulled the PI using document.getFirstChild().getNodeValue() and reconstructed the PI and inserted it to the outgoing XML. This needs to be done every time. This might run into problems when more than one PI is used in the XML.
    If the parsed XML could get the PI along with it the above problem could be resolved.
    Is there any property that could be set on the parser (prior to parsing) to resolve the issue?.

  • Importing XML into Java.  Help needed Please!!!

    Hi,
    I have downloaded j2sdk1.4.1_05 and want to configure it to import XML files into a DOM in Java. I am having trouble doing this and need help. I read that version 1.4 support JAXP 1.1 but I am having trouble finding the JAXP-api.jar file. It says to put all the other Jar files into a folder and leave the JAXP-api.jar.
    Could you please tell me how to set up Java so that I can import an XML file. I also downloaded JAXP 1.2. But there seems to be no installer.
    Thanx John

    You can learn about reading xml in java by reading the J2EE tutorial at
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
    Here is sample program to read XML file into a DOM taken from this tutorial
    (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html)
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    import java.io.*;
    public class TransformationApp
      static Document document;
      public static void main(String argv[])
        if (argv.length != 1) {
          System.err.println (
            "Usage: java TransformationApp filename");
          System.exit (1);
        DocumentBuilderFactory factory =
          DocumentBuilderFactory.newInstance();
        //factory.setNamespaceAware(true);
        //factory.setValidating(true);
        try {
          File f = new File(argv[0]);
          DocumentBuilder builder =
            factory.newDocumentBuilder();
          document = builder.parse(f);
        } catch (SAXParseException spe) {
          // Error generated by the parser
          System.out.println("\n** Parsing error"
            + ", line " + spe.getLineNumber()
            + ", uri " + spe.getSystemId());
          System.out.println("  " + spe.getMessage() );
          // Use the contained exception, if any
          Exception x = spe;
          if (spe.getException() != null)
            x = spe.getException();
          x.printStackTrace();
        } catch (SAXException sxe) {
          // Error generated by this application
          // (or a parser-initialization error)
          Exception x = sxe;
          if (sxe.getException() != null)
            x = sxe.getException();
          x.printStackTrace();
        } catch (ParserConfigurationException pce) {
          // Parser with specified options can't be built
          pce.printStackTrace();
        } catch (IOException ioe) {
          // I/O error
          ioe.printStackTrace();
      } // main
    } If you have java 1.4 sdk installed everything should compile and run. Separate
    JAXP package is nor required - JAXP is included in rt.jar in java-home-directory/jre/lib.

Maybe you are looking for

  • How to make one firefox window`s actions duplicate on all opened firefox windows. duplicating tabs only opens the original source of page, not current page view

    I want to know is there a way to open, say 3, Firefox windows and duplicate the actions done on one to happen across all open Firefox windows. I want to use the repeat feature, left click followed by ENTER the whole time on a current thing I'm workin

  • Intercompany transfer for free goods

    Hi, Please suggest me in the following scenario a very low cost item is received as free alongwith a shipment for a particular PO. The GR is done in one of the plant. Now this item is distributed to another plant belonging to different company code v

  • Had email, but lost it immediately after signing in

    Set up i cloud email on my ipad, used it for a few minutes, then poof, it told me " Cannot get mail. username or password incorrect. " Went into icloud with with same username and password.  it is the same as my apple id, and I am not having problems

  • Update/Upgrade problem

    I have Aperture on my iMac at home andat my MacBookPro. My iMac requested for an update to 3.2 – which Idid. The problem is I can not update Aperture on my MacBookPro. Itdoes not work via Appstore, download from the Apple web page is notpossible to i

  • Other Device/Sound Card not working properly

     My sound card keeps failing. I can restart my computer and it will work fine for a random amount of time. But usually I'll be running youtube or soundcloud and the audio will just stop. The video will stop and no longer play.  I can try video files