[Mono-list] System.Xml XmlTextReader 'resolver' ...

Atsushi Eno atsushi at ximian.com
Mon Nov 13 20:23:09 EST 2006


Hi,

Michael Meeks wrote:
> 	Interesting; I'd be interesting to know what source you get that from.
> Based on the fact that this code works on MS' .Net 2.0 but not under
> Mono, it appears likely that we behave differently, and thus we are in
> error. Furthermore, (now I look) MSDN appears to support my view:
> 
> 	http://msdn2.microsoft.com/en-us/library/ms162478.aspx
> 
> "inputUri
>         
>         The URI for the file containing the XML data. The XmlResolver
>         object on the XmlReaderSettings object is used to convert the
>         path to a canonical data representation. If XmlResolver is a
>         null reference (Nothing in Visual Basic), a new XmlUrlResolver
>         object is used."

Oh really. Whatever I knew around it was, when I set null XmlResolver
to XmlReaderSettings in use, it still successfully read the stream,
so I thought it is simply not used for the primary xml stream itself.
Seems like this is a special case as denoted in MSDN.

Now I added another custom resolver case, which worked as you expected
(i.e. custom resolver is used instead of the default one).

>> XmlResolver could be explicitly set null (which indicates that it
>> must skip external entity resolution) and in such case your patch
>> causes NullReferenceException. (I will add such case to our tests.)
> 
> 	True - fair cop, it needs a conditional there.

Ok, based on above, with your patch it was simple to fix :-) The fix
will go into svn soon. Thanks for the report.

Atsushi Eno


More information about the Mono-list mailing list