XmlTextReader Overview #Misc .Net

Brought from our old site: http://salearningschool.com/displayArticle.php?table=Articles&articleID=626&title=XmlTextReader%20Overview

Overview of .Net XmlReader and XmlWriter Object

XmlReader

Can read XML data both from file or stream. Readonly access. Also, provides information about the XML data.

XmlTextReader class is derived from XmlReader. It provides faster access to XML data though it does not support
validating DTD or XML schema.

XmlValidatingReader class supports both DTD and schema validation.

Attributes of XmlTextWriter class are AttributeCount, Depth, HasAttributes, HasValue, IsEmptyElement, Item, Value. Some methods are: IsStartElement, MoveToElement, MoveToFirstAttribute, MoveToNextAttribute, Read, ReadAttributeValue, ReadString, ReadStartElement, ReadEndElement, Skip

Example
   

dim reader as New XmlTextReader("")
   while reader.Read()
	select case reader.Nodetype
		case XmlNodeType.Element
			Console.Write("<"+reader.name);
			While(reader.moveToNextAttribute())
				Console.Write(" "&reader.name & "='" & reader.value & "'")
   End While
   Console.Write(">")
   if reader.HasAttributes then
   while reader.movetonextAttribute()
	Console.Write(reader.value)
   End While
   end if

  case XmlNodeType.Text
	Console.Write(reader.value)		
  case XmlNodeType.EndElement
	Console.WriteLine("")
end select
end while

From: http://sitestree.com/?p=3768
Categories:Misc .Net
Tags:
Post Data:2016-07-17 15:02:21

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada