Recursively builds the child elements from the given parser until an end tag or end document is found. The end tag is not consumed.
(XmlPullParser parser)
| 221 | The end tag is not consumed. */ |
| 222 | |
| 223 | public void parse(XmlPullParser parser) |
| 224 | throws IOException, XmlPullParserException { |
| 225 | |
| 226 | boolean leave = false; |
| 227 | |
| 228 | do { |
| 229 | int type = parser.getEventType(); |
| 230 | |
| 231 | // System.out.println(parser.getPositionDescription()); |
| 232 | |
| 233 | switch (type) { |
| 234 | |
| 235 | case XmlPullParser.START_TAG : |
| 236 | { |
| 237 | Element child = |
| 238 | createElement( |
| 239 | parser.getNamespace(), |
| 240 | parser.getName()); |
| 241 | // child.setAttributes (event.getAttributes ()); |
| 242 | addChild(ELEMENT, child); |
| 243 | |
| 244 | // order is important here since |
| 245 | // setparent may perform some init code! |
| 246 | |
| 247 | child.parse(parser); |
| 248 | break; |
| 249 | } |
| 250 | |
| 251 | case XmlPullParser.END_DOCUMENT : |
| 252 | case XmlPullParser.END_TAG : |
| 253 | leave = true; |
| 254 | break; |
| 255 | |
| 256 | default : |
| 257 | if (parser.getText() != null) |
| 258 | addChild( |
| 259 | type == XmlPullParser.ENTITY_REF ? TEXT : type, |
| 260 | parser.getText()); |
| 261 | else if ( |
| 262 | type == XmlPullParser.ENTITY_REF |
| 263 | && parser.getName() != null) { |
| 264 | addChild(ENTITY_REF, parser.getName()); |
| 265 | } |
| 266 | parser.nextToken(); |
| 267 | } |
| 268 | } |
| 269 | while (!leave); |
| 270 | } |
| 271 | |
| 272 | /** Removes the child object at the given index */ |
| 273 |
nothing calls this directly
no test coverage detected