在postgres

时间:2016-06-23 05:45:13

标签: xml postgresql

我有这个xml内容:

<html>
  <head>
    <title>Sanjay Gandhi Nagar RHS Navi Mumbai</title>
    <model>
      <instance>
        <uploaded_form_usq3zf id="Sanjay_Gandhi_Nagar_RHS_Navi_M">
          <formhub>
            <uuid/>
          </formhub>
          <group_jg6ts57>
            <city_name>7149</city_name>
            <select_administrative_ward_nam>09</select_administrative_ward_nam>
            <select_slum>272171490901</select_slum>
            <date_of_rapid_household_survey/>
            <Name_of_surveyor_s_who_collec_001/>
            <house_number/>
          </group_jg6ts57>
          <type_of_house_occupancy/>
          <group_xb9nq26>
            <group_do8xg48>
              <what_is_the_full_name_of_the_f/>
              <mobile_number/>
              <aadhar_card_number/>
            </group_do8xg48>
            <group_io6zh11>
              <type_of_structure_of_the_house/>
              <ownership_status/>
              <no_of_family_fembers/>
              <do_you_have_girl_child_under_a/>
              <if_yes_how_many/>
              <house_area_in_sq_ft/>
              <current_place_of_defecation_t/>
              <where_the_individual_toilet_is/>
              <type_of_water_connection/>
              <facility_of_waste_collection/>
              <interested_in_individual_toile/>
              <if_yes_why/>
              <if_no_why/>
              <type_of_toilet_preference/>
              <have_you_applied_or_individual/>
              <how_many_installments_have_yo/>
            </group_io6zh11>
          </group_xb9nq26>
          <start/>
          <end/>
          <meta>
            <instanceID/>
          </meta>
        </uploaded_form_usq3zf>
      </instance>
      <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/city_name" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/select_administrative_ward_nam" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/select_slum" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/date_of_rapid_household_survey" required="true()" type="date"/>
      <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/Name_of_surveyor_s_who_collec_001" required="true()" type="select1"/>
      <bind constraint=". &lt;= 9999" nodeset="/uploaded_form_usq3zf/group_jg6ts57/house_number" required="true()" type="int"/>
      <bind nodeset="/uploaded_form_usq3zf/type_of_house_occupancy" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/what_is_the_full_name_of_the_f" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' or  /uploaded_form_usq3zf/type_of_house_occupancy  = '03'" required="true()" type="string"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/mobile_number" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="string"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/aadhar_card_number" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="false()" type="string"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_structure_of_the_house" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/ownership_status" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/no_of_family_fembers" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="int"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_how_many" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a  = '01'" required="true()" type="int"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/house_area_in_sq_ft" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="int"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/where_the_individual_toilet_is" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and selected( /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t , '01')" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_water_connection" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/facility_of_waste_collection" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and not(selected( /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t , '01'))" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_why" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '01'" required="true()" type="select"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_no_why" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '02'" required="true()" type="select"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_toilet_preference" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '01'" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
      <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/how_many_installments_have_yo" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual  = '01'" required="true()" type="select1"/>
      <bind preload="timestamp" preloadParams="start" nodeset="/uploaded_form_usq3zf/start" type="dateTime"/>
      <bind preload="timestamp" preloadParams="end" nodeset="/uploaded_form_usq3zf/end" type="dateTime"/>
      <bind calculate="concat('uuid:', uuid())" nodeset="/uploaded_form_usq3zf/meta/instanceID" readonly="true()" type="string"/>
      <bind calculate="'1c0b0cef39054d85bdf2b17bb17e4043'" nodeset="/uploaded_form_usq3zf/formhub/uuid" type="string"/>
    </model>
  </head>
  <body>
    <group appearance="field-list" ref="/uploaded_form_usq3zf/group_jg6ts57">
      <label>Administration Information</label>
      <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/city_name">
        <label>City Name</label>
        <item>
          <label>Navi Mumbai</label>
          <value>7149</value>
        </item>
      </select1>
      <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/select_administrative_ward_nam">
        <label>Select Administrative Ward Name</label>
        <item>
          <label>Digha</label>
          <value>09</value>
        </item>
      </select1>
      <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/select_slum">
        <label>Select Slum</label>
        <item>
          <label>Sanjay Gandhi Nagar</label>
          <value>272171490901</value>
        </item>
      </select1>
      <input ref="/uploaded_form_usq3zf/group_jg6ts57/date_of_rapid_household_survey">
        <label>Date of Rapid Household Survey</label>
      </input>
      <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/Name_of_surveyor_s_who_collec_001">
        <label>Name of surveyor(s) who collected Rapid Household Survey data</label>
        <item>
          <label>Amol</label>
          <value>amol</value>
        </item>
        <item>
          <label>Dhananjay</label>
          <value>dhananjay</value>
        </item>
        <item>
          <label>Reshma</label>
          <value>reshma</value>
        </item>
        <item>
          <label>Shankar</label>
          <value>shankar</value>
        </item>
        <item>
          <label>Sheetal</label>
          <value>sheetal</value>
        </item>
        <item>
          <label>Vaibhav</label>
          <value>vaibhav</value>
        </item>
      </select1>
      <input ref="/uploaded_form_usq3zf/group_jg6ts57/house_number">
        <label>House Number</label>
      </input>
    </group>
    <select1 ref="/uploaded_form_usq3zf/type_of_house_occupancy">
      <label>Type of Structure Occupancy</label>
      <item>
        <label>Occupied</label>
        <value>01</value>
      </item>
      <item>
        <label>Locked house</label>
        <value>02</value>
      </item>
      <item>
        <label>Double house</label>
        <value>03</value>
      </item>
      <item>
        <label>Broken house</label>
        <value>04</value>
      </item>
      <item>
        <label>House under construction</label>
        <value>05</value>
      </item>
      <item>
        <label>Permanent locked</label>
        <value>06</value>
      </item>
      <item>
        <label>Not giving information</label>
        <value>07</value>
      </item>
    </select1>
    <group ref="/uploaded_form_usq3zf/group_xb9nq26">
      <label>Household Information</label>
      <group appearance="field-list" ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48">
        <label>Personal Information</label>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/what_is_the_full_name_of_the_f">
          <label>What is the full name of the family head?</label>
        </input>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/mobile_number">
          <label>Mobile Number</label>
        </input>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/aadhar_card_number">
          <label>Aadhar Card Number</label>
        </input>
      </group>
      <group ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11">
        <label>General Information</label>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_structure_of_the_house">
          <label>Type of structure of the house</label>
          <item>
            <label>Pucca</label>
            <value>01</value>
          </item>
          <item>
            <label>Semi pucca</label>
            <value>02</value>
          </item>
          <item>
            <label>Kutcha</label>
            <value>03</value>
          </item>
        </select1>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/ownership_status">
          <label>Ownership status</label>
          <item>
            <label>Own house</label>
            <value>01</value>
          </item>
          <item>
            <label>Tenants</label>
            <value>02</value>
          </item>
          <item>
            <label>Not giving information</label>
            <value>03</value>
          </item>
        </select1>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/no_of_family_fembers">
          <label>No of Family Members</label>
        </input>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a">
          <label>Do you have girl child under age 18 ?</label>
          <item>
            <label>Yes</label>
            <value>01</value>
          </item>
          <item>
            <label>No</label>
            <value>02</value>
          </item>
        </select1>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_how_many">
          <label>If yes, how many?</label>
        </input>
        <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/house_area_in_sq_ft">
          <label>House Area in Sq. ft</label>
        </input>
        <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t">
          <label>Current place of defecation (toilet)</label>
          <item>
            <label>Individual toilet</label>
            <value>01</value>
          </item>
          <item>
            <label>Community toilet block (CTB)</label>
            <value>02</value>
          </item>
          <item>
            <label>Shared toilet</label>
            <value>03</value>
          </item>
          <item>
            <label>Open space</label>
            <value>04</value>
          </item>
          <item>
            <label>Public toilet (PTB)</label>
            <value>05</value>
          </item>
        </select>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/where_the_individual_toilet_is">
          <label>Where the Individual toilet is connected to?</label>
          <item>
            <label>Direct to sewer line</label>
            <value>01</value>
          </item>
          <item>
            <label>Single pit latrine</label>
            <value>02</value>
          </item>
          <item>
            <label>Twin pit latrine</label>
            <value>03</value>
          </item>
          <item>
            <label>Individual septic tank</label>
            <value>04</value>
          </item>
          <item>
            <label>Individual biogas</label>
            <value>05</value>
          </item>
          <item>
            <label>Biotoilet</label>
            <value>06</value>
          </item>
          <item>
            <label>Non-functional toilet</label>
            <value>07</value>
          </item>
          <item>
            <label>Don't know</label>
            <value>09</value>
          </item>
        </select1>
        <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_water_connection">
          <label>Type of water connection</label>
          <item>
            <label>Individual connection</label>
            <value>01</value>
          </item>
          <item>
            <label>Shared  connection</label>
            <value>02</value>
          </item>
          <item>
            <label>Water standpost</label>
            <value>03</value>
          </item>
          <item>
            <label>Handpump</label>
            <value>04</value>
          </item>
          <item>
            <label>Water tanker</label>
            <value>05</value>
          </item>
          <item>
            <label>Well</label>
            <value>06</value>
          </item>
        </select>
        <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/facility_of_waste_collection">
          <label>Facility of Waste Collection</label>
          <item>
            <label>MLA sponsored tempo</label>
            <value>01</value>
          </item>
          <item>
            <label>Door to door waste collection</label>
            <value>02</value>
          </item>
          <item>
            <label>ULB ghantagadi</label>
            <value>03</value>
          </item>
          <item>
            <label>ULB van</label>
            <value>04</value>
          </item>
          <item>
            <label>Garbage bin</label>
            <value>05</value>
          </item>
          <item>
            <label>Open space</label>
            <value>06</value>
          </item>
          <item>
            <label>Along/Inside canal</label>
            <value>07</value>
          </item>
          <item>
            <label>Inside gutter</label>
            <value>08</value>
          </item>
        </select>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile">
          <label>Interested in Individual toilet?</label>
          <item>
            <label>Yes</label>
            <value>01</value>
          </item>
          <item>
            <label>No</label>
            <value>02</value>
          </item>
        </select1>
        <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_why">
          <label>If YES, why?</label>
          <item>
            <label>For safety of female family members</label>
            <value>01</value>
          </item>
          <item>
            <label>Unsatisfied with CTB</label>
            <value>02</value>
          </item>
          <item>
            <label>For better convenience</label>
            <value>03</value>
          </item>
          <item>
            <label>For elderly</label>
            <value>04</value>
          </item>
          <item>
            <label>For handicapped</label>
            <value>05</value>
          </item>
          <item>
            <label>For any member suffering from illness</label>
            <value>06</value>
          </item>
          <item>
            <label>For better health and hygiene</label>
            <value>07</value>
          </item>
          <item>
            <label>Other</label>
            <value>08</value>
          </item>
        </select>
        <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_no_why">
          <label>If NO, why?</label>
          <item>
            <label>Financial problems</label>
            <value>01</value>
          </item>
          <item>
            <label>Small house</label>
            <value>02</value>
          </item>
          <item>
            <label>Tenant issue</label>
            <value>03</value>
          </item>
          <item>
            <label>Lack of willingness</label>
            <value>04</value>
          </item>
          <item>
            <label>Satisfied with the CTB</label>
            <value>05</value>
          </item>
          <item>
            <label>Large family size</label>
            <value>06</value>
          </item>
          <item>
            <label>Drainage related issues</label>
            <value>07</value>
          </item>
          <item>
            <label>Others</label>
            <value>08</value>
          </item>
        </select>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_toilet_preference">
          <label>Type of Toilet Preference</label>
          <item>
            <label>Prefab</label>
            <value>01</value>
          </item>
          <item>
            <label>Material at doorstep</label>
            <value>02</value>
          </item>
          <item>
            <label>Any</label>
            <value>03</value>
          </item>
          <item>
            <label>Don't know</label>
            <value>04</value>
          </item>
        </select1>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual">
          <label>Have you applied or individual toilet under SBM ?</label>
          <item>
            <label>Yes</label>
            <value>01</value>
          </item>
          <item>
            <label>No</label>
            <value>02</value>
          </item>
        </select1>
        <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/how_many_installments_have_yo">
          <label>How many instalments have you received ?</label>
          <item>
            <label>0</label>
            <value>01</value>
          </item>
          <item>
            <label>1</label>
            <value>02</value>
          </item>
          <item>
            <label>2</label>
            <value>03</value>
          </item>
        </select1>
      </group>
    </group>
  </body>
