1

In my Android application I need to parse xml like this:

<items>
    <item title="@string/item1" />
    <item title="@string/item2" />
</items>

I'd like to use simplexml for parsing.

But I cannot find anything about parsing resources ids in attributes. Is it possible to parse title attribute as int?

IMSoP
  • 89,526
  • 13
  • 117
  • 169
darja
  • 4,985
  • 9
  • 33
  • 47
  • do you need R.string.item1 value? If yes, this will work http://stackoverflow.com/questions/3042961/how-can-i-get-the-resource-id-of-an-image-if-i-know-its-name – logcat Jun 13 '12 at 08:58
  • Yes, now I do something like this. But I want simplexml to read int value for me, but not to resolve id each time for myself. – darja Jun 13 '12 at 09:08
  • Looks like custom Filter implementation may work for you http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#template – logcat Jun 13 '12 at 09:22

1 Answers1

1

Yes, in SAXparser's startElement() you will have a parameter named attributes.

see this example

Community
  • 1
  • 1
Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115