XML library reliable?

Jo=?ISO-8859-1?B?6w==?=l Guillod joel.guillod at net2000.ch
Tue Jul 22 00:43:00 EDT 2003


1) Consider that you:

set the htmltext of field 1 to that -- : ...

<p>©2003 by Joël Guillod</p>
<p><font color="#0000FF"><u>joel.guillod at net2000.ch</u></font></p>
<p></p>


2) execute this test script:

    on test
      put "<fld1>" & (the HTMLtext of fld 1) & "</fld1>" into xmldata
      put revCreateXMLTree(xmldata,false,true,false) into fldTreeID
      put revXMLText(fldTreeID,"/fld1",false) into xmlDataRestored
      put xmlData &cr& xmlDataRestored
      revDeleteXMLtree fldTreeID
    end test


3) Why dont I get the same than the original data: i.e. why xmldata is not
xmlDataRestored? The procedure looses the diacritics (the euml for ë and
nothing for the copyright character). I actually get:

<fld1><p>2003 by Jol Guillod
joel.guillod at net2000.ch
</p></fld1>


4) If this is not a bug, please help and point me to some xml rev
documentation. Or it is something to do with the uniEncode() and uniDecode()
functions?
And do *NOT* give another way to do the job (using the RTFText of the field
instead of the htmltext will work but in that case, we will loose the
linktext and imagesource properties of the text and that I actually need
them)!

5) OK, another workaround for preserving html as far as I have tested is:

    on test
      put "<fld1>" & conv(the HTMLtext of fld 1) & "</fld1>" into xmldata
      put revCreateXMLTree(xmldata,false,true,false,"UTF-7") into fldTreeID
      put revXMLNodeContents(fldTreeID,"/fld1") into xmlDataRestored
      put xmlData &cr& xmlDataRestored &cr& the HTMLtext of fld 1 &cr&
revconv(xmlDataRestored)
      revDeleteXMLtree fldTreeID
    end test
    
    function conv d
      return base64encode(compress(d))
    end conv
    
    function revconv d
      return decompress(base64decode(d))
    end revconv
    

6) The problem is that the htmltext of fields is xml based, so including it
in an xml tree and restoring it should work whatever the diacritics,
shouldn't it?


Happy to use RR and hope all users will contribute a bit and more to do it
better and more reliable.


Joël G -- Joël G




More information about the use-livecode mailing list