Extracting Values from XML-Document in pl/sql

Hello!
I need to extract the content of the following extract:
<ns1:OXERPGetArticlesResponse xmlns:ns1="OXERPService">
<ns1:OXERPGetArticlesResult>
<ns1:OXERPType>
<ns1:aResult>
<ns1:ArrayOfString>
<ns1:string>OXID</ns1:string>
<ns1:string>531f91d4ab8bfb24c4d04e473d246d0b</ns1:string>
</ns1:ArrayOfString>
<ns1:ArrayOfString>
<ns1:string>OXARTNUM</ns1:string>
<ns1:string>0601-85-069</ns1:string>
</ns1:ArrayOfString>
<ns1:ArrayOfString>
<ns1:string>OXPRICE</ns1:string>
<ns1:string>100.5</ns1:string>
</ns1:ArrayOfString>
</ns1:aResult>
<ns1:blResult>true</ns1:blResult>
<ns1:sMessage/>
</ns1:OXERPType>
<ns1:OXERPType>
<ns1:aResult>
<ns1:ArrayOfString>
<ns1:string>OXID</ns1:string>
<ns1:string>531a8af7d9a9a5bb53b65a2b9a5356e5</ns1:string>
</ns1:ArrayOfString>
<ns1:ArrayOfString>
<ns1:string>OXARTNUM</ns1:string>
<ns1:string>0601-85-069-1</ns1:string>
</ns1:ArrayOfString>
<ns1:ArrayOfString>
<ns1:string>OXPRICE</ns1:string>
<ns1:string>89.9</ns1:string>
</ns1:ArrayOfString>
</ns1:aResult>
<ns1:blResult>true</ns1:blResult>
<ns1:sMessage/>
</ns1:OXERPType>
</ns1:OXERPGetArticlesResult>
</ns1:OXERPGetArticlesResponse>
The output should be:
OXID OXARTNUM OXPRICE
531f91d4ab8bfb24c4d04e473d246d0b 0601-85-069 100.5
531a8af7d9a9a5bb53b65a2b9a5356e5 0601-85-069-1 89.9
The count of rows and columns is variable.
I want to do this by using xmltype.extract but I found no way to create a loop over the content of the xml document.
Hopefully someone can help me!
Regards
Herbert

OK, then you should be able to use something like :
SQL> var xmldoc clob;
SQL> begin
  2   :xmldoc := '<ns1:OXERPGetArticlesResponse xmlns:ns1="OXERPService">
  3  <ns1:OXERPGetArticlesResult>
  4  <ns1:OXERPType>
  5  <ns1:aResult>
  6  <ns1:ArrayOfString>
  7  <ns1:string>OXID</ns1:string>
  8  <ns1:string>531f91d4ab8bfb24c4d04e473d246d0b</ns1:string>
  9  </ns1:ArrayOfString>
