hema latha

hema latha

  • NA
  • 122
  • 31.5k

read xml while "Parsing Comment" has occurred in vb.net.

Jan 22 2019 5:30 AM
Unexpected end of file while parsing comment has occurred.line 57,position 69,when read xml file.why did come this error?How to resolve this error?
Imports System.Xml
Imports System.Xml.Schema
Module Module1
Private isValid As Boolean = True
Sub Main()
Dim XMLPath As String = "D:\Karpagam\files1\xmlfiles\04-CHAPTER-4.xml"
' Set the validation settings.
Dim settings As XmlReaderSettings = New XmlReaderSettings()
settings.DtdProcessing = DtdProcessing.Parse
settings.ValidationType = ValidationType.DTD
settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings
settings.ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema
AddHandler settings.ValidationEventHandler, AddressOf ValidationCallBack
' Create the XmlReader object.
Dim reader As XmlReader = XmlReader.Create(XMLPath, settings)
' Parse the file.
While reader.Read() ' unexpected end of file while parsing comment has occurred.line 57,position 69.
End While
Private Sub ValidationCallBack(sender As Object, e As ValidationEventArgs)
MsgBox(String.Format("Validation Error: {0}", e.Message), MsgBoxStyle.OkOnly)
End Sub
End Module

Answers (4)