Unable to extract XML element value

Hello,
I am trying to extract the value of the element, but getting an error which is mentioned below..
1) Here's the XML:
<?xml version="1.0" encoding="UTF-8" standalone=''yes''?>
<ns1:XLS version="1.0" ns1:lang="en" rel="4.6.1.sp01" xmlns:ns1="http://www.opengis.net/xls">
<ns1:ResponseHeader sessionID="888"/>
<ns1:Response requestID="888" numberOfResponses="1" version="1.0">
<ns1:DDSXMLResponse queryToken="S2LN">
<ns1:Status>
<ns1:Token keyword="EXTIME" value="1"/>
<ns1:Token keyword="S" value="OK"/>
<ns1:Token keyword="N" value="1"/>
</ns1:Status>
<ns1:OutputGroups>
<ns1:OutputGroup>
<ns1:Token1 keyword="LL" value="40.195166,-119.512163"/>
<ns1:Token2 keyword="SN" value=""/>
<ns1:Token3 keyword="PC" value="89405"/>
<ns1:Token4 keyword="COUNTRY" value="USA"/>
<ns1:Token5 keyword="STATE" value="NV"/>
<ns1:Token6 keyword="CITY" value=""/>
</ns1:OutputGroup>
</ns1:OutputGroups>
</ns1:DDSXMLResponse>
</ns1:Response>
</ns1:XLS>
2) here's my query:
SELECT b.street_number
FROM (SELECT XMLTYPE ('<?xml version="1.0" encoding="UTF-8" standalone=''yes''?>
<ns1:XLS version="1.0" ns1:lang="en" rel="4.6.1.sp01" xmlns:ns1="http://www.opengis.net/xls">
<ns1:ResponseHeader sessionID="888"/>
<ns1:Response requestID="888" numberOfResponses="1" version="1.0">
<ns1:DDSXMLResponse queryToken="S2LN">
<ns1:Status>
<ns1:Token keyword="EXTIME" value="1"/>
<ns1:Token keyword="S" value="OK"/>
<ns1:Token keyword="N" value="1"/>
</ns1:Status>
<ns1:OutputGroups>
<ns1:OutputGroup>
<ns1:Token1 keyword="LL" value="40.195166,-119.512163"/>
<ns1:Token2 keyword="SN" value=""/>
<ns1:Token3 keyword="PC" value="89405"/>
<ns1:Token4 keyword="COUNTRY" value="USA"/>
<ns1:Token5 keyword="STATE" value="NV"/>
<ns1:Token6 keyword="CITY" value=""/>
</ns1:OutputGroup>
</ns1:OutputGroups>
</ns1:DDSXMLResponse>
</ns1:Response>
</ns1:XLS>
') AS revcode_xml
FROM DUAL) A,
XMLTABLE (
XMLNAMESPACES (DEFAULT 'http://www.opengis.net/xls'), '/XLS'
PASSING A.revcode_xml
COLUMNS street_number VARCHAR2(200) PATH 'Response/DDSXMLResponse/OutputGroups/OutputGroup/Token/[@keyword="State"]') b
I am getting this error:
ORA-19112: error raised during evaluation: XVM-01003: [XPST0003] Syntax error at '['1 declare default element namespace
What am I doing wrong? This is my first time working with XML, so maybe it's something basic which I am missing. So any help would be appreciated!!

Hi,
What am I doing wrong?The PATH expression is not a valid XPath expression, probably a typo?
Response/DDSXMLResponse/OutputGroups/OutputGroup/Token/[@keyword="State"]
                                                      ^
                                                      no slash hereshould be :
Response/DDSXMLResponse/OutputGroups/OutputGroup/Token[@keyword="State"]Anyway, considering your input XML, this path points to nothing. There's no "Token" element child under OutputGroup.
Maybe you meant something like this :
SQL> SELECT b.street_number
  2  FROM (SELECT XMLTYPE ('<?xml version="1.0" encoding="UTF-8" standalone=''yes''?>
  3  <ns1:XLS version="1.0" ns1:lang="en" rel="4.6.1.sp01" xmlns:ns1="http://www.opengis.net/xls">
  4  <ns1:ResponseHeader sessionID="888"/>
  5  <ns1:Response requestID="888" numberOfResponses="1" version="1.0">
  6  <ns1:DDSXMLResponse queryToken="S2LN">
  7  <ns1:Status>
  8  <ns1:Token keyword="EXTIME" value="1"/>
  9  <ns1:Token keyword="S" value="OK"/>
10  <ns1:Token keyword="N" value="1"/>
11  </ns1:Status>
12  <ns1:OutputGroups>
13  <ns1:OutputGroup>
14  <ns1:Token1 keyword="LL" value="40.195166,-119.512163"/>
15  <ns1:Token2 keyword="SN" value=""/>
16  <ns1:Token3 keyword="PC" value="89405"/>
17  <ns1:Token4 keyword="COUNTRY" value="USA"/>
18  <ns1:Token5 keyword="STATE" value="NV"/>
19  <ns1:Token6 keyword="CITY" value=""/>
20  </ns1:OutputGroup>
21  </ns1:OutputGroups>
22  </ns1:DDSXMLResponse>
23  </ns1:Response>
24  </ns1:XLS>
25  ') AS revcode_xml
26  FROM DUAL) A,
27    XMLTABLE (
28      XMLNAMESPACES (DEFAULT 'http://www.opengis.net/xls')
29    , '/XLS/Response/DDSXMLResponse/OutputGroups/OutputGroup'
30      PASSING A.revcode_xml
31      COLUMNS
32        street_number VARCHAR2(200) PATH '*[@keyword="STATE"]/@value'
33    ) b
34  ;
STREET_NUMBER
NV

Similar Messages

  • Exception in assigning XML elements value in Workshop

    Hi ,
    I tried creating a variable of type XML object(OrderREsponse). I have one MB Publisher control which sends in a variable of type OrderResponse. Before sending it , I try setting the individual XML elements value in it. So, for all the individual elemtns , I set accordinglly in both the formats.
    responseXML.addNewOrderResponse().setOrderNumber("N12121212");
    responseXML.getOrderResponse().setOrderNumber("N12121212");
    where responseXML is a variable of type OrderResponse document.
    This place while executing I'm getting an exception.
    Here is the exception I'm getting.
    <Jan 4, 2005 10:51:11 AM MST> <Warning> <WLW> <000000> <Id=top-level; Method=com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration()
    ; Failure=com.bea.wli.bpm.runtime.UnhandledProcessException: Unhandled process exception [ServiceException]>
    <Jan 4, 2005 10:51:12 AM MST> <Warning> <WLW> <000000> <A message was unable to be delivered from a WLW Message Queue. Attempting to deliver
    the onAsyncFailure event>
    Let me know if the approach is the right one... or how can i set the individual XML elements value from a XML variable.
    Thanks
    Ramesh

    Hi ,
    I tried creating a variable of type XML object(OrderREsponse). I have one MB Publisher control which sends in a variable of type OrderResponse. Before sending it , I try setting the individual XML elements value in it. So, for all the individual elemtns , I set accordinglly in both the formats.
    responseXML.addNewOrderResponse().setOrderNumber("N12121212");
    responseXML.getOrderResponse().setOrderNumber("N12121212");
    where responseXML is a variable of type OrderResponse document.
    This place while executing I'm getting an exception.
    Here is the exception I'm getting.
    <Jan 4, 2005 10:51:11 AM MST> <Warning> <WLW> <000000> <Id=top-level; Method=com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration()
    ; Failure=com.bea.wli.bpm.runtime.UnhandledProcessException: Unhandled process exception [ServiceException]>
    <Jan 4, 2005 10:51:12 AM MST> <Warning> <WLW> <000000> <A message was unable to be delivered from a WLW Message Queue. Attempting to deliver
    the onAsyncFailure event>
    Let me know if the approach is the right one... or how can i set the individual XML elements value from a XML variable.
    Thanks
    Ramesh

  • Out XML element values extract

    hi their
    How can I out XML element the values extract and in a loop in variable and/or in an array store?
    Example:
    [loop]
    <SA>'MS','GYM'</SA>
    Values 'MS' and 'GYM' should be in variables e.g var1='MS' and var2='GYM'
    [end loop]
    Please, help me!!!! Urgent
    thanx you for advice
    kind regards
    Holger

    create or replace procedure spTestXML is
      xml   xmltype;
      test  varchar2(100);
      test2 xmltype;
      cursor lvCur_GetAllSecGrps is
        SELECT extractValue(value(asec), '/SEC_GRP/NAME') as Name
        FROM table(xmlsequence(xml)) a,
             table(xmlsequence(extract(value(a), '/EVENT/SEC_GRP_LIST/SEC_GRP'))) asec;
    begin
      xml := xmltype('<EVENT>
    <SWTSUPDATE TYPE="1">
    <MEMBERID>9822598</MEMBERID>
    <DATETIME>Fri Jun 09 14:51:33 CDT 2006</DATETIME>
    <USERID>W951FVK</USERID>
    </SWTSUPDATE>
    <CONTACT_HISTORY>
    <USER>
    <USER_ID>W951FVK</USER_ID>
    <FIRST_NAME>John</FIRST_NAME>
    <LAST_NAME>Givens</LAST_NAME>
    </USER>
    <USER>
    <USER_ID>W951FNN</USER_ID>
    <FIRST_NAME>Mary</FIRST_NAME>
    <LAST_NAME>McNair</LAST_NAME>
    </USER>
    <CONSUMER>
    <CONS_SEQ_NBR>1387445</CONS_SEQ_NBR>
    <FIRST_NAME>SPRINGHOUSE</FIRST_NAME>
    <LAST_NAME>ELLIS</LAST_NAME>
    </CONSUMER>
    </CONTACT_HISTORY>
    <SEC_GRP_LIST>
    <SEC_GRP><NAME>cspupdatecustpayee</NAME><DESCRIPTION>Add/Update/Delete CSP Customer Payees</DESCRIPTION></SEC_GRP>
    <SEC_GRP><NAME>cspupdatepayment</NAME><DESCRIPTION>Add/Update/Delete CSP Payment</DESCRIPTION></SEC_GRP>
    <SEC_GRP><NAME>adminreports</NAME><DESCRIPTION>Administrate Reports</DESCRIPTION></SEC_GRP>
    <SEC_GRP><NAME>billopscsr</NAME><DESCRIPTION>Bill Operations CSR</DESCRIPTION></SEC_GRP>
    </SEC_GRP_LIST>
    </EVENT>');
      if xml.existsNode('/EVENT/SEC_GRP_LIST/SEC_GRP/NAME') != 0 THEN
        for lvAllSecGrps in lvCur_GetAllSecGrps loop
          dbms_output.put_line('Found: '||lvAllSecGrps.Name);
        end loop;
      end if;
    end spTestXML;gives
    Found: cspupdatecustpayee
    Found: cspupdatepayment
    Found: adminreports
    Found: billopscsrhth

  • Preserve whitespace in XML element value

    I am trying to add XML element with value prefix with white space:
      ex_doc->create_simple_element(
          name = 'VALUEPART1'
          value = '          BQ/XWKB-99-5-9999-2'
          parent = lo_ele_e1bpparex_bape_vbak ).
    But when the XML is create, the white space is removed! How can I preserve the white space???
    <VALUEPART1>BQ/XWKB-99-5-9999-2</VALUEPART1>
    What i want is:
    <VALUEPART1>          BQ/XWKB-99-5-9999-2</VALUEPART1>
    Appreciate for any help

    Hi,
    if you had been using XSLT instead, I would have said 'remove the strip-space element or alter it according to your needs'...
    Please provide what class you are using, else it's too generic..
    regards, Lukas

  • How to insert brackets into an XML element value?

    If I have a <file> </file> element in an XML file and I want to insert a filename of the form PED<yyMMdd>232, how do I insert the < and > brackets as an element value inside the <file> tag?
    I use JCreator to edit the xml file and it treats <yyMMdd> as a seperate element instead of being part of the filename.
    Edited by: Weng on Mar 27, 2008 10:06 AM

    You have to escape those characters, like this:
    PED&lt;yyMMdd&gt;232

  • Set xml element value

    Im trying to set the value of an xml element, however, its simply not working. no error is thrown, but its not setting the value either.
    My xml doc contains the following:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <TMMsg_CreateTaskReq>
    <Element1>
    <value>val1</value>
    <value>val2</value>
    </Element1>
    </TMMsg_CreateTaskReq>
    Im trying to update the 1st value node to "new value" but the file is not updated. what am I doing wrong?
    [xml]$fileContents = Get-Content -Path 'C:\test.xml'
    $fileContents.TMMsg_CreateTaskReq.Element1.Value[0] = 'new value'
    $fileContents.Save('C:\test2.xml')

    Hi
    From what I gather,  powershell is probably understanding that you're trying to access a member named 'Value" of Element1 instead of a child node.
    If you look at
    System.Xml.XmlElement, you'll see that 'value' already exists. 
    You can also see it by doing:
    $fileContents.TMMsg_CreateTaskReq.Element1 | get-member
    by doing get-member,  you'll also see that value is read only.  Powershelll simply ignores your attemp to write to a read-only property and moves on.
    I usually use xpath queries when powershell doesn't do exactly what I want:
    ($fileContents.SelectSingleNode("//value[1]"))."#text"="bob"
    That lines select a the first node called value anywhere in the xml document, and then updates the text property to bob.

  • Getting Tag and value from the selected Xml element value

    Hi All,
    I have an xml file which i import to the Indesign CS3 .From the structure view , i drag and drop the root node on to the page. Now i select an xml value from the page. Now i need to get the element tag and value from the selected value.
    For example
    File Name : sample1.xml
    <Root>
    <employeeName> A</employeeName>
    <employeeEmail>[email protected]</employeeEmail>
    </Root>
    Now i import this sample.xml in my indesign CS3 and from the structure view i drag the Root  tag and drop it on the page.Now the values of the element tag are displayed.
    Now i select "[email protected]" from the page and i have a menu "Get Selected XML" on clicking which  i should get element tag with value.(i.e <employeeEmail>[email protected]</employeeEmail>)
    How to go about it.?
    Thanks
    Sakthi

    Hi Steve,
    If you haven't already done so, I recommend posting this question in the LivCycle Forms forum.
    Jared

  • How to extract an element value from a String of HTML

    I have a web service that returns a fragment of HTML that contains a number in a table. The return parameter type is a string. I need to get this number and use it in a BPEL while loop, as the condition for the loop (while the number > 0).
    I have tried using the function bpws:getVariableData() but the BPEL PM faults and says: XPath expression failed to execute. Error while processing xpath expression. I think this is because I am trying to apply an XPath expression over a String variable.
    The return value from my web service looks like this:
    <whileConditionResultSet>
    <part xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" name="response">
    <ns1:string_Response xmlns:ns1="http://systinet.com/xsd/SchemaTypes/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="d:string">
         <p>SQL Query: select count(*) from delta_manages</p>
         <p><table border='1'>
              <tr> <th bgcolor='#C0C0C0'>COUNT(*)</th></tr>
              <tr> <td>28</td></tr>
              </table>
         </p></ns1:string_Response>
    </part>
    </whileConditionResultSet>
    How do I get the value from the HTML table into a BPEL variable?

    the doSqlService() which executes an arbitrary SQL statement, returns a string of HTML like this:
    <doSqlServiceResponse>
    <part xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" name="response">
    <ns1:string_Response xmlns:ns1="http://systinet.com/xsd/SchemaTypes/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="d:string"><p>SQL Query: select count(*) from delta_manages</p> <p><table border='1'> <tr> <th bgcolor='#C0C0C0'>COUNT(*)</th></tr> <tr> <td>14</td></tr> </table></p></ns1:string_Response>
    </part>
    I then copy the result to the whileResultString variable
    <variable name="whileResultString" type="xsd:string"/>
    <copy>
                                       <from variable="doSqlServiceResponse" part="response" query="/ns1:string_Response">
                                       </from>
                                       <to variable="whileResultString"/>
                                  </copy>
    I realise too, a root element will be needed. This is not a mission critical problem as we could change the web service at the other end. It was originally designed for a client to display the results rather than use them within a business process. Anyway, I'm just interested to know if I can create a node from this string data in BPEL.
    Ross.

  • Extract XML attribute value for multi-item sequence

    Guys,
    I have already posted this in the XML DB forum, but am relying that some of you might help me.
    I have been searching for a solution for this and couldn't quite get it. I'm trying to get attribute values from multiple entries in a Node. It workes for a single node, but for multiple nodes, it fails. Could you please give me a solution?
    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  </COUNTRY>
      9  </WORLD>'
    10  ));
    COUNTRY_NAME CITY_NAME POPULATION
    INDIA MUMBAI 10000When I execute the same for multiple nodes, it fails, please guide me. Please also let me know how to handle if I have an XML file containing this data.
    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  <CITY NAME="CHENNAI" POPULATION="2000"></CITY>
      9  <CITY NAME="BANGALORE" POPULATION="13000"></CITY>
    10  <CITY NAME="HYDERABAD" POPULATION="14000"></CITY>
    11  </COUNTRY>
    12  </WORLD>'
    13  ));
    select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
    ERROR at line 1:
    ORA-19025: EXTRACTVALUE returns value of only one nodeCheers
    Sarma.

    So, this is the first step:
    SQL> with test as
      2  (select xmltype('<WORLD>
      3                 <COUNTRY NAME="INDIA">
      4                 <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      5                 <CITY NAME="CHENNAI" POPULATION="2000"></CITY>
      6                 <CITY NAME="BANGALORE" POPULATION="13000"></CITY>
      7                 <CITY NAME="HYDERABAD" POPULATION="14000"></CITY>
      8                 </COUNTRY>
      9  </WORLD>') resp from dual)
    10  select country
    11       , cities
    12  from xmltable('WORLD/COUNTRY' passing (select resp from test)
    13                         columns country varchar2(50) path '/COUNTRY/@NAME'
    14                               , cities xmltype path '/COUNTRY/CITY') world
    15  /
    COUNTRY         CITIES
    INDIA           <CITY NAME="MUMBAI" POPULATION="10000"/><CITY NAME
                    ="CHENNAI" POPULATION="2000"/><CITY NAME="BANGALOR
                    E" POPULATION="13000"/><CITY NAME="HYDERABAD" POPU
                    LATION="14000"/>two columns, one varchar2 and one xmltype.
    Then do the same thing with the second column, pass the XML to an XMLTABLE function
    SQL> with test as
      2  (select xmltype('<WORLD>
      3                 <COUNTRY NAME="INDIA">
      4                 <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      5                 <CITY NAME="CHENNAI" POPULATION="2000"></CITY>
      6                 <CITY NAME="BANGALORE" POPULATION="13000"></CITY>
      7                 <CITY NAME="HYDERABAD" POPULATION="14000"></CITY>
      8                 </COUNTRY>
      9  </WORLD>') resp from dual)
    10  select country
    11       , cit.name
    12       , cit.population
    13  from xmltable('WORLD/COUNTRY' passing (select resp from test)
    14                         columns country varchar2(50) path '/COUNTRY/@NAME'
    15                               , cities xmltype path '/COUNTRY/CITY') world
    16     , xmltable ('CITY' passing cities
    17                columns name varchar2(50) path '@NAME'
    18                      , population number path '@POPULATION'
    19                ) cit
    20  ;
    COUNTRY         NAME                                               POPULATION
    INDIA           MUMBAI                                                  10000
    INDIA           CHENNAI                                                  2000
    INDIA           BANGALORE                                               13000
    INDIA           HYDERABAD                                               14000

  • How to extract xml having namespaces

    Hi all,
    Below is the XML i have :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
    - <Request>
    <Memid>10</Memid>
    <Actid>32</Actid>
    <Pax>3</Pax>
    <Flt>2012-DEC-10</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    <Request>
    <Memid>1</Memid>
    <Actid>3</Actid>
    <Pax>2</Pax>
    <Flt>2012-DEC-12</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    </Transaction>
    I want to extract the element values :
    The below code will help me when i have no namespace , what must be done in order to work with namespace and etract element value
    v_string_xml :=
    ' //Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
    v_ssp_table (v_ssp_table.COUNT).memid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Actid/text()';
    v_ssp_table (v_ssp_table.COUNT).actid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Pax/text()';
    v_ssp_table (v_ssp_table.COUNT).pax :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Flt/text()';
    v_ssp_table (v_ssp_table.COUNT).flt :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Username/text()';
    v_ssp_table (v_ssp_table.COUNT).username :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();
    Edited by: akm006 on Mar 19, 2013 11:11 AM

    odie_63 wrote:
    AlexAnd wrote:
    28  v_string_xml_ns :='xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012"';
    You can remove the xsi prefix, no need to make it more verbose than it already is ;)misunderstood
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as scott
    SQL>
    begin
    v_string_xml := 'Transaction/Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
    --v_string_xml_ns :='xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012"';
    v_string_xml_ns :='xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012"';
    v_ssp := x.EXTRACT(v_string_xml,v_string_xml_ns).getnumberval();
    dbms_output.put_line(v_ssp);
    end;
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 33
    SQL>
    24  begin
    25 
    26  v_string_xml := 'Transaction/Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
    27 
    28  --v_string_xml_ns :='xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012"';
    29  v_string_xml_ns :='xmlns="http://schemas.test.com/Support/Services/test1/2012"';
    30 
    31 
    32  v_ssp := x.EXTRACT(v_string_xml,v_string_xml_ns).getnumberval();
    33 
    34  dbms_output.put_line(v_ssp);
    35 
    36  end;
    37  /
    1
    PL/SQL procedure successfully completed
    SQL> so for no xsi namespace it's work for above case
    and for "xsi prefix" doesnt' work
    or i missed anything?
    2 akm006
    So do you have any suggestion on the same.i can't test

  • How to extract  XML with namespace?

    Hi all,
    Below is the XML i have :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
    - <Request>
    <Memid>10</Memid>
    <Actid>32</Actid>
    <Pax>3</Pax>
    <Flt>2012-DEC-10</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    <Request>
    <Memid>1</Memid>
    <Actid>3</Actid>
    <Pax>2</Pax>
    <Flt>2012-DEC-12</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    </Transaction>
    I want to extract the element values :
    The below code will help me when i have no namespace , what must be done in order to work with namespace and etract element value
    v_string_xml :=
    ' //Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
    v_ssp_table (v_ssp_table.COUNT).memid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Actid/text()';
    v_ssp_table (v_ssp_table.COUNT).actid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Pax/text()';
    v_ssp_table (v_ssp_table.COUNT).pax :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Flt/text()';
    v_ssp_table (v_ssp_table.COUNT).flt :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Username/text()';
    v_ssp_table (v_ssp_table.COUNT).username :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();

    declare
      v_xml xmltype := xmltype( '<?xml version="1.0" encoding="UTF-8" ?>
    <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
    <Request>
    <Memid>10</Memid>
    <Actid>32</Actid>
    <Pax>3</Pax>
    <Flt>2012-DEC-10</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    <Request>
    <Memid>1</Memid>
    <Actid>3</Actid>
    <Pax>2</Pax>
    <Flt>2012-DEC-12</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    </Transaction>' );
    begin
      for r_xml in ( select *
                     from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
                                   , '/Transaction/Request'
                                   passing v_xml
                                     columns memid number path 'Memid'
                                           , actid number path 'Actid'
                                           , pax number path 'Pax'
                                           , flt varchar2(100) path 'Flt'
                                           , username varchar2(100) path 'Username'
      loop
        dbms_output.put_line( r_xml.memid );
        dbms_output.put_line( r_xml.actid );
        dbms_output.put_line( r_xml.pax );
        dbms_output.put_line( r_xml.flt );
        dbms_output.put_line( r_xml.username );
      end loop;
    end;

  • Extract XML

    Hi,
    I have the below XML and need to use this in SQL statement to extract the XML element value.
    Please advise.
    <processResponse xmlns:client="http://xmlns.oracle.com/InternetMobile/AbsManagement/BPELProcessUserLogin" xmlns="http://xmlns.oracle.com/InternetMobile/AbsManagement/BPELProcessUserLogin">
      <client:PERSON_ID>31558</client:PERSON_ID>
      <client:GROUPS_ID>202</client:GROUPS_ID>
      <client:PERSON_LOGIN>Y</client:PERSON_LOGIN>
      <client:PERSON_ROLE>N</client:PERSON_ROLE>
      <client:PERSON_UID>0</client:PERSON_UID>
      <client:PERSON_NAME>Welcome! APPROVER</client:PERSON_NAME>
      <client:ERROR_CODE>S</client:ERROR_CODE>
      <client:ERROR_MSG>Login Successful</client:ERROR_MSG>
    </processResponse>

    WITH xmldata
    AS ( SELECT XMLTYPE('<processResponse xmlns:client="http://xmlns.oracle.com/InternetMobile/AbsManagement/BPELProcessUserLogin"
       xmlns="http://xmlns.oracle.com/InternetMobile/AbsManagement/BPELProcessUserLogin">
      <client:PERSON_ID>31558</client:PERSON_ID>
      <client:GROUPS_ID>202</client:GROUPS_ID>
      <client:PERSON_LOGIN>Y</client:PERSON_LOGIN>
      <client:PERSON_ROLE>N</client:PERSON_ROLE>
      <client:PERSON_UID>0</client:PERSON_UID>
      <client:PERSON_NAME>Welcome! APPROVER</client:PERSON_NAME>
      <client:ERROR_CODE>S</client:ERROR_CODE>
      <client:ERROR_MSG>Login Successful</client:ERROR_MSG>
    </processResponse>'
                      ) as CONTENT
        FROM dual
    SELECT x1.*
      FROM xmldata tl
         , XMLTABLE( XMLNamespaces ('http://xmlns.oracle.com/InternetMobile/AbsManagement/BPELProcessUserLogin' as "client")
                   , '/client:processResponse'
                     PASSING tl.content
                     COLUMNS
                       RNO FOR ORDINALITY
                     --  xmls xmltype path '*'
                     , PERSON_ID    NUMBER(5)    PATH 'client:PERSON_ID'
                     , GROUPS_ID    NUMBER(5)    PATH 'client:GROUPS_ID'
                     , PERSON_LOGIN VARCHAR2(10) PATH 'client:PERSON_LOGIN'
                     , PERSON_ROLE  VARCHAR2(10) PATH 'client:PERSON_ROLE'
                     , PERSON_UID   VARCHAR2(10) PATH 'client:PERSON_UID'
                     , PERSON_NAME  VARCHAR2(10) PATH 'client:PERSON_NAME'
                     , ERROR_CODE   VARCHAR2(10) PATH 'client:ERROR_CODE'
                     , ERROR_MSG    VARCHAR2(20) PATH 'client:ERROR_MSG'
                   ) x1
    RNO  PERSON_ID  GROUPS_ID PERSON_LOGIN PERSON_ROLE PERSON_UID PERSON_NAME ERROR_CODE ERROR_MSG    

    31558   
    202 Y       
    N      
    0     
    Welcome! A  S     
    Login Successful

  • Extracting the Attributes values of an XML Element

    Dear Forum Members
    Please tell me any XML Function which is used to extract the Attribute value of an XML Element.
    Given below
    <BRKCD_STREDSWTINVIN_C Key="6708">
    is an Element With some Key value.
    I want to have that Key value.
    Using Extract and Extractvalue I am not able to get the Attribute value.
    Is there any way..
    Regards
    Madhu K

    Your xml is not really complete ;), but this should get you started:
    michaels>  with t as
    (select xmltype('<BRKCD_STREDSWTINVIN_C Key="6708"></BRKCD_STREDSWTINVIN_C>') xml from dual)
    select d.xml, d.xml.extract('//BRKCD_STREDSWTINVIN_C/@Key') key
      from t d
    XML                                                            KEY    
    <BRKCD_STREDSWTINVIN_C Key="6708"></BRKCD_STREDSWTINVIN_C>     6708   

  • How to extract the element name of an XML Document

    This is how my xml file looks like:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <nsiData>
    - <instance timestamp="2011-05-25 19:01:00">
    <AECI>47.00</AECI>
    <EEI>-553.00</EEI>
    <EES>-91.00</EES>
    <EKPC>-22.00</EKPC>
    <LGEE>-140.00</LGEE>
    <MHEB>-1376.00</MHEB>
    <MISO>-4725.00</MISO>
    <MOWR>55.00</MOWR>
    <ONT>-872.00</ONT>
    <OVEC>-144.00</OVEC>
    <PJM>-1438.00</PJM>
    <SPA>-55.00</SPA>
    <SPC>20.00</SPC>
    <SWPP>69.00</SWPP>
    <TVA>-69.00</TVA>
    <WAUE>-158.00</WAUE>
    </instance>
    - <instance timestamp="2011-05-25 19:02:00">
    <AECI>47.00</AECI>
    <EEI>-555.00</EEI>
    <EES>-91.00</EES>
    <EKPC>-22.00</EKPC>
    <LGEE>-148.00</LGEE>
    <MHEB>-1375.00</MHEB>
    <MISO>-4709.00</MISO>
    <MOWR>55.00</MOWR>
    <ONT>-871.00</ONT>
    <OVEC>-144.00</OVEC>
    <PJM>-1426.00</PJM>
    <SPA>-55.00</SPA>
    <SPC>20.00</SPC>
    <SWPP>82.00</SWPP>
    <TVA>-69.00</TVA>
    <WAUE>-158.00</WAUE>
    </instance>
    </nsiData>
    I want to extract the element name and the element value from this file. I was trying to do it this way:
    SELECT datetime,
    loc.aeci_value,
    loc.eei_value
    FROM temp_xmltype txml,
    XMLTABLE ('/nsiData' PASSING xmldata) misolmp,
    XMLTABLE ('/nsiData/instance' PASSING misolmp.object_value
    COLUMNS
    datetime VARCHAR2(100) PATH '/instance/@timestamp') misodt,
    XMLTABLE ('/nsiData/instance' PASSING misolmp.object_value
    COLUMNS
    aeci_value VARCHAR2(100) PATH '/instance/AECI',
    eei_value VARCHAR2(100) PATH '/instance/EEI') loc
    WHERE txml.feed_id = 127
    But doing it this way does not get me AECI as a column value. Is there any way to get the element name as a column value.
    I am on 11gR2

    The SQL statement you wrote returns 4 rows and there is only two AECI values in there. The corrected version of what you wrote should really be
    SELECT loc.datetime,
           loc.aeci_value,
           loc.eei_value
      FROM temp_xmltype txml,
           XMLTABLE ('/nsiData/instance' PASSING txml.xmldata
                     COLUMNS
                     datetime   VARCHAR2(100) PATH '@timestamp',
                     aeci_value VARCHAR2(100) PATH 'AECI',
                     eei_value  VARCHAR2(100) PATH 'EEI') loc
    WHERE txml.feed_id = 127;If you know the element name and want it returned as a column name, why not just hard code it in the SQL statement, such as
    SELECT loc.datetime,
           'AECI' as AECI,
           loc.aeci_value,
           'EEI' AS EEI,
           loc.eei_value
      FROM temp_xmltype txml,
           XMLTABLE ('/nsiData/instance' PASSING txml.xmldata
                     COLUMNS
                     datetime   VARCHAR2(100) PATH '@timestamp',
                     aeci_value VARCHAR2(100) PATH 'AECI',
                     eei_value  VARCHAR2(100) PATH 'EEI') loc
    WHERE txml.feed_id = 127;I suspect you are really looking for something like {message:id=9535532}
    Note: See the FAQ (under your sign-in name) for how to use the code tag to format code as shown above.

  • Task table XML element extract

    What would be the easiest way (inside or outside IDM) to extract an XML element from the task table?

    I have some records that need some text manipulation so I need to convert strings of text (or xml elements) to new values...

Maybe you are looking for

  • PCI-card and /etc/path_to_inst

    Hello! I have a problem with my PCI-card (this is E1-controller) in SF V120 bash-3.00# uname -a SunOS CAREM2 5.10 Generic_118833-33 sun4u sparc SUNW,UltraAX-i2 When I place card in the PCI slot, information in /etc/path_to_inst is updates: bash-3.00#

  • New Update format method

    Hi all, I want to format my leopard, but my disk came with 10.5.6 is there anyway to have it update to 10.5.8 and yet not creating an account? the reason is I'm selling off my mbp to another user, I want it to be the latest update of all yet maintain

  • Coding in Infoset

    Hi All, I am new to Infosets.I need a lil help.I have learnt that we can code in infosets in the "Extras" section.I have an additional field Compa-Ratio and PIR in infoset. But I need to code a constraint in that.Since this infoset is already being u

  • Cannot add time in Parental Controls

    I have a couple of computers that my kids use. They have mobile accounts with parental controls enabled on them. One is a MacPro 1,1 with 10.7.5, the other is a Mac Mini running 10.9.1. When the kids use up thier time on the 10.7.5 machine and they a

  • Bring .mts (AVCHD) or .mov into FCP?

    I have project files in .mts format and a duplicate set that is in .mov format. 1) which set of files is best to bring into FCP for editing? I'm assuming by bringing in the .mts files, FCP is also applying a conversion to .mov anyway, so I should go