3 Replies Latest reply: Oct 14, 2011 7:09 AM by odie_63 RSS

    Filter XML Query

    642822
      Hi,

      I am new to xml queries and I am facing difficulties in parsing some XML data from the following XML data:

      <ExtendedData>
      <Parameter name="cust_contact_citizenship"><StringValue>Albania</StringValue></Parameter>
      <Parameter name="poa_address1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_address2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_address3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_address4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="branch_minit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_phone1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_phone2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="cust_name_pre " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="cust_gender"><StringValue>M</StringValue></Parameter>
      <Parameter name="lc_middle_name" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="lc_id_doc_date" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="bill_identification_type"><StringValue>I</StringValue></Parameter>
      <Parameter name="poa_contact_job_title" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="poa_industry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="regcomp_Id_doc_date" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <Parameter name="*bill_personal_id*"><StringValue>I71123010D</StringValue></Parameter>
      <Parameter name="bill_id_doc_number"><StringValue>030117664</StringValue></Parameter>
      </ExtendedData>


      I want to filter XML data on base of the 'Parameter name' for example bill_personal_id in previous data.

      Can you help me on this?

      Thnx

      Drini
        • 1. Re: Filter XML Query
          odie_63
          Hi,

          We're lacking some information about your environment.

          - Are you working in the database? (which version? Is the XML in a table? Which datatype?)
          - Are you working with Java or another language?

          - Do you want to extract the value you mentioned, or retrieve the whole document if it contains a specific parameter value?
          • 2. Re: Filter XML Query
            642822
            Yes I am working with XMLType in the database.

            Is there anyway of extracting with extract or extractValue function.
            • 3. Re: Filter XML Query
              odie_63
              select extractvalue(
                       your_column
                     , '/ExtendedData/Parameter[@name="bill_personal_id"]/StringValue'
                     )
              from your_table
              ;