[ https://issues.apache.org/jira/browse/NETBEANS-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239321#comment-16239321 ]
ASF GitHub Bot commented on NETBEANS-112: ----------------------------------------- matthiasblaesing commented on issue #241: [NETBEANS-112] Re-integrate DTD for RSS 0.91 feed URL: https://github.com/apache/incubator-netbeans/pull/241#issuecomment-341937684 I'm a bit reluctant to merge this. Quite frankly, it neither no license, nor the create commons license sound like a good idea for a document, that is used as a basis for parsers. For our use case I'd try to stay away from this as far as possible. I propose a different approach: The only really interesting think that is part of the DTD are the entity definitions, that are needed to correctly parse the XML stream. The rest is plain XML and the document structure is already manually handled and the stream is also not validated. From the RSS DTD: > Copied from HTML 3.2 DTD, with modifications (removed CDATA) Now the entities covered by HTML 3.2 are identical with Character entity set of XHTML 1.0 (this is important, as the HTML 3.2 entity definitions are SGML and the XML parser can't read them). That entity definition was already merged into the apache netbeans codebase with #240. So this assumes, that `xhtml-lat1.ent` is copied from `html.editor` to `welcome` module and placed in the `org.netbeans.modules.welcome.resources` package. There are two places where XMLReader are instantiated (one in `RSSFeed.java` and one in `CombinationRSSFeed.java`). My hack does this: ```java reader.setEntityResolver( org.openide.xml.EntityCatalog.getDefault() ); ``` is replaced by: ```java reader.setEntityResolver( new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if("http://my.netscape.com/publish/formats/rss-0.91.dtd".equals(systemId) || "-//Netscape Communications//DTD RSS 0.91//EN".equals(publicId)) { return new InputSource(RSSFeed.class.getResourceAsStream("/org/netbeans/modules/welcome/resources/xhtml-lat1.ent")); } else { return org.openide.xml.EntityCatalog.getDefault().resolveEntity(publicId, systemId); } } } ); ``` So I pretend to handle the XML parser the correct DTD, but that DTD only contains entity definitions and misses the structure information. The structural aspects are handled in `FeedHandler` inside `RSSFeed` which does not depend on the information from the DTD. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Welcome module (RSS) feed broken in donation > -------------------------------------------- > > Key: NETBEANS-112 > URL: https://issues.apache.org/jira/browse/NETBEANS-112 > Project: NetBeans > Issue Type: Bug > Components: ide - Welcome > Reporter: lbruun > Priority: Minor > Labels: pull-request-available > Attachments: NB-2017.png > > > !NB-2017.png! > In Apache NetBeans the RSS feeds in Welcome Page no longer works. Works on > current hg main-silver and works in NB 8.2. > The problem occurs when the downloaded XML has a doctype declaration: > {code:xml} > <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" > "http://my.netscape.com/publish/formats/rss-0.91.dtd"> > {code} > There used to be a "registered" DTD for this in the Welcome module but it was > removed as part of Oracle's cleanup prior to donation. This is why it works > on current hg main-silver, but not on the donated code. > See: > http://hg.netbeans.org/releases/rev/66633aaa2811 > http://hg.netbeans.org/releases/rev/00ff3249694f > Because of the removal, the XML Reader will - in the absence of a registered > DTD - attempt to download the DTD from the Internet, i.e. it will attempt to > download http://my.netscape.com/publish/formats/rss-0.91.dtd, which will fail > because it redirects to {{aol.com}} and there isn't a DTD at that location. > (duh!, I'm actually surprised that {{netscape.com}} still exists and forwards > to {{aol.com}}, it's been 18 years since the acquisition !) > The RSS feed from planetnetbeans.org (right side of screenshot) doesn't have > a DOCTYPE declaration which is why it works. -- This message was sent by Atlassian JIRA (v6.4.14#64029)