0

I have a String like this:

String xml = "<Tag1>Tag One<Tag1><Tag2>Tag Two<Tag2><Fhfuehwalifhre>Bla Bla<Fhfuehwalifhre>"

I want to split this line (without knowing the names of the tags) so that I get a String array like this:

["Tag One"], ["Tag Two"], ["Bla Bla"]

Is there a way to go about doing this in a single line? (Such as xml.split("<*>");, but that does not work.) Or do I need to do it the ugly way and split it by < and > and then weed out the undesireables?

Evorlor
  • 7,263
  • 17
  • 70
  • 141

1 Answers1

3

Use "\<[^\>]+\>" in the split

Hovav
  • 151
  • 2
  • 13