Fix unexpected EOF handling by KXmlParser.

Avoid read position slipping beyond limit on EOF, causing an
ArrayIndexOutOfBoundsException.

Also fix two incorrect checks whether to read more data.

Bug: 9012715
Change-Id: I40f60becd97eb4d9f33842bea2c19e9dc531d3b7