[Gambas-user] XmlDocument.Open(filename) gives NULL [SOLVED]
KKing
kicking177 at ...626...
Wed Feb 17 10:13:02 CET 2016
On 17/02/16 00:32, Tobias Boege wrote:
> On Tue, 16 Feb 2016, Tobias Boege wrote:
>> On Tue, 16 Feb 2016, KKing wrote:
>>> I'm using Gambas 3.5.4 on Linux Mint
>>>
>>> I want to use XmlDocument but can't seem to load an existing xml
>>> document file.
>>>
>>> It errors on loads and just gives error text of "Null object"
>>>
>>> I can open and read the same file via XmlReader, but I want to work with
>>> the whole document via DOM.
>>>
>>> Is this likely to be something in the version of 3.5.4 that I'm using,
>>> that if I take trouble to compile newer version from source will resolve?
>>>
>>> Or am I misunderstanding usage of the XmlDocument?
>>>
>> You are not. This issue is very possibly related to bug #894 in the bug
>> tracker, but I guess you can't access bug reports if you are not registered.
>> XmlDocument.FromString() and XmlDocument.Open() both basically only delegate
>> their work to the same routine XMLDocument_SetContent() and we both get a
>> "Null object" error.
>>
>> It appears that Adrien, the author of the component, is busy these days. I
>> may be able to look into the issue later.
>>
> I spoke too soon. The problem in bug #894 was not a "Null object" but a
> segfault and is fixed now.
>
> On my system with Gambas 3.8.90, I could not reproduce your problem at all.
> Did you by any chance forgot to instantiate the XmlDocument? Like so:
>
> Dim x As New XmlDocument
>
> x.Open(sPath)
>
> (Note the "New" in the declaration.) This would be an easy source of a "Null
> object" error.
>
> In any case, Gambas 3.5.4 is from July 2014. Gambas had ca. 1300 commits
> since then. It would probably be profitable to update if you can, and you
> should update if your problem was not the missing "New".
>
> Regards,
> Tobi
>
Tobi, with the new in Dim statement it works.
many thanks.
- - - - -
More information about the User
mailing list