I have an XML document which contains the following code. (I do not have the option to change the format of this XML, i must use it in its current format)
As you can see the XML is split up into 3 distinct sections, ISSUERS, AGENCIES and RATINGS, In short Ratings are given to issuers by various agencies. (i.e all the sections and id numbers link up link up)
The code on my button is as follows:
This iterates through the Ratings and outputs the the attributes in the ratings:
e.g 176320 | 1 | Baa3 | 0 | 2006-09-18
as you can see "176320" means absolutely nothing, its not useful to anyone using the application. Instead of outputting 176320 I wish to look up the <issuers> portion of the XML and find the id "176320" and then find its name value. (i would also like to lookup the agency that has id = 1)
so my output should be:
20th Century Industries | English Bond Rating Service | Baa3 | 0 | 2006-09-18
Hope this is clear, all i'm trying to do is link up the ID's so that the information being displayed actually makes sense to the end user.
VB.NET:
<issuers>
<issuer name="20th Century Industries" id="176320" industry="30" country="USA" date="2003-02-17"/>
<issuer name="21st Century Insurance Company" id="176320" industry="04" country="USA" date="2010-06-13"/>
</issuers>
<agencies>
<agency name="English Bond Rating Service" id="1"/>
<agency name="American Bond Rating Service" id="2"/>
</agencies>
<ratings>
<rating issuer-id="176320" agency-id="1" long-grade="Baa3" short-grade="" lp="0" sp="0" long-watch="" short-watch="" date="2006-09-18"/>
<rating issuer-id="176320" agency-id="2" long-grade="BBB+" short-grade="" lp="0" sp="0" long-watch="" short-watch="" date="2010-09-13"/>
</ratings>
As you can see the XML is split up into 3 distinct sections, ISSUERS, AGENCIES and RATINGS, In short Ratings are given to issuers by various agencies. (i.e all the sections and id numbers link up link up)
The code on my button is as follows:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xmldoc As New XmlDataDocument()
Dim xmlnode As XmlNodeList
Dim i As Integer
Dim str As String
Dim fs As New FileStream("C:\MyXMLfile.xml", FileMode.Open, FileAccess.Read)
xmldoc.Load(fs)
xmlnode = xmldoc.GetElementsByTagName("rating")
For i = 0 To xmlnode.Count - 1
str = xmlnode(i).Attributes("issuer-id").Value & " | " & xmlnode(i).Attributes("agency-id").Value & " | " & xmlnode(i).Attributes("long-grade").Value & " | " & xmlnode(i).Attributes("short-grade").Value & " | " & xmlnode(i).Attributes("date").Value
MsgBox(str)
Next
End Sub
This iterates through the Ratings and outputs the the attributes in the ratings:
e.g 176320 | 1 | Baa3 | 0 | 2006-09-18
as you can see "176320" means absolutely nothing, its not useful to anyone using the application. Instead of outputting 176320 I wish to look up the <issuers> portion of the XML and find the id "176320" and then find its name value. (i would also like to lookup the agency that has id = 1)
so my output should be:
20th Century Industries | English Bond Rating Service | Baa3 | 0 | 2006-09-18
Hope this is clear, all i'm trying to do is link up the ID's so that the information being displayed actually makes sense to the end user.
Last edited: