Results 1 to 4 of 4
  1. #1
    fireportal is offline Member
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Default Retrieving double quotation marks from xml using java

    Hi, i am new to java and currently have this code and it does not seem able to retrieve information from twitters containing double quotations. It will cut off the remarks. Not sure how to include those comments in too.
    Java Code:
    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    
                InputStream in = new URL("URL to twitter search but cant show --twitter.com/search.atom?q=" + search + "&page=1&rpp=100").openStream();
                
                XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
           
                boolean inEntry = false;
                Item currentItem = null;
                
                while (eventReader.hasNext()) {      
                   XMLEvent event = eventReader.nextEvent();
                   
                
                   if (event.isStartElement()) {
                	   StartElement startElement = event.asStartElement();
                
                       if (event.asStartElement().getName().getLocalPart().equals("title")) {
                    	   event = eventReader.nextEvent();
                    	
                    	   String title = event.asCharacters().getData();
                    	   
                    	   if (!inEntry) {
                    		   channel.setTitle(title);//false
                    	   } else {
                    		   currentItem.setTitle(title);//true
                    	   }
                    	                          
                           continue;
    Think it is in my code but have no idea why. Tried to print out the items retrieved.
    When i reach here


    Java Code:
    while (eventReader.hasNext()) {      
                   XMLEvent event = eventReader.nextEvent();

    When print out event, the full content can still be seen. But when i reach here:
    Java Code:
     
     if (event.isStartElement()) {
                	   StartElement startElement = event.asStartElement();

    The sentences with the double quotation seems to have disappeared.

    Any help would be appreciated. Thanks. Currently using eclipse, java.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    fireportal is offline Member
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Default Sorry for the trouble caused

    Sorryy thought it is a different forum, does not realise that they are linked

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default

    Cross posting itself isn't a problem, but it's good to point out that you have posted on another forum in case it's answered over there...saves someone here answering when it's already been done.

Similar Threads

  1. (Java newbie) retrieving data from a web site
    By idum in forum Networking
    Replies: 4
    Last Post: 10-12-2009, 07:37 PM
  2. run java application from desktop with double click
    By Rose88 in forum Advanced Java
    Replies: 4
    Last Post: 09-29-2009, 06:32 PM
  3. double and float value in java
    By arvindmer in forum New To Java
    Replies: 6
    Last Post: 05-28-2009, 04:51 PM
  4. Double.valueOf() vs Double.parseDouble()
    By greenbean in forum New To Java
    Replies: 10
    Last Post: 01-12-2009, 08:39 AM
  5. Replies: 1
    Last Post: 12-28-2008, 10:25 AM

Tags for this Thread

Posting Permissions

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