Jose,

Yes, please restore it.

Ron

--------------------------------------------------
From: "Jose F. Gimenez" <jfgime...@wanadoo.es>
Sent: Monday, June 22, 2009 3:34 AM
To: "xHarbour-Developers List" <xharbour-developers@lists.sourceforge.net>
Subject: [xHarbour-developers] Big problem with TXML():SetAttribute()

> Hi,
>
> I've found a big problem (in terms of drastic behaviour change) in the
> method SetAttribute() of TXML class. This method was written so:
>
>   METHOD SetAttribute( cAttrib, xValue ) INLINE ::aAttributes[ cAttrib ] 
> :=
> xValue
>
> while now it is written as:
>
> 
> *-----------------------------------------------------------------------------*
>    METHOD SetAttribute( xAttrib, xValue )  CLASS TXmlNode
> 
> *-----------------------------------------------------------------------------*
>    Local lRet := .f.
>
>    if ! empty( xAttrib ) .and. ! empty( xValue )    <<<<<<<< NOTE HERE
>
>       if HB_isString( xAttrib )  // attribute name (key name)
>
>          if HHasKey( ::aAttributes, xAttrib)        <<<<<<<< AND HERE
>             HSet(::aAttributes, xAttrib, xValue )
>             lRet := .t.
>          endif
>
>       elseif HB_isNumeric( xAttrib ) // attribute position (key ordinal
> position)
>
>          if Len( ::aAttributes ) >= xAttrib            <<<<<<<< AND HERE
>             HSetValueAt( ::aAttributes, xAttrib, xValue )
>             lRet := .t.
>          endif
>
>       endif
>
>    endif
>
>    RETURN lRet        <<<<<<<< AND HERE
>
>
> There are several behaviour changes:
>
> a) Now, it's possible to set an attribute using its ordinal position. 
> That's
> good, IMO.
>
> b) Now, it's NOT possible to set a new attribute using this method. It 
> only
> change the previous value, but returns .f. if the attribute name wasn't
> exist. Very bad, IMO.
>
> c) The returned value is now .T. or .F., while before was the setted value
> itself, allowing it to be used in a chain. (F.e. xVal :=
> oXML:SetAttribute( "Attr", Value ) ). IMO, It's not good or bad itself, 
> but
> it's a undesirable behaviour change.
>
> d) Now, if the desired value is "Empty()", then the attribute is not 
> setted.
> It causes that values like .F. or 0 are not setted, while they are 
> perfectly
> valid, IMO.
>
>
> Please, may I change it back to the previous behaviour (respecting a) if 
> you
> want, but reverting b), c) and d) ). Also, if someone need a method to
> change an attribute value without creating it, the actual method can be
> renamed as ChangeAttributeValue() or so.
>
>
> Regards,
>
> Jose F. Gimenez
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge 
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: 
> $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> xHarbour-developers mailing list
> xHarbour-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
> 

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to