Problems Parsing XML

Discussion in 'Programming' started by Sushi_Master, Jan 14, 2009.

  1. #1
    I'm a bit of a noob with parsing XML with coldfusion and I could use some help with an issue.

    I'm trying to parse the following XML file;
    http://www.bbc.co.uk/travelnews/tpeg/en/local/rtm/rtm_tpeg.xml

    and I get the following error;

    Character conversion error: "Illegal ASCII character, 0xe9" (line number may be too low).
    The error occurred on line 9.


    I can post my code if this is helpful? But it works fine when parsing a different XML file.

    Any ideas?
     
    Sushi_Master, Jan 14, 2009 IP
  2. Paul_K

    Paul_K Greenhorn

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #2
    Maybey you could show some code.
     
    Paul_K, Jan 14, 2009 IP
  3. Sushi_Master

    Sushi_Master Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The code is very simple;

    
    <cfscript>
     URLToPull  = "http://www.bbc.co.uk/travelnews/tpeg/en/local/rtm/rtm_tpeg.xml";
    </cfscript>
    
    <cfhttp url="#URLToPull#" method="GET" timeout="0"></cfhttp>
    
    <cfscript>
    XMLContent = trim(cfhttp.filecontent);
    XMLContent = XMLParse(XMLContent);
    </cfscript>
    
    <cfdump var="#XMLContent#">
    
    Code (markup):
    I think this should be ignored beacuse coldfusion uses a DOM parser, what ideally needed is a SAX parser due to the size of the XML file and the processing speeds.

    I can't find any documentation online of using the java SAX parser with coldfusion.

    Does anybody have any knowledge on this?
     
    Sushi_Master, Jan 15, 2009 IP
  4. Paul_K

    Paul_K Greenhorn

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #4
    That code actually works fine for me. Perhaps its a charset issue with the server your on?
     
    Paul_K, Jan 15, 2009 IP
  5. denisb_com

    denisb_com Peon

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That should work, but like Paul said, likely charset issue. And I don't encourage using the XMLparse if you're looking to display the output real-time. It's very slow. I've had instances where I'd just store the data from the struct into a table for output provided you don't have to pull data real-time.
     
    denisb_com, Jan 19, 2009 IP
  6. Sushi_Master

    Sushi_Master Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for your help.

    I'm going to try another method to pull in this information by creating a web service and pulling the information in from there.

    This should handle the data much more efficiently.
     
    Sushi_Master, Jan 28, 2009 IP