10  <ns1:ArrayOfString>
11  <ns1:string>OXARTNUM</ns1:string>
12  <ns1:string>0601-85-069</ns1:string>
13  </ns1:ArrayOfString>
14  <ns1:ArrayOfString>
15  <ns1:string>OXPRICE</ns1:string>
16  <ns1:string>100.5</ns1:string>
17  </ns1:ArrayOfString>
18  </ns1:aResult>
19  <ns1:blResult>true</ns1:blResult>
20  <ns1:sMessage/>
21  </ns1:OXERPType>
22  <ns1:OXERPType>
23  <ns1:aResult>
24  <ns1:ArrayOfString>
25  <ns1:string>OXID</ns1:string>
26  <ns1:string>531a8af7d9a9a5bb53b65a2b9a5356e5</ns1:string>
27  </ns1:ArrayOfString>
28  <ns1:ArrayOfString>
29  <ns1:string>OXARTNUM</ns1:string>
30  <ns1:string>0601-85-069-1</ns1:string>
31  </ns1:ArrayOfString>
32  <ns1:ArrayOfString>
33  <ns1:string>OXPRICE</ns1:string>
34  <ns1:string>89.9</ns1:string>
35  </ns1:ArrayOfString>
36  </ns1:aResult>
37  <ns1:blResult>true</ns1:blResult>
38  <ns1:sMessage/>
39  </ns1:OXERPType>
40  </ns1:OXERPGetArticlesResult>
41  </ns1:OXERPGetArticlesResponse>';
42  end;
43  /
Procédure PL/SQL terminée avec succès.
SQL> SELECT x1.rec_id
  2       , x2.col_name
  3       , x2.col_value
  4  FROM XMLTable(
  5        XMLNamespaces('OXERPService' as "ns1"),
  6        '/ns1:OXERPGetArticlesResponse/ns1:OXERPGetArticlesResult/ns1:OXERPType/ns1:aResult'
  7        passing xmltype(:xmldoc)
  8        columns rec_id for ordinality
  9              , rec_xml xmltype path 'ns1:ArrayOfString'
10       ) x1,
11       XMLTable(
12        XMLNamespaces('OXERPService' as "ns1"),'/ns1:ArrayOfString'
13        passing x1.rec_xml
14        columns col_name  varchar2(30) path 'ns1:string[1]'
15              , col_value varchar2(30) path 'ns1:string[2]'
16       ) x2
17  ;
    REC_ID COL_NAME                       COL_VALUE
         1 OXID                           531f91d4ab8bfb24c4d04e473d246d
         1 OXARTNUM                       0601-85-069
         1 OXPRICE                        100.5
         2 OXID                           531a8af7d9a9a5bb53b65a2b9a5356
         2 OXARTNUM                       0601-85-069-1
         2 OXPRICE                        89.9
6 ligne(s) sélectionnée(s).You mentioned that the number of column(s) is not known in advance. That's gonna be a problem to present the data column-wise.
Version 11g has the PIVOT feature, but still you have to know how many columns there will be in the result set.
How are you going to use the data after extraction?
Maybe we could advise some other techniques more relevant for your requirement.

