Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Parsing Amazon RSS problem with "title" tag.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to everyone,

First of all I want to say how useful has been in the past this forum to me and thank to all people who collaborates in this website.

Ok here we go with my problem. I'm trying to parse an Amazon RSS Feed like this:

Amazon product

The class in Java which I use is that:



I use this code in an Ebay Feed and works very good, but when I try to parse an Amazon RSS Feed the "title" tag appears in blank, only parses the description (And the photo of the product, because I wrote a class to manage it and works very well).

My problem and question is if anyone could help to me to see how I can to parse the "title" tag because doesn't work. Happens the same with the "link" tag but I think if I know how to parse the "title" I'll be able to fix the "link" problem.

Thanks to everyone and if you need more information about this, I'll post here.

Sincerelly,
Matt
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is the purpose of that TrovuXMLParser class, and where is the API. Since it is responsible for pulling the data out of the DOM we need to see how it works. I don't see what benefit it adds to the built-in tools that ship with Android (except that we all know the built-in ones and can access their documentation).

My suggestion would be to drop whatever the TrovuXMLParser is doing and use:
 
Matt Partner
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help Steve!

I edited the first post with the API I missed, I'm sorry but I'm so new in Java and I forgot a lot of things and how to comment correctly.

TrovuXmlParser class is the class I use to get the XML from the URL:



Here there are the methods I use to parse the diferent kind of information. The getValue is the method used to get the "id, item, liink, title and description". The "img" tag is parsed with an other method and works fine in this Amazon Rss parse.

The idea is once I parsed the XML from the URL then in AmazonXmlParsingActivity I put inside a map the values using getValue.

If you need something more, please tell it to me

I'm sorry for my english, maybe I do a lot of mistakes for my low level :')
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your getElementValue() method is wrong. It assumes the text in all your elements is a CDATA node, but for the title and link it is not - it is a text node.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic