XMLStreamReader skips element with no attribute

606 views Asked by At

I have an XMLStreamReader and when I go thorough the xml it skips one element and goes to the next. I would like to read everything in order so this for me is very annoying and ruins my parsing.

This is the XML:

    <bar>Chaps        
        <drink>
            <search>
                    <containgLetter>ri</containgLetter>
            </search>
        </drink>
    <bar>

This is the what i get the order of the tags

  • bar
  • drink
  • containingLetter

What I want is

  • bar
  • drink
  • search
  • containingLetter

I want to know how to read the tag search and make sure that its included

1

There are 1 answers

0
jtahlborn On

My guess would be that you are attempting to process the text content of the elements and are inadvertently swallowing the start element event for the search element. (of course, since you've included no code, that's just a guess).