Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validatin XMLDocument against DTD 1

Status
Not open for further replies.

aliinal

Technical User
Jun 26, 2001
104
TR
Hi,

I want to validate an XMLDocument object's content against a dtd. XML source is not written to a file so i can not use XMLValidatingReader. And i do not prefer to write xml document to a file first, read it back and delete temp file.

Is there any solution?

thanks
@li
 
I will start by saying that I myself am just starting to get in to XML with .Net so this may not be the most elegant solution, but it should work. The XmlValidatingReader class uses the XmlTextReader class which reads from a stream. There is no reason why this stream needs to be a FileStream. You should be able to serialize your XmlDocument to a MemoryStream and validate your XML document against your DTD without writing to a file.

stravis
 
Brillant solution!
it's great..

thanks.
@li
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top