2

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

Hamid
  • 4,410
  • 10
  • 43
  • 72

2 Answers2

2

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.

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

check this out-

Working with XML on Android

Tejas C
  • 383
  • 2
  • 7
  • Thanks. I'v seen this page before and been through it a couple of times. I decided to go for SAX in the end. – Hamid Feb 22 '11 at 08:56