msxml3: IXMLDOMText_get_text return trimmed text when XML_TEXT_NODE

Nikolay Sivov bunglehead at gmail.com
Thu Sep 2 23:52:47 CDT 2010


  On 9/2/2010 14:10, Alexandre Julliard wrote:
> Alexandre Goujon<ale.goujon at gmail.com>  writes:
>
>> @@ -181,6 +181,30 @@ static inline BSTR bstr_from_xmlChar(const xmlChar *str)
>>       return ret;
>>   }
>>
>> +static inline BSTR bstr_trim(const BSTR str)
>> +{
>> +    UINT i, j, len = SysStringLen(str);
>> +    BSTR new_str = NULL;
>> +
>> +    /* str empty or NULL */
>> +    if(!len)
>> +        goto err;
>> +
>> +    for(i=0; isspaceW(str[i])&&  i<len; i++);
>> +    for(j=len-1; isspaceW(str[j])&&  j>=i; j--);
>> +
>> +    new_str = SysAllocStringLen(str+i, j-i+1);
>> +    if(!new_str)
>> +        goto err;
>> +
>> +    SysFreeString(str);
>> +    return new_str;
>> +
>> +    err:
>> +        SysFreeString(str);
>> +        return SysAllocStringLen(NULL, 0);
>> +}
> That's ugly and inefficient, especially since the common case is to not
> modify it.
>
Also this probably depends on ::preserveWhiteSpace() property.



More information about the wine-devel mailing list