我一直在使用 Rome API 相当成功地解析 XML 提要中的数据,但遇到了一些障碍。
给定以下 XML 片段:
uniqueId
2008-11-05T01:32:35Z
http://contentprovider.com"; available="true"/>
Title<br> ...<br> ...<br></entry>
使用 SyndEntryImpl 类,我可以使用其标准方法(getTitle、getPublishedDate、等)来提取标题、id、更新日期等,但还没有找到获取元数据标签的方法(
获取提要条目的字符串表示形式将是一个可接受的解决方案。我可以使用字符串函数来检索信息,但即使这样,我也没有找到一个简单的方法,
过去有人遇到过这个吗
?
I've been using the Rome API to parse data from an XML feed pretty successfully so for, but have run in to a bit of a snag.
Given the following snippet of XML:
<entry>
<id>uniqueId</id>
<updated>2008-11-05T01:32:35Z</updated>
<mm:status xmlns:mm="http://contentprovider.com" available="true"/>
<title>Title</title>
...
...
</entry>
Using the SyndEntryImpl class I'm able to use its standard methods (getTitle, getPublishedDate, etc) to pull the title, id, updated date, etc, but havent figured out a way to get the metadata tag (<mm:status ...).
Getting a string representation of the feed entry would be an acceptable solution as I'd be able to use string functions to retrieve the information, but even with that I havent found an easy method.
Has anyone run in to this in the past?
Thanks.
发布评论
评论(3)
如果您尚未使用它,v1.0RC1 有一些解析修复。 也许尝试升级?
If you're not already using it, v1.0RC1 has several parsing fixes. Maybe try upgrading?
我只是无法使模块方法发挥作用。 只是模块对象不存在。 无论是在 Feed 级别还是入门级别。
幸运的是,方法 feed/entry .getForeignMarkup() 对我有用。
I just couldn't make the module approach work. Simply the module object wasn't there. Either at the feed or entry level.
Luckily the method feed/entry .getForeignMarkup() did work for me.
这是我们代码中的原始类,没有太多解释(但已经晚了!)。
这会解析元素:
rome.properties:
Here is the raw classes from our code without much explanation (but it is late here!).
This parses elements:
rome.properties: