Menu

#12 xml decoder is not fully functional

open
nobody
None
5
2004-01-20
2004-01-20
No

encoded xml like & are not decoded.
The attached patch fixes this:

-Lance

Discussion

  • Greg Heberle

    Greg Heberle - 2005-09-09

    Logged In: YES
    user_id=907773

    Lance,

    Did you attach the patch? I could use it if you have it.

    Greg
    gheberle@pilabs.com

     
  • Lance Uyehara

    Lance Uyehara - 2005-09-09

    Logged In: YES
    user_id=955980

    Try this.

    -Lance

    ==== XmlRpcUtil.cpp#2 (ktext) - XmlRpcUtil.cpp#3 (ktext)
    ==== content
    @@ -205,9 +205,49 @@
    iAmp += xmlEntLen[iEntity]+1;
    break;
    }
    -
    - if (xmlEntity[iEntity] == 0) // unrecognized
    sequence
    - decoded += encoded[iAmp++];
    +
    + // unrecognized sequence
    + if (xmlEntity[iEntity] == 0) {
    + if (encoded[iAmp+1] == '#') {
    + int offset = 2;
    + int value = 0;
    + bool valid = true;
    + bool got_semi = false;
    + while ((iAmp + offset < iSize) &&
    + (valid) && (!got_semi)) {
    + int c = encoded
    [iAmp+offset];
    +
    + if (isdigit(c)) {
    + value = (value * 10) +
    + c - '0';
    + if (value > 0x110000)
    {
    + valid = false;
    + break;
    + }
    + } else if (c == ';') {
    + got_semi = true;
    + } else {
    + valid = false;
    + break;
    + }
    +
    + offset++;
    + }
    + if (!valid) {
    + decoded += encoded
    [iAmp++];
    + } else {
    + if (got_semi) {
    + decoded += value;
    + iAmp += offset;
    + } else {
    + decoded +=
    + encoded[iAmp++];
    + }
    + }
    + } else {
    + decoded += encoded[iAmp++];
    + }
    + }
    } else {
    decoded += encoded[iAmp++];
    }

     
  • Lance Uyehara

    Lance Uyehara - 2005-09-09

    patch file

     
  • Lance Uyehara

    Lance Uyehara - 2005-09-09

    Logged In: YES
    user_id=955980

    Eww. That was oddly formatted. I'm trying an attachmrnt
    again.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.