Similar Messages

  • Extracting value from XML tags in Java

    Hi all,
    I need to extract the value from a string (XML Format). Eg. <Name>Ray</Name> and displaying Name: Ray
    The string value is like any other String class object except that it is format with XML tags. I have quite a few examples that shows how a value can be read from a .xml file but none that describe how to get a value from a String object.
    Thanks in advance.

                         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder parser = factory.newDocumentBuilder();
         Document document = parser.parse("Your XML Goes here ");

  • Extracting attributes from XML document using plsql

    Hello,
    I have successfully written a plsql procedure that has been
    using Xpath to extract the element values from an XML doument:
    i.e.
    l_xpath := '/Form_Data/Person_Details/Initials';
    l_DomNodeList := xslprocessor.SelectNodes(l_RootNode, l_xpath);
    l_DomNode := xmldom.item(l_DomNodeList,0); -- first Element
    l_DomNode := xmldom.getfirstchild(l_DomNode);
    l_id_number := xmldom.getNodeValue(l_DomNode);
    However the data (Initials) I wish to extract is now stored as
    attributes within the Person_Details element and I was wondering
    how I would go about explicitly extracting the attributes values!
    I have not been able to find any examples, although I have been
    pointed in the direction of xmldom.getattribute without any
    success!
    Any help, or code examples greatly appreciated,
    - Mark...

    example:-
    xpath.VALUEOF(i_doc,v_PricingPath||'@LockIndicator');

  • Help needed in extracting values from XML

    SAMPLE XML:
    - <Form1>
    - <Name>
    <Ttl>MR</Ttl>
    <Fore>ABC1</Fore>
    <Sur>XYZ2</Sur>
    </Name>
    - <Address>
    <Line>ADD_LINE_1</Line>
    <Line>ADD_LINE_2</Line>
    <PostCode>PST CDE</PostCode>
    </Address>
    <BirthDate>0001-01-01</BirthDate>
    - <Details>
    <TotalEarnings>1234567.00</TotalEarnings>
    <TotalDeduction>12345.00</TotalDeduction>
    </Details>
    </Form1>
    - <Form1>
    - <Name>
    <Ttl>MR</Ttl>
    <Fore>ABC2</Fore>
    <Sur>XYZ2</Sur>
    </Name>
    - <Address>
    <Line>ADD_LINE_3</Line>
    <Line>ADD_LINE_4</Line>
    <PostCode>PST CDE</PostCode>
    </Address>
    <BirthDate>0002-02-02</BirthDate>
    <Gender>female</Gender>
    - <Details>
    <TotalEarnings>12345.00</TotalEarnings>
    <TotalDeduction>123.00</TotalDeduction>
    </Details>
    </Form1>
    There can be any 'n' number of <Form1>'s in one XML.But I want to get only the details of the person whose TotalEarnings>1million. Details include
    Name->Ttl,Fore,Sur
    which in this case would be MR,ABC1,XYZ1
    Address->Line,Line,Postcode
    which in this case would be ADD_LINE_1,ADD_LINE_2,PST CDE
    Birthdate
    which in this case would be 0001-01-01
    Gender
    which in this case would be "null" as there is no Gender tag present
    Details->TotalEarnings,TotalDeduction
    which in this case would be 1234567.00,12345.00
    The technique I was using is,
    1. Convert to clob
    2. User dbms_instr find the location of <Form1> in a loop
    3. For every occurence of <Form1> I find <TotalEarnings> value and check if this is greater than 1 million.
    4. If true, I use dbms_instr to get the values of all the tags inside <Form1>
    5. The drawback of using dbms_instr is that it gets the value of first occurence of whatever sting we supply.In this case dbms_instr(xml,'<Gender>',position of Form1) will not return null whereas it will return "Female" from the next form. This is wrong as it doesnt belong to the person who earns more than a million.
    Can anyone suggest a way to fetch the values that only belong to the form of the person who earns more than a million?

    There can be any 'n' number of <Form1>'s in one
    XML.Not if you want the XML to be valid there can't. You would need a root element around all the <Form1>'s to make it valid.
    The technique I was using is,
    1. Convert to clob
    2. User dbms_instr find the location of <Form1> in a
    loop
    3. For every occurence of <Form1> I find
    <TotalEarnings> value and check if this is greater
    than 1 million.
    4. If true, I use dbms_instr to get the values of all
    the tags inside <Form1>
    5. The drawback of using dbms_instr is that it gets
    the value of first occurence of whatever sting we
    supply.In this case
    dbms_instr(xml,'<Gender>',position of Form1) will not
    return null whereas it will return "Female" from the
    next form. This is wrong as it doesnt belong to the
    person who earns more than a million.
    Can anyone suggest a way to fetch the values that
    only belong to the form of the person who earns more
    than a million?Why on earth are you using dbms_instr for this? Oracle has built in XML functionality for use against XMLTYPE data, such as the ExtractValue method and the use of XPATH expressions.
    I'd suggest you start reading some of the manuals regarding XML functionality in Oracle rather than trying to manually parse it all.

  • Regular expression to extract value from xml

    Hi,
    I need to extract the value of an XML tag.
    <purchaseId>Best-200423</purchaseId>
    The result of the expression should be: "Best-200423".
    Something like this ([^\\<purchaseId\\>]*[^\\</purchaseId\\>]) does not work.
    Does somebody has a soltuion?
    I can't get it to work! I want to use the Java Regular Expression functionality.
    Best wishes
    Jochen

    You got lucky, is all. Try changing "Best" to "pest" in your example and it won't work. The square brackets are spurious, and you want m.getGroup(1) to get the stuff that matches the () group.
    Square brackes mean "match any of the characters in the brackets". [^ means "match any character not in this list").                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Extract value from XML column .

    Hi,
    I'm on 11.2.0.3 and got query
    select other_xml from v$sql_plan where sql_id=’2y32qkr40b82a’ and other_xml is not null
    <other_xml><info type="db_version">11.2.0.3</info>
    <info type="parse_schema"><![CDATA["LIU"]]></info><info type="dynamic_sampling">2</info>
    <info type="plan_hash">3882242470</info><info type="plan_hash_2">281948136</info>
    <peeked_binds><bind nam=":N1" pos="1" dty="2" pre="0" scl="0" mxl="22">c30d51</bind>
    <bind nam=":N2" pos="2" dty="2" pre="0" scl="0" mxl="22">c30d51</bind>
    <bind nam=":N3" pos="3" dty="2" pre="0" scl="0" mxl="22">c30d51</bind></peeked_binds>
    <outline_data><hint><![CDATA[IGNORE_OPTIM_EMBEDDED_HINTS]]></hint>
    <hint><![CDATA[OPTIMIZER_FEATURES_ENABLE('11.2.0.3')]]></hint>
    <hint><![CDATA[DB_VERSION('11.2.0.3')]]></hint>
    <hint><![CDATA[FIRST_ROWS(100)]]></hint>
    <hint><![CDATA[OUTLINE_LEAF(@"SEL$1")]]></hint>
    <hint><![CDATA[FULL(@"SEL$1" "LIU"@"SEL$1")]]></hint>
    </outline_data></other_xml>I want output related to <info type="dynamic_sampling">2</info> :
    column name dynamic_sampling
    row value 2
    on the second thought using dynamic_sampling value as a predicate would be great so:
    select * from v$sql_plan
    where
    dynamic_sampling = 2
    how to transform other_xml column to have such results ?
    Regards
    GregG
    Edited by: GregG on Feb 8, 2013 1:14 PM

    And here is an xmltable version:
    select p.sql_id, t.val
    from   v$sql_plan p
    ,      xmltable('for $i in /other_xml/info
                     where $i/@type eq "dynamic_sampling"
                     return $i'
                    passing xmltype(p.other_xml)
                    columns attr varchar2(50) path '@type',
                            val  varchar2(50) path '/') t
    where  p.other_xml is not null;This works for me in 11.2.0.3 but crashes in 11.1.0.7 with ORA-00600: internal error code, arguments: [qctVCO:csform], [0], [0], [0], [0], [112], [2], [224], [], [], [], []

  • Extracting data from XML

    Im fairly new to XML & web services so bear with me please.
    Im trying to extract data from XML documents where the structure/element names are unknown.
    The condition for extracting data is if keyword matches some data content.
    Im using Java and the DOM API with xcerces and I've managed to parse the XML file, what I need to do next is to traverse the data content checking against keywords and if a keyword matches then to strip the tags and save the data locally ?
    Ive trawled through all the documentaion but as theres so many different methods Im somewhat unsuare which is the best way to proceed.
    thanks

    tough question, i would suggest looking at jdom as solution for you, because it is a relatively simple one to use for searching through a dom. aside from that, its probably up to you what sort of logic you want to use.

  • Need help in extracting value from an xml tag.

    Hi ALL,
    Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
    I am using the following client:
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ////////////////////////////////// XML Schema ///////////////////////
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/chipsxml.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oradev.com/chipsxml.xsd"
    xmlns:samp="http://www.oradev.com/chipsxml.xsd"
    version="1.0">
    <element name="Field1">
    <complexType>
    <sequence>
         <element name="UTI">
              <complexType>
              <sequence>
              <element name = "U01" type = "string"/>
              <element name = "U02" type = "string"/>
              <element name = "U03" type = "string"/>
              <element name = "U03a" type = "string"/>
              <element name = "U03b" type = "string"/>          
              <element name = "U03c" type = "string"/>          
              <element name = "U04" type = "string"/>                    
              <element name = "U05" type = "string"/>                    
              </sequence>
              </complexType>
         </element>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    ////////////////////////// Table which has multiple Column //////////////////////////
    CREATE TABLE chipsxmltable1 (
    id number, XMLDATA XmlType)
    XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
    ELEMENT "Field1";
    ///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
    INSERT INTO chipsxmltable VALUES(
    xmltype.createxml('<?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
    <UTI>
    <U01>No</U01>
    <U02>Y</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>     
    <U04>Y</U04>
    <U05>Y</U05>          
    </UTI>
    </samp:Field1>'));
    To show the data as a field with structure:
    1. Query:
    Select * from chipsxmltable1;
    Output:
    ID XMLDATA
    1 <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    2. Query: (Both the query displays the same Output)
         SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
         select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    XMLDATA
    <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    To show the data as a single string without structure using "getstringval()":
    3. Query
         select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
    OUtput:
    CHIPS - XML
    NoNoYYYYYY
    To show the data as a single string without structure using "getclobval()":
    4.Query
         select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    NoNoYYYYYY
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
    6.Query:
         select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    The above queries are not fetching the value.
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
    7. Query:
         select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
         select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
    Output:
    X
    The above queries are not fetching the value.
    My question is:
    How to fetch values from xml tag when the value are inserted through xml schema?
    Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
    Very best regards,
    Godwin Jebakumar C.V.

    Hi,
    You need to declare the namespace of each element used in the XPath expression, like this :
    SQL> select extractvalue( XMLDATA
      2                     , '/samp:Field1/UTI/U01'
      3                     , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
      4  from chipsxmltable1 x
      5  ;
    XMLDATA
    No
    SQL> select extract( XMLDATA
      2                , '/samp:Field1/UTI'
      3                , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
      4                ).getstringval() "XMLDATA"
      5  from chipsxmltable1 x
      6  ;
    XMLDATA
    <UTI>
      <U01>No</U01>
      <U02>Y</U02>
      <U03>Y</U03>
      <U03a>Y</U03a>
      <U03b>Y</U03b>
      <U03c>Y</U03c>
      <U04>Y</U04>
      <U05>Y</U05>
    </UTI>
    Please see EXTRACT and EXTRACTVALUE documentation :
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm#i1006712
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm#SQLRF06173
    BTW, "XMLDATA" is a pseudo-column used by Oracle. I don't know if it'll ever cause any conflict but maybe you should rename your column.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
    Regards.

  • How to extract the actual XML document from soap message?

    My problem is " how to extract the actual XML document from soap message? "
    i just want to extract the attachment i.e. (pure XML document without any soap header or envolope).
    i could be ver thank full if u could solve my problem.
    [email protected]

    Hi,
    This is some skeleton code for extracting an attachment from a SOAPMessage.
    import javax.activation.DataHandler.;
    import javax.xml.soap.*;
    import javax.xml.message.*;
    Iterator allAttachments = message.getAttachments();
    AttachmentPart ap1 = null;
    while(allAttachments.hasNext()){
    ap1 = (AttachmentPart)allAttachments.next();
    //Check that the attachment is correct one. By looking at its mime headers
    //Convert the attachment part into its DOM representation:
    if(ap1.getContentType() == "text/xml"){
    //Use the activation dataHandler class to extract the content, then create a StreamSource from
    //the content.
    DataHandler attachmentContent = ap1.getDataHandler();
    StreamSource attachmentStream = new StreamSource(attachmentContent.getInputStream());
    DOMResult domAttachment = getDOMResult(attachmentStream);
    domAttachment holds an xml representation of the attachment.
    Hope this helps.

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Extract data from xml file and insert into another exiting xml fil

    hello,
    i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    Regards,
    Zhuozhi

    If the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
    If the files are large, you probably want to use a StAX or SAX.

  • Extract data from XML file to Oracle database

    Dear All
    Please let me know, how to extract data from XML file to Oracle database which includes texts & images.
    Thanking You
    Regards Lakmal Marasinghe

    I would do it from the database, but then again, I am a database / PL/SQL guy.
    IMHO the database will deliver you with more options. I don't know about "speed" between the two.

  • How to Pass values from XML to JSP??? Urgent Please Help me

    Hi guys,
    I am new to XML, I want to pass values from XML to JSP. I have a xml file with attributes, I should send this values to a JSP file. How is it??? Please Help guys.... its very urgent. Please send me how to do it with an example or atleast any urls related that....
    Looking for ur favourable reply.
    Thanks in advance,
    Sridhar

    in a servlet :
    parse your xml file (see how at the end of the post) and
    put the values you want in the request attributes
    request.setAttribute("value1", value1);
    ...redirect to the jsp
    in the JSP:
    get the wanted attributes:
    String value1=(String)request.getAttribute("value1");To learn how to parse a xml file, pay a look at this page, it explains how to read the XML document to build an object representation, and then how to navigate through this object to get the data
    http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm

  • XML parser for fatching multiple values from XML

    Hi,
    In my scenirio i have to facth multiple values from XML file and then set in to Table in webdynpro...
    Fo example my xml has values like...
    <xml>
         <item>
              <item1>
                   <quantity>
                        100
                   </quantity>
                   <price>
                        50
                   </price>
              </item1>
              <item2>
                   <quantity>
                        200
                   </quantity>
                   <price>
                        20
                   </price>
              </item2>
              <item3>
                   <quantity>
                        300
                   </quantity>
                   <price>
                        10
                   </price>
              </item3>
         </item>
    </xml>
    then i have to fcath those quantity and price and set in to table...
    How to do taht in webdynpro and does any one have parser code for retriving multiple values...

    Hi,
    1) You need to use JDOM parser.
    2) The code for parsing XML using JDOM parser is readily available if you search on google.
    3) You will have to check the attribute during every parsing and then if attribute is quantity you can fetch the corresponding tags.
    4) Something similar to this:
    org.jdom.Document document = parser.build(file);
                    org.jdom.Element rootElement = document.getRootElement();
                    org.jdom.Element childElement = rootElement.getChild("file");
                    Element xmlElement = childElement.getChild("item");
                    if (xmlElement != null) {
                        List itemElementsList = xmlElement.getChildren("item1");
                        if (itemElementsList != null) {
                            Iterator iterator3 = itemElementsList.iterator();
                            while (iterator3.hasNext()) {
                                //For each group get quantity
                                Element itemElement = (Element) iterator3.next();
                                List quantityElementsList =
                                        itemElement.getChildren("quantity");
                                if (quantityElementsList != null) {
                                    Iterator iterator2 =
                                            quantityElementsList.iterator();
                                    while (iterator2.hasNext()) {
    // Your code                                                                               
    You might need to make some changes as per your rquirement. Just use this sample to understand how you need to parse the xml
    Hope it helps.
    Regards.
    Rajat
    Edited by: Rajat Jain on Jan 22, 2009 9:51 AM

  • Extract values from a long text

    Hi, I need help in extracting value from a long text
    Sample data:
    A_BOARD_MEETING_600
    I need to extract MEETING from the text.
    I tried to use CHARINDEX and SUBSTRING but it's not returning the text I wanted.  I hope you can help me.
    select SUBSTRING(ID, CHARINDEX('_', ID,1+CHARINDEX('_', ID))+1, CHARINDEX('_', ID, 1+CHARINDEX('_', ID, 1+CHARINDEX('_', ID,1)))-1 ) from table
    Using the query above it's returning MEETING_600.

    Hi, thanks!  But would like to ask how can this be converted where it can get the column ID in a table, I'm still learning SQL.
    Select Parsename(Replace(YOURCOLUMNNAME,'_','.'),2)From your tablename

Maybe you are looking for

  • Help with Batch Capturing, Timecode Issues?

    Hi Final Cut Pro Pro's. I've just come over from Avid. I have a problem with capturing - I have a lot of tapes to capture and there is no way I will make deadline doing it by individual capture - I need to batch capture. My tape shows no timecode bre

  • Dynamic update of pdf files on web server with xml

    Hi forum Is it possible, to make a pdf form quiz, on a web site, there are updating it contents every day just bye replacing a xml file there have the text for the questions.? I just need some guindes or ide how to make this. ( i am new in xml/ dynam

  • [Solved] Pacman mounts partition on checking available disc space

    Hi, hope this is the right subforum. First, pacman doesn't directly mount any partition. My partition, located at /dev/sdb1, is automounted if somenone request access to /media/datengrab. Fstab-entry looks like this: /dev/sdb1 /media/datengrab ext4 n

  • Can't get photos on nano

    I have followed the instructions to the letter and have plenty of space on my nano--1.2 gigs. I have set up itunes to automatically upload a picture directory in iphoto. Itunes is updating tunes but not photos. What gives?

  • Send a draft for review error

    I've got a writer who can get on and edit a page, but when he goes to send a draft for review, there are no users or roles in the box to select from. It doesnt seem like you can enter these manually, so we cant use the drafts functionality. Anyone go