xmltextreader

Following is an example of tags that I have:

- <ProductSet_s>
  <ProductSet_Index>953</ProductSet_Index>
  <ProductSet_Name>Conforming 1/1 LIBOR ARM</ProductSet_Name>
  <ProductSet_Description />
  <ProductSetState_Index>6</ProductSetState_Index>
  <ReleaseToProduction>false</ReleaseToProduction>
  <Entity_Index>116</Entity_Index>
  <ParentProductSet_Index>940</ParentProductSet_Index>
  <PricingSource_Index>238</PricingSource_Index>
  <ProductSpecificSet>1</ProductSpecificSet>
  <ScreenOrder>160</ScreenOrder>
  <Product_Name />
  <Product_Abbreviated_Name>Conf 1/1 LIBOR ARM</Product_Abbreviated_Name>
  <Product_Code>521</Product_Code>
  <AvailabilityStartType_Index>3</AvailabilityStartType_Index>
  <AvailabilityEndType_Index>5</AvailabilityEndType_Index>
  <CurrentAvailabilityEnd>2004-01-29T17:54:00.5600000-06:00</CurrentAvailabilityEnd>
  <CurrentAvailabilityState_Index>4</CurrentAvailabilityState_Index>
  <AmortizationType_Index>134</AmortizationType_Index>
  <AmortizationTerm_Index>149</AmortizationTerm_Index>
  <LoanTerm_Index>136</LoanTerm_Index>
  <LoanType_Index>127</LoanType_Index>
  <ARMAttributeSource_Index>264</ARMAttributeSource_Index>
  <ARMFixedTerm_Index>269</ARMFixedTerm_Index>
  <ARMIndex_Index>2</ARMIndex_Index>
  <ARMMargin_Index>11</ARMMargin_Index>
  <ARMFirstCap>2.000</ARMFirstCap>
  <ARMPeriodicCap>2.000</ARMPeriodicCap>
  <ARMRelativeCap>6.000</ARMRelativeCap>
  <QualifiedFilterCount>0</QualifiedFilterCount>
  <DisqualifiedFilterCount>0</DisqualifiedFilterCount>
  <OverlayedAttributes>0</OverlayedAttributes>
  <BestExOnly>0</BestExOnly>
  </ProductSet_s>
- <ProductSet_s>
  <ProductSet_Index>954</ProductSet_Index>
  <ProductSet_Name>Conforming 3/1 LIBOR ARM</ProductSet_Name>
  <ProductSet_Description />
  <ProductSetState_Index>6</ProductSetState_Index>
  <ReleaseToProduction>false</ReleaseToProduction>
  <Entity_Index>116</Entity_Index>
  <ParentProductSet_Index>940</ParentProductSet_Index>
  <PricingSource_Index>240</PricingSource_Index>
  <ProductSpecificSet>1</ProductSpecificSet>
  <ScreenOrder>170</ScreenOrder>
  <Product_Name />
  <Product_Abbreviated_Name>Conf 3/1 LIBOR ARM</Product_Abbreviated_Name>
  <Product_Code>523</Product_Code>
  <AvailabilityStartType_Index>3</AvailabilityStartType_Index>
  <AvailabilityEndType_Index>5</AvailabilityEndType_Index>
  <CurrentAvailabilityEnd>2004-01-29T17:54:01.0130000-06:00</CurrentAvailabilityEnd>
  <CurrentAvailabilityState_Index>4</CurrentAvailabilityState_Index>
  <AmortizationType_Index>134</AmortizationType_Index>
  <AmortizationTerm_Index>149</AmortizationTerm_Index>
  <LoanTerm_Index>136</LoanTerm_Index>
  <LoanType_Index>127</LoanType_Index>
  <ARMAttributeSource_Index>264</ARMAttributeSource_Index>
  <ARMFixedTerm_Index>270</ARMFixedTerm_Index>
  <ARMIndex_Index>2</ARMIndex_Index>
  <ARMMargin_Index>11</ARMMargin_Index>
  <ARMFirstCap>2.000</ARMFirstCap>
  <ARMPeriodicCap>2.000</ARMPeriodicCap>
  <ARMRelativeCap>6.000</ARMRelativeCap>
  <QualifiedFilterCount>0</QualifiedFilterCount>
  <DisqualifiedFilterCount>0</DisqualifiedFilterCount>
  <OverlayedAttributes>0</OverlayedAttributes>
  <BestExOnly>0</BestExOnly>
  </ProductSet_s>

I can have multiple ProductSet_s tags. How can I use xmltextreader and specify that if ProductSet_index = "a value that i specify" then pop up a message that shows the value of ProductSet_Name?
sandya_116Asked:
Who is Participating?
 
ctm5Commented:
I hope I understand you correctly.

If you are parsing through the XML, you are looking for the tag name "ProductSet_Index." Anytime you find it, you want to see what the contents of the tag are. If they match what you are looking for, then you just need to keep reading until you find the tag name "ProductSet_Name." Think of reading XML as just skimming through a long list.

Let's say your XMLTextReader is called reader.

 Do While (reader.Read())
                If Len(reader.Name) Then
                      If reader.Name = myIndexName Then
                           Do Until reader.Name = mySetName"
                                 reader.Read
                           Loop
                           MsgBox reader.ReadString
                      End If
                 End If
 Loop

That code is just me fumbling -- no guarantees that it's letter perfect!

ctm5
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.