Page 1 of 1

XML Resolver Funkiness

PostPosted: Thu Jan 28, 2010 7:55 pm
by torial
Normally I can do this sort of thing in C#, and I've tried a few variations, I've checked the MSDN documentation, etc... and my understanding is that XmlDocument, XmlReaderSettings, and XmlTextReader should all have a XmlResolver property.

I have tried to access this from each of the classes and I get an error: "Cannot find a definition for "xmlResolver" in "settings" whose type is "XmlReaderSettings"

Code: Select all

        settings = XmlReaderSettings()
        settings.xmlResolver = nil
        settings.prohibitDtd = false
       
        reader = XmlTextReader.create(FileStream(fileName),settings)
        tmx = XmlDocument()
        tmx.load(reader)
        tus = tmx.selectNodes('//tu')
        MessageBox.show(tus.count.toString,"count")


When I copied the code, I of course got an error saying "Cannot find a definition for "ProhibitDtd" in "settings" whose type is "XmlReaderSettings". There is a member named "prohibitDtd" with a similar name.", but I get no such indicator for the XmlResolver

Re: XML Resolver Funkiness

PostPosted: Thu Jan 28, 2010 11:12 pm
by Charles
I was able to reproduce the problem using the Cobra trunk on Mono 2.6.1 on Mac OS X. I was also able to confirm that C# can see the method, because this compiles:
use System.Xml
class P
def main
settings = XmlReaderSettings()
sharp'settings.XmlResolver = null'
#settings.xmlResolver = nil
settings.prohibitDtd = false

After some examination, I discovered that this property has a non-public getter and public setter. In other words, from your perspective, it is a "set only" property. Cobra does not currently track the perms on getters and setters separately so it just uses the getter to determine if the property is visible.

I'm working on a fix.

Re: XML Resolver Funkiness

PostPosted: Thu Jan 28, 2010 11:35 pm
by torial
Cool, thanks for the update. I'll be happy to test it.

Re: XML Resolver Funkiness

PostPosted: Thu Jan 28, 2010 11:47 pm
by Charles
Fixed. Thanks for the report.