XML feed help please!! urgent....

by 8 replies
9
Ok, so I am getting a feed that has about 2,000 listings on it, it is very important for my business....

I am having to parse out the title of each listing into city and state, as there is actually not a field separate for those 2 items.

There is one big problem with the feed however, the feed is not consistent... Sometimes the city is first in the title, and sometimes the state is first in the title... This is making a lot of the 2,000 listings pop up on incorrect city and state pages on my website...

can someone help me? how can I fix this?
#programming #feed #urgent #xml
  • Lots of ways to approach this one. But really, you might want to post this in the "Programming" subforum.

    Anyway, I'd probably start by doing something like creating an array of states. Then I'd do a search of your city/state field against this list of states. If there's a match, I'd assume that's the state and then I'd assume the rest of the text is the city. If I didn't get a match, I'd flag the record as an error so that I could manually edit it. Something like that at any rate.

    But anyway, it's impossible to really say without seeing your data or knowing what tool(s)/language(s. you're using.
    • [1] reply
    • And I just happen to live in Wyoming, PA (USA), which would totally break that; LOL! (And yes, the state was named after the region in Pennsylvania; source.)
  • my website is mobilehomesforsale.com

    Here is the feed im using...
    https://www.vmfhomes.com/Content/Feeds/rss.xml
  • As kilgore suggested the best approach is to have an array with state values and do a simple check. If the first item is in array, then it is a state, if not it is a city.
  • Are you sure your code is ok ?
    I just tried that feed and it looks state is always in first position.
    Try this [PHP] <?php $xml = simplexml_load_file("https://www.vmfhomes.com/Content/Feeds/rss. - Pastebin.com - it will echo all items where state is not found.
  • Hmm... this is all great info.. I am trying to learn as fast as I can, also going to forward this to my developer guy as a lot of this is over my head...

    However, you can view my state page of Texas for example
    Mobile Homes For Sale In Texas

    Scroll down, and you can see that many listings show up in texas that should not be showing up on this state page....
    • [1] reply
    • It seems more like whatever function that is displaying by city doesn't work correctly.
  • The problem is figured out!! i got it guys. Thanks for advice, it actually led me to diagnose the problem and sit my butt down and figure it out... The bad news is it will take me about 6-12 hours to complelely fix ha...

Next Topics on Trending Feed

  • 9

    Ok, so I am getting a feed that has about 2,000 listings on it, it is very important for my business.... I am having to parse out the title of each listing into city and state, as there is actually not a field separate for those 2 items.