| | |
Parse an xml stream
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2009
Posts: 7
Reputation:
Solved Threads: 0
Hi. using the following code I am trying to read an xml stream
[code]
If the element is wholly between the tags such as
Then the msgbox displays the title of the book.
If as in the case below there is a whitespace in the element name t
Then the code simpley selects the 'whitespace' case and does not go on to parse the rest of the element line.
So my question is, using vb.net how can I read the elements and associated values in such an xml schema? I best state that all this is v new to me, so if I have used any inccorrect terms in describing my problem I apologise and hope that such does render the description of my problem unintelligible. THanks for all and any help.
[code]
vb.net Syntax (Toggle Plain Text)
Do While (reader.Read()) Select Case reader.NodeType Case XmlNodeType.Element 'Display beginning of element. MsgBox("<" + reader.Name) Case XmlNodeType.Text 'Display the text in each element. MsgBox(reader.Value) Case XmlNodeType.EndElement 'Display end of element. MsgBox("</" + reader.Name + ">") ' MsgBox(">") Case XmlNodeType.Attribute MsgBox(reader.Value) Case XmlNodeType.EntityReference MsgBox(reader.Value) Case XmlNodeType.EndElement MsgBox("At end element" + reader.Value) Case XmlNodeType.Comment MsgBox(reader.Value) Case XmlNodeType.SignificantWhitespace MsgBox("SignificantWhitespace") Case XmlNodeType.Whitespace MsgBox("Whitespace") Case XmlNodeType.ProcessingInstruction MsgBox(reader.Value) End Select Loop [/ code]
If the element is wholly between the tags such as
VB.NET Syntax (Toggle Plain Text)
<book>MOBY DICK</book>
If as in the case below there is a whitespace in the element name t
VB.NET Syntax (Toggle Plain Text)
<book title ="MOBY DICK" value="Not Available"/>
So my question is, using vb.net how can I read the elements and associated values in such an xml schema? I best state that all this is v new to me, so if I have used any inccorrect terms in describing my problem I apologise and hope that such does render the description of my problem unintelligible. THanks for all and any help.
![]() |
Similar Threads
- parse XML in an array in vb.net console application (VB.NET)
- Difference between loading xml as stream or string (C#)
- How to Parse the Following XML Code... (PHP)
- Parse a XML element with AJAX (JavaScript / DHTML / AJAX)
- How to Parse XML in ASP? (ASP)
- How to Parse XML file (RSS, Web Services and SOAP)
- Parse XML from ASP!!! (ASP)
Other Threads in the VB.NET Forum
- Previous Thread: how to create database
- Next Thread: Crystal Reports - Summarize over ID
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic beginner bing browser button buttons center check code crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter forms ftp generatetags google hardcopy html images input insert intel internet mobile monitor net networking objects open output panel passingparameters pdf picturebox picturebox1 port position print printing problem save searchbox searchvb.net select serial settings shutdown soap sqlserver survey table tcp temperature text textbox timer timespan toolbox transparency trim update user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode year





