-
XML Validation - External DTD
Hello.
I cannot get my .net xml validator working with an external dtd. I am hoping somebody could help me out here.
This is my code:
Dim settings As New XmlReaderSettings()
settings.ValidationType = ValidationType.DTD
settings.ProhibitDtd = False
AddHandler settings.ValidationEventHandler, AddressOf ValidateHandler
Dim xml As String = "C:\XmlDocuments\order.xml"
Dim xmlStream As New FileStream(xml, FileMode.Open)
Dim xmlReader As XmlReader = System.Xml.XmlReader.Create(xmlStream, settings)
Try
While xmlReader.Read()
End While
Catch ex As Exception
Response.Write(ex.Message)
Finally
xmlReader.Close()
xmlStream.Close()
xmlStream.Dispose()
End Try
Private Sub ValidateHandler(ByVal sender As Object, ByVal e As
ValidationEventArgs)
Response.Write(ex.Message)
End Sub
I am getting the following exception:
An error has occurred while opening external DTD 'file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/order.dtd': Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\order.dtd'.
This is what I got in order.xml for the dtd declaration:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE order SYSTEM "order.dtd">
My code works with an inline DTD, but not using a xml file with an external DTD.
Thank you so much.
Similar Threads
-
By Chris H Baker in forum C++
Replies: 5
Last Post: 01-17-2007, 02:37 PM
-
By Volker Held in forum XML
Replies: 0
Last Post: 06-26-2002, 07:30 AM
-
By David Rancour in forum XML
Replies: 1
Last Post: 05-07-2001, 02:16 PM
-
By Tim Frost in forum xml.announcements
Replies: 0
Last Post: 04-02-2001, 10:53 AM
-
By Extensibility in forum web.announcements
Replies: 0
Last Post: 07-20-2000, 06:20 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|