<docs frequency="daily">
<dataset_code>EXR</dataset_code>
<dataset_name>Exchange Rates</dataset_name>
<indexed_at>2020-08-08T09:19:15.366Z</indexed_at>
<provider_code>ECB</provider_code>
<series_code>D.AUD.EUR.SP00.A</series_code>
<series_name>Daily – Australian dollar – Euro – Spot – Average</series_name>
<dimensions>
<CURRENCY>AUD</CURRENCY>
<CURRENCY_DENOM>EUR</CURRENCY_DENOM>
<EXR_SUFFIX>A</EXR_SUFFIX>
<EXR_TYPE>SP00</EXR_TYPE>
<FREQ>D</FREQ>
</dimensions>
</docs>
Dim nPeriodType As String = "None"
Dim dt1 As New DataTable
Dim ds1 As New DataSet
Dim xml1 As XmlNode = JsonConvert.DeserializeXmlNode("{records:{record:" & History1 & "}}")
Dim xmldoc1 As XmlDocument = New XmlDocument()
xmldoc1.LoadXml(xml1.InnerXml)
xmlReader1 = New XmlNodeReader(xml1)
ds1.ReadXml(xmlReader1)
If ds1.Tables("docs") IsNot Nothing Then
dt1 = ds1.Tables("docs")
If dt1.Rows.Count = 0 Then
res = "Error1: No records in XML source file."
Return "DataID " & DataSubID.ToString & ", " & Symbol & ", " & res
End If
Else
Throw New Exception(Symbol & ", DBNomics Server Error(Docs) not found.")
End If
QUESTION : How can I read the contents of attribute or element frequency in the first line <docs
frequency="daily">??
Dim myXMLStr as string ' store xml string
Dim myXML As New System.Xml.XmlDocument
myXML.LoadXML(myXMLStr)
Dim myAttrVal as string = myXML.DocumentElement.Attributes("frequency").Value
Member
249 Points
1064 Posts
How to read this XML element?
Aug 09, 2020 09:54 PM|icm63|LINK
QUESTION : How can I read the contents of attribute or element frequency in the first line <docs frequency="daily">??
Out put wanted is 'Daily'.
Using dt1 DataTable or other means?
Any ideas?
Participant
1091 Points
673 Posts
Re: How to read this XML element?
Aug 10, 2020 01:26 PM|jzero|LINK
Considering you have XML as String