Subject Re: Setvar in xmldocument
From Andreas Gehrs-Pahl <>
Date Wed, 4 Mar 2020 15:13:27 -0500
Newsgroups xb2net

The problem is the following:

Changing the values of an xbComplexType that is part of the XML Document
will only update the :XMLArray and :VarList iVars, but not the :eDocument
iVar, which contains the (original) XML text.

It will also leave the :IsEncoded iVar set to TRUE, which apparently
controls how the :AsString() method works.

Because :IsEncoded is TRUE, the :AsString() method just prints the
(unchanged) :eDocument iVar, rather than re-parsing :XMLArray or VarList.

There is an easy workaround for this, though:

Before using oXML:AsString(), add the following two lines:

oXML:AddVar("Unique_Dummy_Variable_Not_Otherwise_Used", "")

The first line will add a new (empty) Variable to the XML Document, which
will set the :IsEncoded iVar to FALSE. The second line removes that new
variable again.

Because the :IsEncoded iVar is now FALSE, the :AsString() method will
re-parse the XML Document and update the :eDocument iVar, which it will
then return. It will also set the :IsEncoded iVar back to TRUE, so that the
next time the :AsString() method is called, it will just return the existing
:eDocument iVar, to save time.

Hope that helps,

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927

Recent messages in this thread
-# Re: Setvar in xmldocument Kiron Joseph 04-Mar-2020 06:15 am
.-# Re: Setvar in xmldocument (Current message) Andreas Gehrs-Pahl 04-Mar-2020 03:13 pm
..|# Re: Setvar in xmldocument Osvaldo Ramirez 04-Mar-2020 08:09 pm
..-# Re: Setvar in xmldocument Andreas Gehrs-Pahl 04-Mar-2020 09:28 pm
...\# Re: Setvar in xmldocument Boris Borzic <bb> 04-Mar-2020 10:27 pm