I have sample xml string
<root><a>textA</a><b>textB</b></root>
I want to split/traverse this xml using java split function to have an array where each element and its values are placed one after the other, so that I could manipulate them easily.
I tried
split("(?=<)|(?<=>)")
but this is returning me root elements as well as closing tags in the array along with one element (additional space string ). Thanks in advance (Option of chosing XML parser is not feasible right now ).