gpt4 book ai didi

java - 解析谷歌日历时SAX解析异常

转载 作者:太空宇宙 更新时间:2023-11-04 06:29:20 26 4
gpt4 key购买 nike

我正在使用 GDATA API 来解析 google 日历。日历嵌入在网站中:

http://regreformtracker.aba.com/p/dodd-frank-calendar.html

我从上述网站中使用的 iframe src 中获取了日历 URL:

https://www.google.com/calendar/b/0/embed?showTitle=0&height=600&wkst=1&bgcolor=%23FFFFFF&src=regreform%40aba.com&color=%23182C57&src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&color=%23125A12&src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&color=%23691426&ctz=America%2FNew_York

我正在使用下面提到的代码片段:

 URL feedURL = new URL("https://www.google.com/calendar/b/0/embed?showTitle=0&height=600&wkst=1&bgcolor=%23FFFFFF&src=regreform%40aba.com&color=%23182C57&src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&color=%23125A12&src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&color=%23691426&ctz=America%2FNew_York");
CalendarService service = new CalendarService("TestCalendarFeed");
CalendarEventFeed resultFeed = service.getFeed(feedURL , CalendarEventFeed.class);

我收到 SAXParseException,下面是相同的堆栈跟踪:

[Fatal Error] strict.dtd:81:5: The declaration for the entity "ContentType" must end with '>'.
Oct 13, 2014 2:09:22 PM com.google.gdata.util.LogUtils logException
WARNING: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
Message: The declaration for the entity "ContentType" must end with '>'.

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.data.BaseFeed.parseAtom(Unknown Source)
at com.google.gdata.data.BaseFeed.readFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at com.google.gdata.client.GoogleService.getFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at sample.calendar.TestCalendarFeed.printAllEvents(TestCalendarFeed.java:116)
at sample.calendar.TestCalendarFeed.main(TestCalendarFeed.java:472)
The server had a problem handling your request.
com.google.gdata.util.ParseException: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.data.BaseFeed.parseAtom(Unknown Source)
at com.google.gdata.data.BaseFeed.readFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at com.google.gdata.client.GoogleService.getFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at sample.calendar.TestCalendarFeed.printAllEvents(TestCalendarFeed.java:116)
at sample.calendar.TestCalendarFeed.main(TestCalendarFeed.java:472)
Caused by: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
... 9 more

我不确定错误是什么,请您检查一下并让我知道哪里出了问题?

我尝试使用其他日历(例如我的私有(private)日历)来检查是否是日历 URL 的问题,但即使这样我也遇到了同样的问题。

我还尝试使用 CalendarFeed 类而不是 CalendarEventFeed,但仍然遇到同样的问题。

最佳答案

关于java - 解析谷歌日历时SAX解析异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26353355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com