いくつかのタグを含むこの rss フィードを解析します。説明タグ ノードを除くすべての値 (子要素) を取得できます。RSS フィードの下を見つけてください
<fflag>0</fflag>
<tflag>0</tflag>
<ens1:org>C Opera Production</ens1:org>
−
<description>
<p>Opera to be announced</p>
<p>$15 adults/$12 seniors/$10 for college students<span style="white-space: pre;"> </span></p>
</description>
私がこれに使用しているコードは
StringBuffer descriptionAccumulator = new StringBuffer();
else if (property.getNodeName().equals("description")){
try{
String desc = (property.getFirstChild().getNodeValue());
if(property.getNodeName().equals("p")){
descriptionAccumulator.append(property.getFirstChild().getNodeValue());
}
}
catch(Exception e){
Log.i(tag, "No desc");
}
else if (property.getNodeName().equals("ens1:org")){
try{
event.setOrganization(property.getFirstChild().getNodeValue());
Log.i(tag,"org"+(property.getFirstChild().getNodeValue()));
}
catch(Exception e){
}
else if (property.getNodeName().equals("area")||property.getNodeName().equals("fflag") || property.getNodeName().equals("tflag") || property.getNodeName().equals("guid")){
try{
//event.setOrganization(property.getFirstChild().getNodeValue());
Log.i(tag,"org"+(property.getFirstChild().getNodeValue()));
}
catch(Exception e){
}
else if(property.getNodeName().equals("p") || property.getNodeName().equals("em") || property.getNodeName().equals("br") || property.getNodeName().startsWith("em") || property.getNodeName().startsWith("span") || property.getNodeName().startsWith("a") || property.getNodeName().startsWith("div") || property.getNodeName().equals("div") || property.getNodeName().startsWith("p")){
descriptionAccumulator.append(property.getFirstChild().getNodeValue());
descriptionAccumulator.append(".");
System.out.println("description added:"+descriptionAccumulator);
Log.i("Description",descriptionAccumulator+property.getFirstChild().getNodeValue());
}
タグの値をキャプチャしようとしました<description>
が、うまくいかなかったので、使用されている通常の html 書式設定タグをすべて使用してみましたが、まだ方法がありません。他のパーサーを使用することはオプションではありません。誰かがこれで私を助けてくれませんか。ありがとう