Parsing XML Android - tag parsing

前端 未结 3 1032
天涯浪人
天涯浪人 2021-01-13 17:36

im trying to build an app to read this feed: http://loc.grupolusofona.pt/index.php/?format=feed

Its working just fine, except for the fact that when it reaches the

3条回答
  •  青春惊慌失措
    2021-01-13 18:34

    The problem, I think, is that the tags that are returned by that site all contain sections, not text. Your code for XMLParser.getElementValue only returns values for TEXT nodes. Change this:

    if( child.getNodeType() == Node.TEXT_NODE  ){
        return child.getNodeValue();
    }
    

    to:

    if( child.getNodeType() == Node.TEXT_NODE || child.getNodeType() == Node.CDATA_NODE ){
        return child.getNodeValue();
    }
    

提交回复
热议问题