</html>

我正在尝试按照以下格式获取数据:

Questions                          Label                     Value
---------------------------------------------------------------------
select_administrative_ward_nam     Digha                      09
Name_of_surveyor_s_who_collec_001  Amol                       Amol
Name_of_surveyor_s_who_collec_001  Dhananjay                 dananjay
type_of_structure_of_the_house     Pucca                       01 
type_of_structure_of_the_house     Semi pucca                  02

我正在尝试以这种格式获取数据。

基本上,一列下的所有问题都表示列名称为“问题”,一列下的所有标签以及一列下的所有值都表示列名称为“值”。

这可能吗?任何帮助都会很棒......

1 个答案:

答案 0 :(得分:1)

试试这个:

            with table1 as (select $$<html>
              <head>
                <title>Sanjay Gandhi Nagar RHS Navi Mumbai</title>
                <model>
                  <instance>
                    <uploaded_form_usq3zf id="Sanjay_Gandhi_Nagar_RHS_Navi_M">
                      <formhub>
                        <uuid/>
                      </formhub>
                      <group_jg6ts57>
                        <city_name>7149</city_name>
                        <select_administrative_ward_nam>09</select_administrative_ward_nam>
                        <select_slum>272171490901</select_slum>
                        <date_of_rapid_household_survey/>
                        <Name_of_surveyor_s_who_collec_001/>
                        <house_number/>
                      </group_jg6ts57>
                      <type_of_house_occupancy/>
                      <group_xb9nq26>
                        <group_do8xg48>
                          <what_is_the_full_name_of_the_f/>
                          <mobile_number/>
                          <aadhar_card_number/>
                        </group_do8xg48>
                        <group_io6zh11>
                          <type_of_structure_of_the_house/>
                          <ownership_status/>
                          <no_of_family_fembers/>
                          <do_you_have_girl_child_under_a/>
                          <if_yes_how_many/>
                          <house_area_in_sq_ft/>
                          <current_place_of_defecation_t/>
                          <where_the_individual_toilet_is/>
                          <type_of_water_connection/>
                          <facility_of_waste_collection/>
                          <interested_in_individual_toile/>
                          <if_yes_why/>
                          <if_no_why/>
                          <type_of_toilet_preference/>
                          <have_you_applied_or_individual/>
                          <how_many_installments_have_yo/>
                        </group_io6zh11>
                      </group_xb9nq26>
                      <start/>
                      <end/>
                      <meta>
                        <instanceID/>
                      </meta>
                    </uploaded_form_usq3zf>
                  </instance>
                  <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/city_name" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/select_administrative_ward_nam" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/select_slum" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/date_of_rapid_household_survey" required="true()" type="date"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_jg6ts57/Name_of_surveyor_s_who_collec_001" required="true()" type="select1"/>
                  <bind constraint=". &lt;= 9999" nodeset="/uploaded_form_usq3zf/group_jg6ts57/house_number" required="true()" type="int"/>
                  <bind nodeset="/uploaded_form_usq3zf/type_of_house_occupancy" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/what_is_the_full_name_of_the_f" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' or  /uploaded_form_usq3zf/type_of_house_occupancy  = '03'" required="true()" type="string"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/mobile_number" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="string"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/aadhar_card_number" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="false()" type="string"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_structure_of_the_house" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/ownership_status" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/no_of_family_fembers" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="int"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_how_many" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a  = '01'" required="true()" type="int"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/house_area_in_sq_ft" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="int"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/where_the_individual_toilet_is" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and selected( /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t , '01')" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_water_connection" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/facility_of_waste_collection" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and not(selected( /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t , '01'))" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_why" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '01'" required="true()" type="select"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_no_why" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '02'" required="true()" type="select"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_toilet_preference" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile  = '01'" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01'" required="true()" type="select1"/>
                  <bind nodeset="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/how_many_installments_have_yo" relevant=" /uploaded_form_usq3zf/type_of_house_occupancy  = '01' and  /uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual  = '01'" required="true()" type="select1"/>
                  <bind preload="timestamp" preloadParams="start" nodeset="/uploaded_form_usq3zf/start" type="dateTime"/>
                  <bind preload="timestamp" preloadParams="end" nodeset="/uploaded_form_usq3zf/end" type="dateTime"/>
                  <bind calculate="concat('uuid:', uuid())" nodeset="/uploaded_form_usq3zf/meta/instanceID" readonly="true()" type="string"/>
                  <bind calculate="'1c0b0cef39054d85bdf2b17bb17e4043'" nodeset="/uploaded_form_usq3zf/formhub/uuid" type="string"/>
                </model>
              </head>
              <body>
                <group appearance="field-list" ref="/uploaded_form_usq3zf/group_jg6ts57">
                  <label>Administration Information</label>
                  <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/city_name">
                    <label>City Name</label>
                    <item>
                      <label>Navi Mumbai</label>
                      <value>7149</value>
                    </item>
                  </select1>
                  <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/select_administrative_ward_nam">
                    <label>Select Administrative Ward Name</label>
                    <item>
                      <label>Digha</label>
                      <value>09</value>
                    </item>
                  </select1>
                  <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/select_slum">
                    <label>Select Slum</label>
                    <item>
                      <label>Sanjay Gandhi Nagar</label>
                      <value>272171490901</value>
                    </item>
                  </select1>
                  <input ref="/uploaded_form_usq3zf/group_jg6ts57/date_of_rapid_household_survey">
                    <label>Date of Rapid Household Survey</label>
                  </input>
                  <select1 ref="/uploaded_form_usq3zf/group_jg6ts57/Name_of_surveyor_s_who_collec_001">
                    <label>Name of surveyor(s) who collected Rapid Household Survey data</label>
                    <item>
                      <label>Amol</label>
                      <value>amol</value>
                    </item>
                    <item>
                      <label>Dhananjay</label>
                      <value>dhananjay</value>
                    </item>
                    <item>
                      <label>Reshma</label>
                      <value>reshma</value>
                    </item>
                    <item>
                      <label>Shankar</label>
                      <value>shankar</value>
                    </item>
                    <item>
                      <label>Sheetal</label>
                      <value>sheetal</value>
                    </item>
                    <item>
                      <label>Vaibhav</label>
                      <value>vaibhav</value>
                    </item>
                  </select1>
                  <input ref="/uploaded_form_usq3zf/group_jg6ts57/house_number">
                    <label>House Number</label>
                  </input>
                </group>
                <select1 ref="/uploaded_form_usq3zf/type_of_house_occupancy">
                  <label>Type of Structure Occupancy</label>
                  <item>
                    <label>Occupied</label>
                    <value>01</value>
                  </item>
                  <item>
                    <label>Locked house</label>
                    <value>02</value>
                  </item>
                  <item>
                    <label>Double house</label>
                    <value>03</value>
                  </item>
                  <item>
                    <label>Broken house</label>
                    <value>04</value>
                  </item>
                  <item>
                    <label>House under construction</label>
                    <value>05</value>
                  </item>
                  <item>
                    <label>Permanent locked</label>
                    <value>06</value>
                  </item>
                  <item>
                    <label>Not giving information</label>
                    <value>07</value>
                  </item>
                </select1>
                <group ref="/uploaded_form_usq3zf/group_xb9nq26">
                  <label>Household Information</label>
                  <group appearance="field-list" ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48">
                    <label>Personal Information</label>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/what_is_the_full_name_of_the_f">
                      <label>What is the full name of the family head?</label>
                    </input>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/mobile_number">
                      <label>Mobile Number</label>
                    </input>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_do8xg48/aadhar_card_number">
                      <label>Aadhar Card Number</label>
                    </input>
                  </group>
                  <group ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11">
                    <label>General Information</label>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_structure_of_the_house">
                      <label>Type of structure of the house</label>
                      <item>
                        <label>Pucca</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Semi pucca</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Kutcha</label>
                        <value>03</value>
                      </item>
                    </select1>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/ownership_status">
                      <label>Ownership status</label>
                      <item>
                        <label>Own house</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Tenants</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Not giving information</label>
                        <value>03</value>
                      </item>
                    </select1>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/no_of_family_fembers">
                      <label>No of Family Members</label>
                    </input>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/do_you_have_girl_child_under_a">
                      <label>Do you have girl child under age 18 ?</label>
                      <item>
                        <label>Yes</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>No</label>
                        <value>02</value>
                      </item>
                    </select1>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_how_many">
                      <label>If yes, how many?</label>
                    </input>
                    <input ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/house_area_in_sq_ft">
                      <label>House Area in Sq. ft</label>
                    </input>
                    <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/current_place_of_defecation_t">
                      <label>Current place of defecation (toilet)</label>
                      <item>
                        <label>Individual toilet</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Community toilet block (CTB)</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Shared toilet</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>Open space</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>Public toilet (PTB)</label>
                        <value>05</value>
                      </item>
                    </select>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/where_the_individual_toilet_is">
                      <label>Where the Individual toilet is connected to?</label>
                      <item>
                        <label>Direct to sewer line</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Single pit latrine</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Twin pit latrine</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>Individual septic tank</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>Individual biogas</label>
                        <value>05</value>
                      </item>
                      <item>
                        <label>Biotoilet</label>
                        <value>06</value>
                      </item>
                      <item>
                        <label>Non-functional toilet</label>
                        <value>07</value>
                      </item>
                      <item>
                        <label>Don't know</label>
                        <value>09</value>
                      </item>
                    </select1>
                    <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_water_connection">
                      <label>Type of water connection</label>
                      <item>
                        <label>Individual connection</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Shared  connection</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Water standpost</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>Handpump</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>Water tanker</label>
                        <value>05</value>
                      </item>
                      <item>
                        <label>Well</label>
                        <value>06</value>
                      </item>
                    </select>
                    <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/facility_of_waste_collection">
                      <label>Facility of Waste Collection</label>
                      <item>
                        <label>MLA sponsored tempo</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Door to door waste collection</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>ULB ghantagadi</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>ULB van</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>Garbage bin</label>
                        <value>05</value>
                      </item>
                      <item>
                        <label>Open space</label>
                        <value>06</value>
                      </item>
                      <item>
                        <label>Along/Inside canal</label>
                        <value>07</value>
                      </item>
                      <item>
                        <label>Inside gutter</label>
                        <value>08</value>
                      </item>
                    </select>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/interested_in_individual_toile">
                      <label>Interested in Individual toilet?</label>
                      <item>
                        <label>Yes</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>No</label>
                        <value>02</value>
                      </item>
                    </select1>
                    <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_yes_why">
                      <label>If YES, why?</label>
                      <item>
                        <label>For safety of female family members</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Unsatisfied with CTB</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>For better convenience</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>For elderly</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>For handicapped</label>
                        <value>05</value>
                      </item>
                      <item>
                        <label>For any member suffering from illness</label>
                        <value>06</value>
                      </item>
                      <item>
                        <label>For better health and hygiene</label>
                        <value>07</value>
                      </item>
                      <item>
                        <label>Other</label>
                        <value>08</value>
                      </item>
                    </select>
                    <select ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/if_no_why">
                      <label>If NO, why?</label>
                      <item>
                        <label>Financial problems</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Small house</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Tenant issue</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>Lack of willingness</label>
                        <value>04</value>
                      </item>
                      <item>
                        <label>Satisfied with the CTB</label>
                        <value>05</value>
                      </item>
                      <item>
                        <label>Large family size</label>
                        <value>06</value>
                      </item>
                      <item>
                        <label>Drainage related issues</label>
                        <value>07</value>
                      </item>
                      <item>
                        <label>Others</label>
                        <value>08</value>
                      </item>
                    </select>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/type_of_toilet_preference">
                      <label>Type of Toilet Preference</label>
                      <item>
                        <label>Prefab</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>Material at doorstep</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>Any</label>
                        <value>03</value>
                      </item>
                      <item>
                        <label>Don't know</label>
                        <value>04</value>
                      </item>
                    </select1>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/have_you_applied_or_individual">
                      <label>Have you applied or individual toilet under SBM ?</label>
                      <item>
                        <label>Yes</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>No</label>
                        <value>02</value>
                      </item>
                    </select1>
                    <select1 ref="/uploaded_form_usq3zf/group_xb9nq26/group_io6zh11/how_many_installments_have_yo">
                      <label>How many instalments have you received ?</label>
                      <item>
                        <label>0</label>
                        <value>01</value>
                      </item>
                      <item>
                        <label>1</label>
                        <value>02</value>
                      </item>
                      <item>
                        <label>2</label>
                        <value>03</value>
                      </item>
                    </select1>
                  </group>
                </group>
              </body>
            </html>$$::xml xml_content)

            select ref_select_tab[array_length(ref_select_tab,1)] "Questions",(xpath('//label/text()',one_item))[1] as  "Label",(xpath('//value/text()',one_item))[1] as  "Value" from (
            select string_to_array((xpath('@ref',one_select))[1]::character varying,'/') ref_select_tab,unnest(xpath('//item',one_select)) one_item from (
            select unnest(xpath('//select1',xml_content)) one_select from table1
            ) a
            ) b