dsisnero / gdata-scala-client

Automatically exported from code.google.com/p/gdata-scala-client
Apache License 2.0
0 stars 0 forks source link

Private Google Groups Feed Parsing Error #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take a google group that needs authentication like "Tips4Trade"
2. Take the atom feed:
"https://groups.google.com/group/Tips4Trade/feed/atom_v1_0_msgs.xml"
3. Follow steps in section "How to use the library on not-yet-supported
services" of user guide
4. Error while doing "val f = s.query(feed, atomFeed.feedPickler)"

What is the expected output? What do you see instead?
Expected output should be a list of entries (works for public group feeds)
Instead I get this error:
[Fatal Error] :35:6: The string "--" is not permitted within comments.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at tmp.Test.main(Test.scala)
Caused by: org.xml.sax.SAXParseException: The string "--" is not permitted
within comments.
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
    at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknow
n
Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at scala.xml.parsing.FactoryAdapter.loadXML(FactoryAdapter.scala:292)
    at
scala.xml.parsing.NoBindingFactoryAdapter.loadXML(NoBindingFactoryAdapter.scala:
60)
    at scala.xml.XML$.load(XML.scala:64)
    at
com.google.xml.combinators.LinearStore$.fromInputStream(LinearStore.scala:186)
    at com.google.gdata.client.GDataRequest.unpickle(GDataRequest.scala:131)
    at com.google.gdata.Service.query(Service.scala:109)
    at com.google.gdata.Service.query(Service.scala:96)
    at tmp.Test$.<init>(Test.scala:14)
    at tmp.Test$.<clinit>(Test.scala)
    ... 1 more

What version of the product are you using? On what operating system?
version 0.1 on Windows XP, J2SE 1.6, Scala 2.7.1

Please provide any additional information below.

Original issue reported on code.google.com by mushtaq.a on 11 May 2008 at 12:47

GoogleCodeExporter commented 9 years ago
I cannot reproduce it with groups where I'm a member... Could you please post 
the XML
document you get if you connect to that URL
(https://groups.google.com/group/Tips4Trade/feed/atom_v1_0_msgs.xml)? It seems 
the
XML parser is complaining about an invalid comment, I wonder if that's not a 
bug in
the SAX libraries (or the server is generating invalid XML).

Original comment by jagua...@gmail.com on 13 May 2008 at 2:51

GoogleCodeExporter commented 9 years ago

Original comment by jagua...@gmail.com on 13 May 2008 at 2:51

GoogleCodeExporter commented 9 years ago
Here is the file.

Original comment by mushtaq.a on 14 May 2008 at 4:00

Attachments:

GoogleCodeExporter commented 9 years ago
This is weird, this file is successfully parsed on my machine. Can you try the
following, in the Scala interpreter:

scala> val input = LinearStore.fromFile("atom_v1_0_msgs.xml")
scala> import com.google.gdata.data._
import com.google.gdata.data._

scala> val feed = new StdAtomFeed
feed: com.google.gdata.data.StdAtomFeed = 
com.google.gdata.data.StdAtomFeed@4078ee

scala> feed.feedPickler.unpickle(input)
res4: com.google.xml.combinators.Picklers.PicklerResult[feed.Feed] = 
Success(Authors: 
Id: http://groups.google.com/group/Tips4Trade
Title: (Some(text),Tips4Trade Google Group)
Updated: 2008-05-05T18:01:34.000Z
Entries: Entry:
    Authors: (Tips4 Trade,None,Some(tips4tr...@gmail.com))
    Id: Some(http://groups.google.com/group/Tips4Trade/msg/9b6e7d751aaea5d8)
    Title: (Some(text),Platinum ...
scala> 

If that works, try to get the messages that were breaking the library in the 
first
place, and save that file. I assume it is the content of some message in the 
group
that is incorrectly encoded.

Original comment by jagua...@gmail.com on 14 May 2008 at 11:02

GoogleCodeExporter commented 9 years ago
Well, your steps worked for me also. But the actual code doesn't. So I created a
dummy account with membership of this group (will mail you username/password in
separate mail). Here is my snippet:

import com.google.gdata.Service
import com.google.gdata.data.StdAtomFeed 

object GData1 extends Application {
  val s = new Service("comp-test-1.0", "cp") {}
  s.setUserCredentials("USER", "PASSWORD")
  val atomFeed = new StdAtomFeed
  val feed = "http://groups.google.com/group/Tips4Trade/feed/atom_v1_0_msgs.xml"
  val f = s.query(feed, atomFeed.feedPickler)
  println(f.entries.head)
}

Original comment by mushtaq.a on 16 May 2008 at 2:48

GoogleCodeExporter commented 9 years ago
Ok, it looks like a xerces bug:

http://issues.apache.org/jira/browse/XERCESJ-477
http://issues.apache.org/jira/browse/XERCESJ-520

I'm not sure yet if there are any workarounds, I will keep looking.

Original comment by jagua...@gmail.com on 16 May 2008 at 8:58