-1

I have an xml file:

      <elements>
      <element form="a">
      <name>azerty</name>
      </element>
      <elements>
      <element form="b">
      <name>qwerty</name></element></elements>

how can i find the name when i enter the form from an EditText or find the form when i enter the name?

thank you in advance

User616263
  • 467
  • 2
  • 9
  • 23

1 Answers1

1

Assuming you're trying to parse a file in res/xml you can use this method.

The XmlPullParser docs have a short example for parsing.

You'd want to read through your xml document, populating a map (or a bidirectional map). This map would allow you to do the lookup multiple times while only parsing the xml file once.

Community
  • 1
  • 1
Matthew
  • 44,826
  • 10
  • 98
  • 87