简体   繁体   中英

Special parsing XML with Simple XML

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?

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 eg JSoup , a very good HTML / XML Parser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM