Forums

XML Resolver Funkiness

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

XML Resolver Funkiness

Postby torial » Thu Jan 28, 2010 7:55 pm

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
torial
 
Posts: 229
Location: IA

Re: XML Resolver Funkiness

Postby Charles » Thu Jan 28, 2010 11:12 pm

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: XML Resolver Funkiness

Postby torial » Thu Jan 28, 2010 11:35 pm

Cool, thanks for the update. I'll be happy to test it.
torial
 
Posts: 229
Location: IA

Re: XML Resolver Funkiness

Postby Charles » Thu Jan 28, 2010 11:47 pm

Fixed. Thanks for the report.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 76 guests

cron