[Gambas-user] xmlDocument Bug 1336

T Lee Davidson t.lee.davidson at gmail.com
Thu May 28 18:08:20 CEST 2020


On 5/2/20 1:17 PM, CD wrote:
> By re-debugging the code I realized that not only the function
> Save of the XmlDocument object truncates the prolog of the xml document,
> but that the Open function of the same XmlDocument object also truncates the same prolog.
> And in both cases (Open/Save) the Processing Instruction is deleted.
> 
> Moreover, after searching unsuccessfully in the objects of the gb.xml library,
> especially in the XmlDocument object, I did not find anywhere a method
> to create/modify a Prologue (https://www.w3.org/TR/xml/#sec-prolog-dtd)
> or a Processing Instruction (https://www.w3.org/TR/xml/#sec-pi).

The Save method cannot save what isn't there. It appears that (in gb.xml/src/document.cpp) the XMLDocument_SetContent method, 
called by XMLDocument_Open, assumes that a prolog, if it exists, *always* consists entirely of XMLDecl (lines 114-124).

It will retain a comment, but detaches it from the prolog. A Processing Instruction is lost.


-- 
Lee


More information about the User mailing list