Domanda

How to parse the XML fragment with SimpleXML in Android?

<txtList>
    message <bold>message</bold> message
</txtList>

In fact, I do not know how to retrieve the value of an element that contains another element in this way?

È stato utile?

Soluzione

You have to write a class with proper fields. Or - and thats what i recommend - you write a class that contains the values and a Transformer which "parses" the XML.

However, Simple XML ist not a XML-Parser, it's a Serializer. So you may have a look at e.g. JSoup, a very good HTML / XML Parser.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top