I'm using XMLReader, so far so good. However, my problem is I need to parse out a subnode and cannot figure out how to use the XMLReader to do that.
My code:
If xtr.Name = "Quote_Coverage" Then
xtr.MoveToAttribute("Quote_Coverage_Id")
xml_MessageArray.Quote_Coverage_Id = xtr.Value
xtr.MoveToAttribute("Plan_Name")
xml_MessageArray.Plan_Name = xtr.Value
If xtr.Name = "Benefits" Then
xtr.MoveToAttribute("SubCategory")
xml_MessageArray.SubCategory = xtr.Value
xtr.MoveToAttribute("Code")
xml_MessageArray.Code = Replace(xtr.Value, "/", "_")
End If
end if
I'm trying to get the attributes from the child node Benefits, but since it's at the element Quote-Coverage all it wants to read is all of those first. I'd like to load an array or something similar for each iteration.
My xml:
<Quote_Coverages>
- <Quote_Coverage Quote_Coverage_Id="094F" Plan_Name="Plan_A">
- <Benefits>
<Benefit SubCategory="Small Group Pharmacy" Code="SG123" />
</Benefits>
</Quote_Coverage>
- <Quote_Coverage Quote_Coverage_Id="094G" Plan_Name="Plan_B">
- <Benefits>
<Benefit SubCategory="Small Group Medical" Code="SG456" />
</Benefits>
</Quote_Coverage
My code:
If xtr.Name = "Quote_Coverage" Then
xtr.MoveToAttribute("Quote_Coverage_Id")
xml_MessageArray.Quote_Coverage_Id = xtr.Value
xtr.MoveToAttribute("Plan_Name")
xml_MessageArray.Plan_Name = xtr.Value
If xtr.Name = "Benefits" Then
xtr.MoveToAttribute("SubCategory")
xml_MessageArray.SubCategory = xtr.Value
xtr.MoveToAttribute("Code")
xml_MessageArray.Code = Replace(xtr.Value, "/", "_")
End If
end if
I'm trying to get the attributes from the child node Benefits, but since it's at the element Quote-Coverage all it wants to read is all of those first. I'd like to load an array or something similar for each iteration.
My xml:
<Quote_Coverages>
- <Quote_Coverage Quote_Coverage_Id="094F" Plan_Name="Plan_A">
- <Benefits>
<Benefit SubCategory="Small Group Pharmacy" Code="SG123" />
</Benefits>
</Quote_Coverage>
- <Quote_Coverage Quote_Coverage_Id="094G" Plan_Name="Plan_B">
- <Benefits>
<Benefit SubCategory="Small Group Medical" Code="SG456" />
</Benefits>
</Quote_Coverage