@Override protected boolean parseInner(XmlPullParser parser, Instance instance) throws Exception { if (super.parseInner(parser, instance)) return true; if (getValueName().equals(parser.getName())) { instance.setValue(ProviderUtils.parseText(parser)); return true; } return false; }
@Override protected boolean parseInner(XmlPullParser parser, Pref instance) throws Exception { if (super.parseInner(parser, instance)) return true; String name = parser.getName(); if (Pref.AUTO_NAME.equals(name)) { Boolean save = ProviderUtils.parseBoolean(parser.getAttributeValue(null, Pref.SAVE_ATTRIBUTE)); if (save != null) { ScopeMode scope = null; try { scope = ScopeMode.fromString(parser.getAttributeValue(null, Pref.SCOPE_ATTRIBUTE)); } catch (NoSuchElementException e) { } instance.setAuto(save, scope); } return false; // Only tag attributes has bee read. } else if (Default.ELEMENT_NAME.equals(name)) { Default value = DefaultProvider.getInstance().provideInstance(parser); if (value.isValid()) instance.setDefault(value); } else if (Item.ELEMENT_NAME.equals(name)) { Item value = ItemProvider.getInstance().provideInstance(parser); if (value.isValid()) instance.addItem(value); } else if (Session.ELEMENT_NAME.equals(name)) { Session value = SessionProvider.getInstance().provideInstance(parser); if (value.isValid()) instance.addSession(value); } else if (Pref.METHOD_NAME.equals(name)) { TypeMode type = null; UseMode use = null; try { type = TypeMode.fromString(parser.getAttributeValue(null, Pref.TYPE_ATTRIBUTE)); } catch (NoSuchElementException e) { } try { use = UseMode.fromString(parser.getAttributeValue(null, Pref.USE_ATTRIBUTE)); } catch (NoSuchElementException e) { } if (type != null && use != null) instance.setMethod(type, use); return false; // Only tag attributes has bee read. } else return false; return true; }