Android, XML parsing similar to E4X?
I am working on a project in Android now that involves parsing XML开发者_开发问答 from a local file.
I have done XML work extensiely in flex and have become used to the power and flexibility of E4X and it's capabilities. I wonder now if I can do something similar in android or will I be forced to parse the XML manually?
Thanks
Quoting @Andreas_D:
E4X is a language extension, XML is treated like a primitive. E4X is not just for parsing XML, it's using XML as real types.
This can't be simulated or done with a Java 'framework', it would require a language extension for Java.
And, since Android does not have JAXB, you don't have that, either.
You have your choice of DOM, SAX, and the XmlPullParser
, plus any third-party Java libraries you can find that have been ported to Android and fit whatever size constraints you may have.
check this out-
Working with XML on Android
精彩评论