title: Query nodes of an xml document - Visual Basic
body: <p>I have an XML document that Im trying to read but my query keeps returning no result.
   the query im using is...</p>
  
  <pre><code>Dim products = From product In doc.Descendants("DeviceInstance") _
      Select product.Attribute("ProductRefId").Value
  
  For Each result In products
      MessageBox.Show(result.ToString())
  Next
  </code></pre>
  
  <p>where am I going wrong??</p>
  
  <p>see below for xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;KNX xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://knx.org/xml/project/10" CreatedBy="knxconv" ToolVersion="4.0.1004.62808"&gt;
    &lt;Project Id="P-0225"&gt;
      &lt;Installations&gt;
        &lt;Installation Name="" InstallationId="0"&gt;
          &lt;Topology&gt;
            &lt;Area Id="P-0225-0_A-734" Name="East" Address="1" Description=""&gt;
              &lt;Line Id="P-0225-0_L-736" Name="Ground" Address="1" MediumTypeRefId="MT-0" Comment="" Description=""&gt;
                &lt;DeviceInstance Name="" Id="P-0225-0_DI-761" ProductRefId="M-0064_H-MTN647893-1-O000C_P-MTN647893" Hardware2ProgramRefId="M-0064_H-MTN647893-1-O000C_HP-480B-21-4CB2-O000C" Address="5" Comment="" LastModified="2012-07-04T19:27:44" LastDownload="2012-08-22T11:27:40" InstallationHints="" IndividualAddressLoaded="true" ApplicationProgramLoaded="true" ParametersLoaded="true" CommunicationPartLoaded="true" MediumConfigLoaded="true" Description="SWA1101" IsCommunicationObjectVisibilityCalculated="true"&gt;
                  &lt;ParameterInstanceRefs&gt;
                    &lt;ParameterInstanceRef RefId="M-0064_A-480B-21-4CB2-O000C_P-1_R-1" Value="0"/&gt;
                    &lt;ParameterInstanceRef RefId="M-0064_A-480B-21-4CB2-O000C_P-2834_R-2834" Value="0"/&gt;
                    &lt;ParameterInstanceRef RefId="M-0064_A-480B-21-4CB2-O000C_P-2835_R-2835" Value="0"/&gt;
                  &lt;/ParameterInstanceRefs&gt;
                  &lt;ComObjectInstanceRefs&gt;
                    &lt;ComObjectInstanceRef RefId="M-0064_A-480B-21-4CB2-O000C_O-31_R-243" IsActive="true"&gt;
                    &lt;/ComObjectInstanceRef&gt;
                    &lt;Connectors&gt;
                      &lt;Send GroupAddressRefId="P-0225-0_GA-128"/&gt;
                    &lt;/Connectors&gt;
                  &lt;/ComObjectInstanceRefs&gt;
                &lt;/DeviceInstance&gt;
              &lt;/Line&gt;
            &lt;/Area&gt;
          &lt;/Topology&gt;
        &lt;/Installation&gt;
      &lt;/Installations&gt;
    &lt;/Project&gt;
  &lt;/KNX&gt;
  </code></pre>