Search code examples
xmlweb-servicesapache-flexflash-builder4.5

Flex - Web Service - fullstops being stripped


My Problem: Fullstops are being stripped out from a web-service xml file when the field is in the format: 2.

Detailed Explanation: Using Flash Builder 4.5 I have a Mobile project which uses a web service for it's sync to download and read an XML file which then gets inserted into a local SQLite database.

If I look directly at the XML file in my web browser the data is 100% correct.

The field I'm having problems with is called questionno which often holds data in the format: 2.

Looking at the metadata that has been generated for the objects that field is showing as a String.

However if I put a breakpoint just before database inserts the fullstop from the field has already been stripped out. The only thing I can think of is that it's trying to treat it as a number as 2) works fine.

If I can't get a solution to this issue then I'll just end up doing a string replace on the code that generates the xml file and replace fullstops with brackets.

But it seems strange to me that it's automatically altering the data I feed to it even though it should be acting as a string.


Solution

  • Thanks Shaun, going that route worked a treat. Up-voted your comment.

    Just did a manual str_replace in my PHP (which generates the xml) to replace fullstops with the entity value and then back in my flex code where I needed it (mainly displaying in lists) I added a function (found through google) which will convert entities back to text.

    Included below for anyone else with similar issues.

    temp = temp.replace(/&#\d+;/g, replaceFunc);

    private function replaceFunc():String {

    var s:String = arguments[0];
    s = s.substring(2, s.length - 1);
    s = String.fromCharCode(parseInt(s));
    return s;
    

    }