validating xml against DTD
From: Wade G (wadegillingham_at_chartermi.net)
Date: 06/28/04
- Next message: Cor Ligthert: "Re: Reading Key Value from Collection in VB.NET"
- Previous message: One Handed Man \( OHM - Terry Burns \): "Re: How to get a usercontrol to automatically add code to the initialization code in a form..."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Jun 2004 05:23:09 -0700
I am using the following code to validate an xml file
against a DTD. If the xml file doesn't contain the
inline statement to declare the dtd, some xml files won't
show as invalid using this code. My question is, how do
I force the requirement to declare the DTD in the XML
file?
Private Function validate() As Boolean
'open the xml filename to a XmlValidatingReader object
Dim tr As XmlTextReader = New XmlTextReader(m_filename)
Dim vr As XmlValidatingReader = New XmlValidatingReader
(tr)
'validate against the DTD
vr.ValidationType = ValidationType.DTD
Try
'read the file one node at a time
While (vr.Read())
End While
Return True 'file is valid if this line is reached
Catch
Return False
End Try
End Function
- Next message: Cor Ligthert: "Re: Reading Key Value from Collection in VB.NET"
- Previous message: One Handed Man \( OHM - Terry Burns \): "Re: How to get a usercontrol to automatically add code to the initialization code in a form..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|