Okee, following the MS documentation trying to get this to work, but am having an issue with it not actually reading or loading the XML.
To begin, we start with a string (glb_returnedXML) which equates to:
I then attemp to read that string via the stream reader like this:
After that little bit of code runs, if I query (command window) the value of xmlSR it returns:
It doesn't throw an error, it just doesn't seem to load the data. Anyone see what I'm missing or doing wrong?!
I do believe this is centric to the reading of the XML string.
Jeff W.
MCSE, CNE
To begin, we start with a string (glb_returnedXML) which equates to:
Code:
<StockQuotes><Stock><Symbol>INTC</Symbol><Last>24.10</Last><Date>2/28/2005</Date><Time>2:56pm</Time><Change>+0.01</Change><Open>24.15</Open><High>24.49</High><Low>23.86</Low><Volume>63227088</Volume><MktCap>150.1B</MktCap><PreviousClose>24.09</PreviousClose><PercentageChange>+0.04%</PercentageChange><AnnRange>19.64 - 30.14</AnnRange><Earns>1.16</Earns><P-E>20.77</P-E><Name>INTEL CP</Name></Stock></StockQuotes>
I then attemp to read that string via the stream reader like this:
Code:
Dim ds_formattedXML As DataSet = New DataSet
Dim dt_formattedXML As DataTable = New DataTable("stockQuote")
dt_formattedXML.Columns.Add("symbol", Type.GetType("System.String"))
dt_formattedXML.Columns.Add("last", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("date", Type.GetType("System.DateTime"))
dt_formattedXML.Columns.Add("time", Type.GetType("System.DateTime"))
dt_formattedXML.Columns.Add("change", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("open", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("high", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("low", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("volume", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("mktcap", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("previousClose", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("percentageChange", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("annRangeUpper", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("annRangeLower", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("earns", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("pe", Type.GetType("System.Decimal"))
dt_formattedXML.Columns.Add("name", Type.GetType("System.String"))
ds_formattedXML.Tables.Add(dt_formattedXML)
Dim xmlSR As System.IO.StringReader = New System.IO.StringReader(glb_returnedXML)
ds_formattedXML.ReadXml(xmlSR, XmlReadMode.IgnoreSchema)
After that little bit of code runs, if I query (command window) the value of xmlSR it returns:
Code:
?xmlsr
{System.IO.StringReader}
Null: {System.IO.TextReader.NullTextReader}
?xmlsr.ReadToEnd.ToString
""
It doesn't throw an error, it just doesn't seem to load the data. Anyone see what I'm missing or doing wrong?!
I do believe this is centric to the reading of the XML string.
Jeff W.
MCSE, CNE