[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gb.xml2: xmlwriter gives error on creating xml file


Le 13/11/2026 à 17:06, gbWilly a écrit :
On Friday, November 13th, 2026 at 16:01, gbWilly
<gbWilly@xxxxxxxxxxxxxx> wrote:


On Friday, November 13th, 2026 at 15:53, gbWilly
<gbWilly@xxxxxxxxxxxxxx> wrote:

I checked the libxml2 documentation and I stumble onto what you see
n added screenshot, xmlTextwriterClose is new since 2.13. I don't
know if you use it and how it got closed before 2.13, but this
might be causing the trouble.

gbWilly


I did some further invastigations. I started testing with gb.libxml
as it is based on the same library as gb.xml2 It, being an older code
base based on older version libxml2,  doesn't have a XmlWriter Close.
It does have a XmlWriter EndDocument. In gb.xml I used EndDocument at
the end instead of close and it worked just fine. Using gb.libxml, I
also used EndDocument and it works. As stated, gb.libxml has no Close
for XmlWriter, so it seems to not have not existed before 2.13 maybe?

When running the script based on gb.libxml all works using the same
xml2 library. So, it can be done on older xml2 library version. Added
the script based on gb.libxml and thus using the same library as
gb.xml2, and it does as expected.

So, something is missing in gb.xml2. The EndDocument is in the
documentation (see a previous post), just not implemented in gb.xml2.

I hope all this information will be of use for you.

gbWilly

I have no explanation.

The 'XmlWriter.Close()' method of 'gb.xml2' does the same thing as the 'XmlWriter.EndDocument()' method of 'gb.libxml': it calls the 'libxml2' API 'xmlWriterEndDocument()'.

I just changed the name of the Gambas method.

The difference is that 'gb.libxml' frees the 'xmlWriter' parser immediately after calling 'xmlWriterEndDocument()', whereas 'gb.xml2' frees the parser only when the Gambas 'XmlWriter' object is freed itself.

--
Benoît Minisini.


Follow-Ups:
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
References:
gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml fileBrian G <brian@xxxxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml fileBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: gb.xml2: xmlwriter gives error on creating xml filegbWilly <gbWilly@xxxxxxxxxxxxxx>