What does the exact XML look like?

Also, what happens when you put the XML into an XML validator?  
(such as the one at *http://www.w3schools.com/xml/xml_validator.asp*)

Thanks.



On Friday, March 1, 2013 6:13:09 AM UTC-6, Milind wrote:
>
> Dear All,
>
> I am a beginner in Android and I have to develop an application that plays 
> video from YouTube.com. I have playlist and some videos in it so I have to 
> list these videos first. I populated playlists in my list view but I cannot 
> extract videos list in playlist. It is giving me XML parsing exception. Can 
> you help me?
>
> My code is as below.
>
> class YoutubeServices {
>
> private YouTubeService youTubeService;
> private PlaylistLinkFeed feed;
> private List<PlaylistLinkEntry> entries;
> private String urlForPlaylist = "
> http://gdata.youtube.com/feeds/api/users/YpyHr_nAd4lQo3FvQeNo1Q/playlists?v2
> ";
> private String urlToDownloadAtomOfVideo = "
> http://gdata.youtube.com/feeds/api/users/YpyHr_nAd4lQo3FvQeNo1Q/playlists/
> ";
> private String playlist[][] = new String[3][];
> private String playlistVideosList[][] = new String[3][];
>  //One calls this class as below.
> //YoutubeServices m = new YoutubeServices("emailaddress", "password");
> //m.getData();
> //m.getVideosFromPlaylist("PlayListID");
>  public Main(String username, String password) {
> youTubeService = new YouTubeService("App Name", 
> "AI39sixxxxxxxxxxx<<<< This is developers key >>>>xxxxxxxxxxxxxxxxxxxx");
> Log.d("","YouTube Service is created.");
> //youTubeService.setUserCredentials("emailaddress", "password");
> try {
> youTubeService.setUserCredentials(username, password);
>  } catch (AuthenticationException e) {
> Log.d("AuthenticationException", ""+e);
> }
> }
>  public String[][] getData(){
>  try {
> URL playlistUrl = new URL(urlForPlaylist);
> feed = youTubeService.getFeed(playlistUrl, PlaylistLinkFeed.class);
>  entries = feed.getEntries(); 
>  playlist = new String[3][entries.size()];
>  for(int i=0; i<entries.size(); i++){
> playlist[0][i] = entries.get(0).getTitle().getPlainText();
> Log.d("Title ", ""+entries.get(0).getTitle().getPlainText());
>  playlist[1][i] = entries.get(0).getSummary().getPlainText();
> Log.d("Description " , ""+entries.get(0).getSummary().getPlainText());
>  playlist[2][i] = entries.get(0).getId();
> Log.d("ID ", ""+entries.get(0).getId());
>  }
>  } catch (MalformedURLException e) {
> Log.d("MalformedURLException Error ", ""+e);
> } catch (IOException e) {
> Log.d("IOException Error ", ""+e);
> } catch (ServiceException e) {
> Log.d("ServiceException Error ", ""+e);
> }
>  for(int i=0; i<playlist.length; i++){
> for(int j=0; j<playlist[i].length; j++){
> Log.d("", ""+playlist[i][j]);
> }
> }
>  return playlist;
> }
>  public String[][] getVideosFromPlaylist(String playList){
> URL playlistUrl;
> try {
> playlistUrl = new URL(urlToDownloadAtomOfVideo+playList+"?v2");
> Log.d("URL", ""+urlToDownloadAtomOfVideo+playList+"?v2");
>  YouTubeQuery query = new YouTubeQuery(playlistUrl);
>  //Here I have error
> VideoFeed videoFeed = youTubeService.query(query, VideoFeed.class);
>  for(VideoEntry entry : videoFeed.getEntries()){
> Log.d("Title",""+entry.getTitle().getPlainText());
> Log.d("Summery",""+entry.getSummary().getPlainText());
> }
>  } catch (MalformedURLException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> } catch (ServiceException e) {
> e.printStackTrace();
> }
>  return playlistVideosList;
> }
> }
>
>
> Error is as:
>
> com.google.gdata.util.ParseException: [Line 1, Column 307] Invalid root 
> element, expected (namespace uri:local name) of (
> http://www.w3.org/2005/Atom:feed), found (
> http://www.w3.org/2005/Atom:entry
>
> at com.google.gdata.util.XmlParser.throwParseException(XmlParser.java:739)
>
> at com.google.gdata.util.XmlParser.parse(XmlParser.java:702)
>
> at com.google.gdata.util.XmlParser.parse(XmlParser.java:585)
> at com.google.gdata.data.BaseFeed.parseAtom(BaseFeed.java:867)
> at 
> com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:68)
> at 
> com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:39)
> at 
> com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:100)
> at 
> com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:52)
> at 
> com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:66)
> at 
> com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:34)
> at com.google.gdata.client.Service.parseResponseData(Service.java:2165)
> at com.google.gdata.client.Service.parseResponseData(Service.java:2098)
> at com.google.gdata.client.Service.getFeed(Service.java:1136)
> at com.google.gdata.client.Service.getFeed(Service.java:1077)
> at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
> at com.google.gdata.client.Service.query(Service.java:1237)
> at com.google.gdata.client.Service.query(Service.java:1178)
> at in.co.discoverit.atomParsing.Main.getVideosFromPlaylist(Main.java:108)
> at in.co.discoverit.atomParsing.Main.main(Main.java:33)
> Caused by: com.google.gdata.util.ParseException: Invalid root element, 
> expected (namespace uri:local name) of (http://www.w3.org/2005/Atom:feed), 
> found (http://www.w3.org/2005/Atom:entry
> at com.google.gdata.util.XmlParser.startElement(XmlParser.java:811)
> at org.xml.sax.helpers.ParserAdapter.startElement(Unknown Source)
> at 
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown 
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown 
> Source)
> at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
>  
> Source)
> at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown 
> Source)
> at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown 
> Source)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown 
> Source)
> at 
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown 
> Source)
> at 
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
>  
> Source)
> at org.xml.sax.helpers.ParserAdapter.parse(Unknown Source)
> at com.google.gdata.util.XmlParser.parse(XmlParser.java:694)
> ... 17 more
>
> Thank you...
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to