SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru mwolfe's Avatar
    Join Date
    Mar 2005
    Posts
    912
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xml parsing help

    alright i have an ajax script that requests data from a database. Some of the fields contain html. I would like to know the easiest way to parse an xml file that looks like such:

    Code:
    <response>
    <poster>Poster name here</poster>
    <title>Title goes here, may contain a link</title>
    <text>html content here</text>
    </response>
    i can't seem to figure out an easy way of parsing all the contents between a tag, what is the easiest way? I'm trying to fix a script that doesnt work when the text area contains html and i can't get it to work

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Have you ever used the DOM (Document Object Model)?

  3. #3
    SitePoint Guru mwolfe's Avatar
    Join Date
    Mar 2005
    Posts
    912
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah i have used the DOM some but not a whole lot. It seems like i keep getting "undefined elements" and crap and it just doesnt seem to parse out well.. then the whole ajax stuff stops working altogether.. maybe i should just not use the DOM at all, seems like it might be easier to just pass the body (html) in a seperate request or something as i think the problem lies in the fact that the html might not be 100% compliant.... i dunno

  4. #4
    SitePoint Guru mwolfe's Avatar
    Join Date
    Mar 2005
    Posts
    912
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it looks like it is failing on an ampersand used to make a space (&nbsp)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •