Mega Code Archive
XmlTextReader Normalization Property tells whether to normalize white space and attribute values
Imports System
Imports System.IO
Imports System.Xml
Imports Microsoft.VisualBasic
Public Class Sample
Public Shared Sub Main()
Dim xmlFrag As String = " "
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(New NameTable())
Dim context As XmlParserContext = New XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.Preserve)
Dim reader As XmlTextReader = New XmlTextReader(xmlFrag, XmlNodeType.Element, context)
reader.Read()
reader.Normalization = False
Console.WriteLine("Attribute value:{0}", reader.GetAttribute("attr1"))
reader.Normalization = True
Console.WriteLine("Attribute value:{0}", reader.GetAttribute("attr1"))
reader.Normalization = False
reader.Read()
reader.MoveToContent()
Console.WriteLine("Attribute value:{0}", reader.GetAttribute("attr2"))
reader.Close()
End Sub
End Class