我如何获得MediaEntryModuleImpl.metadata.thumbnail[0].url
"MediaEntryModuleImpl.player=null
MediaEntryModuleImpl.interface=interface
com.sun.syndication.feed.module.mediarss.MediaModule
MediaEntryModuleImpl.uri=http://search.yahoo.com/mrss/
MediaEntryModuleImpl.metadata.hash=null
MediaEntryModuleImpl.metadata.descriptionType=null
MediaEntryModuleImpl.metadata.copyright=null
MediaEntryModuleImpl.metadata.copyrightUrl=null
MediaEntryModuleImpl.metadata.title=null
MediaEntryModuleImpl.metadata.thumbnail[0].time=null
MediaEntryModuleImpl.metadata.thumbnail[0].height=null
MediaEntryModuleImpl.metadata.thumbnail[0].width=320
MediaEntryModuleImpl.metadata.thumbnail[0].url=http://whatever.com/wp-content/uploads/2013/11/mes1-300x186.png
MediaEntryModuleImpl.metadata.description=null
MediaEntryModuleImpl.metadata.titleType=null"
答案 0 :(得分:4)
您应该使用Properties来解析此配置文件并获取属性MediaEntryModuleImpl.metadata.thumbnail[0].url
修改强>
String config = "MediaEntryModuleImpl.player=null\n" +
"MediaEntryModuleImpl.interface=interface\n" +
"com.sun.syndication.feed.module.mediarss.MediaModule\n" +
"MediaEntryModuleImpl.uri=http://search.yahoo.com/mrss/\n" +
"MediaEntryModuleImpl.metadata.hash=null\n" +
"MediaEntryModuleImpl.metadata.descriptionType=null\n" +
"MediaEntryModuleImpl.metadata.copyright=null\n" +
"MediaEntryModuleImpl.metadata.copyrightUrl=null\n" +
"MediaEntryModuleImpl.metadata.title=null\n" +
"MediaEntryModuleImpl.metadata.thumbnail[0].time=null\n" +
"MediaEntryModuleImpl.metadata.thumbnail[0].height=null\n" +
"MediaEntryModuleImpl.metadata.thumbnail[0].width=320 \n" +
"MediaEntryModuleImpl.metadata.thumbnail[0].url=http://whatever.com/wp-content/uploads/2013/11/mes1-300x186.png\n" +
"MediaEntryModuleImpl.metadata.description=null\n" +
"MediaEntryModuleImpl.metadata.titleType=null";
Properties properties = new Properties();
properties.load(new StringReader(config));
System.out.println(properties.get("MediaEntryModuleImpl.metadata.thumbnail[0].url"));
您可以在此处在线试用:http://ideone.com/F5ZybD