Click to See Complete Forum and Search --> : How to handle entity references, when using XmlValidatingReader against a schema?


Matt.Chen
October 7th, 2003, 10:58 PM
I have a lot of xml documents which used to be validated againist a DTD. I decide to write a schema to validate them. There are a lot of entity refereneces in these documents. My document declaration looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mydoc [
<!ENTITY % ents1 SYSTEM "C:\docs\ent\xhtml-lat1.ent" >
%ents1;]>
<mydoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="c:\docs\xsd\mydoc.xsd">

This works fine with XMLSPY. However, when I use .Net XmlValidatingReader to validate these documents, it always throw an undecalared entity referenece XmlException when the reader encounter an entity reference.
How to handle a entity reference, when using XmlValidatingReader against a schema?