[Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?

Michael Van Canneyt michael at freepascal.org
Wed Sep 20 20:38:23 CEST 2017



On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:

> On Wed, Sep 20, 2017 at 3:02 PM, Michael Van Canneyt via Lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>>
>>
>> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:
>>
>>> On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus
>>> <lazarus at lists.lazarus-ide.org> wrote:
>>>>
>>>>
>>>> These units work using UTF8. The DOM units use UnicodeString (UTF16).
>>>>
>>>> Given that these units are quite stable in terms of functionality and
>>>> maturity, it may be a good idea to move them to the FCL.
>>>
>>>
>>> Yes, that is my point.
>>> But instead of just moving them, shouldn't they merge as well into a
>>> single unit, ie, only one DOM, XMLRead, and XMLWrite unit?
>>
>>
>> I don't think so, because how will you make the difference between the 2 ?
>> And it's not possible to have optimal code for both cases in 1 set of
>> classes; The idea is that there are no conversions necessary.
>
> And we will continue having two base code to do the same thing?
> Don't you think this is confusing for the users?
>
> What about having just one code but setting the type of string
> (XMLString) to use? (even having Unicode... God)

This is an option, but you'll still have 2 sets of units.

>
> How can I use XPath with laz2_* units then?

Currently not, I think. 
All the more reason to move everything to FCL in a unified codebase.

Or use your suggestion and use something like

Type
{$IFDEF XMLUTF8}
  XMLString = UTF8String;
{$ELSE}
  XMLString = unicodestring;
{$ENDIF}

should do the job. I will have a look at this; the only thing that must
then be properly checked is the actual reading and writing...

Michael.


More information about the Lazarus mailing list