Extracting Tag Value from XML returned when a web service via PL/SQL

All,
Good afternoon.
I have a PL/SQL that called a web service. The code is as below:
create or replace procedure soap3 as
soap_request varchar2(30000);
soap_respond varchar2(30000);
http_req utl_http.req;
http_resp utl_http.resp;
resp XMLType;
i integer;
bra number := 205;
cus number := 134988;
cur number := 1;
led number := 0;
sub number := 0;
chq number := 1;
n number;
v_raw RAW(32767);
buff RAW(32767);
http_res UTL_HTTP.resp;
blob_length INTEGER;
chunk_size BINARY_INTEGER := 32767;
blob_position INTEGER := 1;
out_file UTL_FILE.FILE_TYPE;
name VARCHAR2(256);
value VARCHAR2(1024);
v_buffer RAW(32767);
begin
soap_request := '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Validate_Mandate xmlns="http://tempuri.org/Clearing_Workflow/Service1">
<Bra_code>205</Bra_code>
<Cus_num>134988</Cus_num>
<Cur_code>0</Cur_code>
<Led_code>0</Led_code>
<sub_acct_Code>0</sub_acct_Code>
</Validate_Mandate>
</soap:Body>
</soap:Envelope>';
--DBMS_LOB.CREATETEMPORARY(buff,true);
http_req := utl_http.begin_request('http://10.99.0.13/clearinginwards/InwardCheques.asmx',
'POST',
'HTTP/1.1');
utl_http.set_header(http_req, 'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
utl_http.set_header(http_req, 'Content-Length', length(soap_request));
utl_http.set_header(http_req,
'SOAPAction',
'http://tempuri.org/Clearing_Workflow/Service1/Validate_Mandate'); -- required to specify this is a SOAP communication
utl_http.write_text(http_req, soap_request);
http_resp := utl_http.get_response(http_req);
dbms_output.put_line('HTTP response status code: ' || http_resp.status_code);
dbms_output.put_line('HTTP response reason phrase: ' || http_resp.reason_phrase);
UTL_HTTP.read_raw(http_resp, buff, 32767);
end;
The response gotten from the web service is as below :
open=F, temp=T, length=13256, chunksize=8132, data=3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C736F61703A456E76656C6F706520786D6C6E733A736F61703D22687474703A2F2F736368656D61732E786D6C736F61702E6F72672F736F61702F656E76656C6F70652F2220786D6C6E733A7873693D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D612D696E7374616E63652220786D6C6E733A7873643D22687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61223E3C736F61703A426F64793E3C56616C69646174655F4D616E64617465526573706F6E736520786D6C6E733D2268747470
I do not understand what this output actually means as what the webservice returns is meant tio be a XML with a signature tag that contain an image of customers signature.
Please I need help.

Thanks for the responses thus far , but I think i need to properly define my problem so will be able to help me better.
I have a webservice with the definition below :
POST /NigMailService/nigmailservice.asmx HTTP/1.1
Host: 10.2.15.157
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetImageDataTable_HT"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetImageDataTable_HT xmlns="http://tempuri.org/">
<BranchCode>int</BranchCode>
<CustomerNumber>int</CustomerNumber>
<CurrencyCode>int</CurrencyCode>
<LedgerCode>int</LedgerCode>
<SubAccountCode>int</SubAccountCode>
<ChequeNumber>int</ChequeNumber>
<ClientCode>string</ClientCode>
<wantedImageTypes>int</wantedImageTypes>
<wantedImageSize_InPercent>int</wantedImageSize_InPercent>
</GetImageDataTable_HT>
</soap:Body>
</soap:Envelope>
and sample response :
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetImageDataTable_HTResponse xmlns="http://tempuri.org/">
<GetImageDataTable_HTResult>xmlxml</GetImageDataTable_HTResult>
</GetImageDataTable_HTResponse>
</soap:Body>
</soap:Envelope>
My aim is to write a PL/SQL that will call the webservice and recieve the response which is definately a XML with an image that is meant to be written to a file in PL/SQL.
Please how can i achieve this ?

Similar Messages

  • Return NULL when invoke Web Service via UTL_DBWS

    Hi all,
    right now, i'm using UTL_DBWS to acces Web Service via database.. but when i'm trying to get data from WEB SERVICE, using utl_dbws.invoke , i got NULL value.
    It happened if The result more than Varchar2 / 32767 byte.
    i'have tried to change code by :
    result := sys.utl_dbws.invoke(l_call, l_input_params);
    P_clob := sys.anydata.accessCLOB(result);
    The Output IS NULL value even if the data was less than Varchar2 or 32767 byte..
    this is my script looks like ::
    declare
    service sys.utl_dbws.SERVICE;
    l_call sys.utl_dbws.CALL;
    result ANYDATA;
    wsdl_url VARCHAR2(1024);
    service_name VARCHAR2(200);
    operation_name VARCHAR2(200);
    input_params sys.utl_dbws.ANYDATA_LIST;
    p_out VARCHAR2(32767);
    p_xml XMLTYPE;
    p_clob CLOB;
    begin
    wsdl_url := 'http://127.0.0.1/Exercise/WSDL2.php?wsdl';
    service_name :='{urn:hellowsdl}hellwsdl';
    operation_name := 'getData';
    service := sys.UTL_DBWS.create_service (
    wsdl_document_location => URIFACTORY.getURI(wsdl_url),
    service_name => service_name);
    l_call := sys.utl_dbws.create_call(
    service_handle => service,
    port_name => null,
    operation_name => operation_name
    input_params(1) := ANYDATA.ConvertVarchar2('DOCCODE');
    result := sys.utl_dbws.invoke(l_call, l_input_params);
    p_out := sys.anydata.accessVarchar2(result);
    sys.UTL_DBWS.release_call (call_handle => l_call);
    sys.UTL_DBWS.release_service (service_handle => service);
    end;
    Thanx for Any Help

    The basics are simple:
    - format a valid SOAP envelope
    - use UTL_HTTP to make the call
    - process the response (typically XML output)
    Sample source code in {message:id=4205205}.

  • Wrong data when consuming web service via ABAP

    Dear all,
    we tried to consume a web service via ABAP and used one of the various existing how-to papers from the internet in order to develop everything.
    The development was not that difficult, but when we now execute our ABAP, we noticed that
    - the first 100 returned rows from the webservice are completely correct
    - then we receive 10-15 completely incorrect rows (empty fields, redundant lines, etc.)
    - the rest of the data (60 records) is correct again
    As we nearly all objects have been generated automatically via SE80, I do not really know where this problem might come from. We double checked the original data and there everything is correct.
    Any ideas?
    Thanks for your feedback,
    Andreas

    Marcelo  Almeida wrote:
    > You can use Logial port for it in LPCONFIG ( Transaction). See this examplo Below:
    >
    > TRY.
    >
    > CREATE OBJECT my_proxy
    > EXPORTING
    > logical_port_name = 'LP01'.
    > CATCH cx_ai_system_fault.
    > ENDTRY.
    >
    > TRY.
    > input-airline_id = p_carrid.
    > input-connection_id = p_connid.
    > input-flight_date = p_fldate.
    >
    > CALL METHOD my_proxy->flight_get_detail
    > EXPORTING
    > input = input
    > IMPORTING
    > output = output.
    > CATCH cx_ai_system_fault.
    > CATCH cx_ai_application_fault.
    > ENTRY.
    >
    > Its necessary create a connection in SM59 (type H) and setting in the call parameters logical port (LPCONFIG).
    Hi,
    thanks for your answer. It´s working!
    Cheers,
    Andy

  • Oracle SQL - Extracting clob value from XML with repeating nodes

    Hi All,
    I am attempting to run SQL on a table (called test_xml with a column xml_data [data type xmltype]). The column contains xml with repeating nodes (description). The following statement runs successfully when the node contains data of a non clob size:
    SELECT
    extractvalue (Value (wl), '*/description')
    FROM test_xml
    , TABLE (xmlsequence (extract (xml_data, '*/record'))) wl
    but fails when description node contains a lot of data:
    ORA-01706: user function result value was too large
    I amended my query:
    SELECT
    extractvalue(Value (wl), '*/description').getClobVal()
    FROM test_xml
    , TABLE (xmlsequence (extract (xml_data, '*/record'))) wl
    but this fails with:
    ORA-22806: not an object or REF
    Thanks in Advance

    Hi Greg,
    11.2.0.2.0 (Although I will need to do this on my work instance also which is 10.2.0.4)That's gonna be a problem...
    Direct CLOB projection is supported starting with 11.2.0.2, using XMLTable or XMLCast/XQuery functions (extractvalue, extract, xmlsequence are deprecated now) :
    SELECT x.*
    FROM test_xml t
       , XMLTable(
           '/*/record'
           passing t.xml_data
           columns
             description  clob path 'description'
         ) x
    ;On prior versions, implicit conversions will occur to VARCHAR2 datatype, hence the limitation observed.
    AFAIK you have two options on 10.2.0.4 :
    1) Using Object-Relational storage, with the xdb:SQLType="CLOB" annotation.
    2) Using the following trick :
    SELECT dbms_xmlgen.convert(x.description.getClobVal(), 1) as description
    FROM test_xml t
       , XMLTable(
           '/*/record'
           passing t.xml_data
           columns
             description  xmltype path 'description/text()'
         ) x
    ;

  • Populate table with XML returned by a Web Service

    Hi,
    I have a web service that executes MulitipleRowQuiery and returns XML
    variable.
    When I set the data connection (in Designer) to this service in my
    PDF form I'm getting "document" and "element" nodes under the
    invokeResponce tree (data view palette).
    How can I use this parameters in order to traverse the XML that was
    returned by the WS?
    What I need is to populate a table with this XML data..
    Thanks, Rbuz.

    You can use the XDP as is ...it is just this forum that will not accept XDP format. I have already made th erequest to get it changed and we are waiting for the next software update.
    There are two sets of bindings for every object on a form. DataBindings allow you to import XML and bind the nodes to the fields and Execute bindings which are used with Web Services. I used your sample XML file as an input for data bindings and got it to work the way you want by using [*] in the binding instructions to indicate that more than one node was present there. This is not possible in the Execute bindings. You can only have a one to one relationship. So I do not think you can do it the way you want.
    Can you get the WS to return you the entire XML as a single parameter? If so then you could bind that parm to a hidden field, then load all of the XML into the DataDom and use Data Bindings that do support what you are trying to do. I have included a sample that shows the table being filled the way you want using data binding.
    You shoudl contact support and get an enhancement logged to get the WS bindings to act the same way.
    Hope that helps
    Paul

  • Problem with special characters when calling web services via ISG

    Hi all,
    I have a problem when trying to send or retrieve strings containing some special characters via Integrated SOA Gateway.
    For example, when I call a PL/SQL function via ISG that returns a string containing curling single and double quote characters, these are not represented by valid XML character entity references. So when trying to open the response XML (returned by ISG) in a browser, I get a parser error...
    Has anybody had a similar experience with ISG? How can I resolve that - is it an ISG bug?
    Thanks
    Carolin

    XML Parsing Error: not well-formed
    Location: file:///C:/Users/sanders/Desktop/Text3.xml
    Line Number 4734, Column 54: <DESCRIPTION>Overhead Track Lighting 4?</DESCRIPTION>Do you get the same error if you change the description from "Overhead Track Lighting 4?" to "Overhead Track Lighting 4"?
    Do you have any invalid characters?
    BI Publisher Reports End With Error When There Is An Ampersand Character ( & ) On The Xml Data File [ID 1081175.1]
    Journal Entries Report Doesn'T Yield Output: Java Heap Error [ID 1115663.1]
    Thanks,
    Hussein

  • How can I extract tag value of XML

    I have the xml above and a need to extract value of any tag.
    I think with regular expression I could get the desire result.
    And I could work eoth XMLTYPE with I can identify if if LEAF TAG or not( and then use EXTRACT or EXTRACTVALUE functions correctly )
    declare
       v_xml varchar2(1000); --> with xmltype I can extrac the label of tag with SQL function EXTRACT
    begin
       v_xml:= '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://iface.cliente.cssoftware.sicredi.com.br/">'||
                   '<env:Body>'||
                      '<ns0:consultaCanalAplicacaoResponse>'||
                         '<ns0:return>'||
                            '<ns0:item>'||
                               '<ns0:codigoReferencial>URA</ns0:codigoReferencial>'||
                               '<ns0:codigoLegado xsi:nil="1"/>'||
                               '<ns0:id>13</ns0:id>'||
                               '<ns0:codigoSIC>URA</ns0:codigoSIC>'||
                            '</ns0:item>'||
                         '</ns0:return>'||
                      '</ns0:consultaCanalAplicacaoResponse>'||
                   '</env:Body>'||
                '</env:Envelope>';
    end;
    /*With tag name is 'ns0:id' the desire result is:  '13' *With tag name is 'ns0:item' the desire result is:
    <ns0:codigoReferencial>URA</ns0:codigoReferencial>
    <ns0:codigoLegado xsi:nil="1"/><ns0:id>13</ns0:id>
    <ns0:codigoSIC>URA</ns0:codigoSIC>*With tag name is 'env:Envelope' the desire result is:
    <env:Body>
       <ns0:consultaCanalAplicacaoResponse>
          <ns0:return>
             <ns0:item>
                <ns0:codigoReferencial>URA</ns0:codigoReferencial>
                <ns0:codigoLegado xsi:nil="1"/>
                <ns0:id>13</ns0:id>
                <ns0:codigoSIC>URA</ns0:codigoSIC>
             </ns0:item>
          </ns0:return>
       </ns0:consultaCanalAplicacaoResponse>
    </env:Body>Edited by: Luciana T. Angeli on Nov 1, 2010 3:46 PM
    Edited by: Luciana T. Angeli on Nov 1, 2010 3:48 PM
    Edited by: Luciana T. Angeli on Nov 1, 2010 3:49 PM

    SQL> with t
         as (select xmltype (
                      '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://iface.cliente.cssoftware.sicredi.com.br/">'
                      || '<env:Body>'
                      || '<ns0:consultaCanalAplicacaoResponse>'
                      || '<ns0:return>'
                      || '<ns0:item>'
                      || '<ns0:codigoReferencial>URA</ns0:codigoReferencial>'
                      || '<ns0:codigoLegado xsi:nil="1"/>'
                      || '<ns0:id>13</ns0:id>'
                      || '<ns0:codigoSIC>URA</ns0:codigoSIC>'
                      || '</ns0:item>'
                      || '</ns0:return>'
                      || '</ns0:consultaCanalAplicacaoResponse>'
                      || '</env:Body>'
                      || '</env:Envelope>')
                      xml
               from dual)
    select id, xmlserialize(document item indent) item
      from t,
           xmltable (
             xmlnamespaces ('http://iface.cliente.cssoftware.sicredi.com.br/' as "ns0",
                            'http://schemas.xmlsoap.org/soap/envelope/' as "env"
             'env:Envelope/env:Body/ns0:consultaCanalAplicacaoResponse/ns0:return'
             passing xml
             columns id number path 'ns0:item/ns0:id',
                     item xmltype path 'ns0:item')
         ID ITEM                                                                                     
         13 <ns0:item xmlns:ns0="http://iface.cliente.cssoftware.sicredi.com.br/">                   
              <ns0:codigoReferencial>URA</ns0:codigoReferencial>                                     
              <ns0:codigoLegado xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1"/>  
              <ns0:id>13</ns0:id>                                                                    
              <ns0:codigoSIC>URA</ns0:codigoSIC>                                                     
            </ns0:item>                                                                              
    1 row selected.hth.

  • 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 ");

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • How to get the values from xml file to java combo box

    Hi frens,
    I am new to java and xml programming,
    Now, i want to have a code of getting the tag values from the xml file
    into the swing combo box of java front end.
    How can we do that?
    any help of code or tutorial or an ebook is a great help for me.
    Thank you,
    Karthik.
    Edited by: Karthik84 on Aug 27, 2008 1:49 AM
    Edited by: Karthik84 on Aug 27, 2008 11:29 PM

    look at this link
    http://www.stylusstudio.com/docs/v2006/d_help30.html
    I read sometime back that castor has a tool to do
    conversion. You might have a look into casto as well.

  • What does {tag_image_value} from webapps return when field is empty? How to use javascript to remove div when condition is met.

    Dear all,
    As stated in the question, what does {tag_image_value} from webapps return when no image has been uploaded by users. I understand that there is an OnError function that can be called if there isn't any image. However it does not do so.
    I am creating a program which will check to see if {tag_image_value} contains an image. If it does not, the error will call an external javascript to remove the div such that it removes any subsequent codes in the later parts of the codes. Below is part of the program:
    I have tried to compare the value to NULL, 0, -1 and "" using if-else functions but they do not work. The slideshow wrapper is part of the code from the following theme: 2027 E Colfax Ave Denver
    The theme will cycle through the pictures, my purpose is to remove the pictures if the images are not present.
       <!------------------------------------------------ Remove picture if not uploaded ------------------------------------------------>
    <script language="JavaScript">
    function noimg1() {
         $( "#shownpicture1" ).remove();
         return;
    function noimg2() {
         $( "#shownpicture2" ).remove();
         return;
    function noimg3() {
         $( "#shownpicture3" ).remove();
         return;
    function noimg4() {
         $( "#shownpicture4" ).remove();
         return;
    </script>
            <!------------------------------------------------ End of remove picture if not uploaded ------------------------------------------------>
    <div class="slideshow-wrapper slider">
    <div class="preloader"></div>
    <ul data-orbit="data-orbit" data-options="bullets:false;animation:fade;">
        <div style="display: block;" id="shownpicture1">
        <li class="active" style="z-index: 4; margin-left: 0%; opacity: 1;"><img alt="{tag_name_nolink}" onerror="noimg1()" src="{tag_image 1_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture2">
        <li style="z-index: 2; margin-left: 100%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg2()" src="{tag_image 2_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture3">
        <li style="z-index: 2; margin-left: 0%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg3()" src="{tag_image 3_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture4">
        <li style="z-index: 2; margin-left: 0%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg4()" src="{tag_image 4_value}" /></li>
        </div>
    </ul>
    </div>
    <!-- //.slideshow-wrapper -->

    When I put in the code it doesnt work. I went into the page to check and it seems that the preloader changes some elements of the code :
    <div class="slideshow-wrapper slider">
        <div class="preloader"></div>
        <div class="orbit-container">
            <ul class="orbit-slides-container" data-orbit="data-orbit" data-options="bullets:false;animation:fade;" style="height: 26px;">
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg1()" src="">
                    </img>
                </li>
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg2()" src=""></img>
                </li>
                <li class="active" style="z-index: 4; margin-left: 0%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg3()" src=""></img>
                </li>
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;"></li>
            </ul>
            <a class="orbit-prev">
                <span></span>
            </a>
            <a class="orbit-next">
                <span></span>
            </a>
            <div class="orbit-timer paused">
                <span></span>
                <div class="orbit-progress" style="width: 0%;"></div>
            </div>
            <div class="orbit-slide-number">
                <span></span>
                 of
                <span></span>
            </div>
        </div>
    </div>
    I tried putting this into the top of my template layout before the code starts:
    <script>
    $('.slideshow-wrapper slider .orbit-container ul li img').each(function(){
    if( $(this).attr('src') == "" ){
    $(this).parent.remove();
    $('.slideshow-wrapper slider ul li img').each(function(){ 
      if( $(this).attr('src') === '' ){ 
      $(this).parent.remove(); 
    $('.slideshow-wrapper slider ul li img').each(function(){ 
      if( $(this).attr('src') == '' ){ 
      $(this).parent.remove(); 
    </script>
    All 3 variants cannot work. Is there something wrong with the way I do the scripting?

  • 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

  • Want to retrieve null value from xml?

    i m writing this code to get the tag name and values from xml file.
    Now the problem is that
    if my xml file contain any tag whose value is not defined like
    <root>
    <firsttag>first</firsttag>
    <Second></Second><Third>third</Third>
    </root>
    Now look if second tag doesnt contain anything ,then i want to add "null" to vector,but it throws null pointer exception because second tag is empty.
    Vector<String> CSWFinfo = new Vector<String>();
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory
                             .newInstance();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   Document doc = builder.parse(new File(xml));
                   Element root = doc.getDocumentElement();
                   NodeList node = root.getChildNodes();
                   for (int i = 0; i < node.getLength(); i++) {
                        Node currentNode = node.item(i);
                        if (isTextNode(currentNode))
                             continue;
                        CSWFinfo.addElement(currentNode.getNodeName());
                        if (null != currentNode.getFirstChild().getNodeValue()) {
                             CSWFinfo.addElement(currentNode.getFirstChild()
                                       .getNodeValue());
                        } else {
                             CSWFinfo.addElement("null");
                   }//end of for loop block
                   System.out.println(CSWFinfo);
              } catch (Exception e) {
                   e.printStackTrace();
                   // TODO: handle exception
              }I am using dom parser .
    Can any one know how to do it????
    Edited by: chauhan2003 on 16 Jun, 2008 12:06 PM

    Are you sure that all currentNode have a firstChild ????
    If your node has no value, it has no child
    So i 'd change code to like look something like:
    if (currentNode.getFirstChild() != null) {
         CSWFinfo.addElement(currentNode.getFirstChild().getNodeValue());
    } else {
         CSWFinfo.addElement("null");
    }

  • Read bool value from xml

    Hi all :
    I try to read Boolean value from xml file , please see attach file , all the time this error rise
    I know that The XML tag describing the type of data does not match, how can I get Boolean value " 1" or "0 "
    Thanks
    wisam
    Attachments:
    untitled1.JPG ‏115 KB

    You are not trying to read boolean.. you are trying to read a DBL.
    To read a DBL you must first write a DBL to XML.
    To read a boolean replace the DBL with a boolean

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

Maybe you are looking for

  • Windows laptop isnt recognizing my 4th generation ipod shuffle, does anyone know how to fix this

    My windows 8 Asus laptop will not recognize my 4th gen ipod shuffle, either in device manager or in itunes just to be clear, apple support just tells me its my usb cable and not something that is wrong with the ipod, anyone else have this issue or at

  • Snow Leopard & HP LaserJet 5M

    Ever since I upgraded to 10.6, my HP LaserJET 5M has been inoperative due to the lack of Apple Talk support in Snow Leopard. I was using Apple Talk over Ethernet(?) and I cannot see or find any IP Address from my Name Server information using NetStat

  • Finder Slow, windows jumpy or jagged when dragging?

    I just updated to Mac OS 10.7.5 Lion and the finder seems to be slow, when I drag windows there skipping, NOW I do have a 2 monitor setup and when I drag the window to it, its just fine, even when I scroll with a mouse wheel its skippy, I play Minecr

  • Presentation of columns in a workbook or in a query view

    Hi With BW3, it was easy to change .the size of a column in a query view and then to freeze it . I can't find the way to do that in BI 7 Can somebody help me with that? Thanks Claude

  • Subsequent debit Vs FI invoice

    Hi, I have posted an MM invoice against vendor PO. But now venddors sends me  an invoice for some additional charges he incurred . What is the impact if I post an FI invoice directly through FB60  for additional charges instead of Subsequnet Debit? W