/** * Creates an new handler for a gm:value tag. * * @param attrs XML attributes for the gm:value tag */ private AddValueHandler(Attributes attrs) throws IOException, ParseException { AttributeHelper helper = new AttributeHelper(attrs); this.count = helper.consumeInteger("count", false, 0); helper.assertAllConsumed(); }
/** * Creates an new handler for a gm:value tag. * * @param attrs XML attributes for the gm:value tag */ private AddValueHandler(Attributes attrs) throws IOException, ParseException { AttributeHelper helper = new AttributeHelper(attrs); this.count = helper.consumeInteger("count", false, 0); helper.assertAllConsumed(); }
public StatsSubElementHandler(Stats.Statistics stat, Attributes attrs) throws ParseException { this.stat = stat; AttributeHelper helper = new AttributeHelper(attrs); stat.setTotal(helper.consumeInteger("total", false, 0)); helper.assertAllConsumed(); }
public StatsSubElementHandler(Stats.Statistics stat, Attributes attrs) throws ParseException { this.stat = stat; AttributeHelper helper = new AttributeHelper(attrs); stat.setTotal(helper.consumeInteger("total", false, 0)); helper.assertAllConsumed(); }
@Override public XmlParser.ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (GoogleBaseNamespaces.GM_URI.equals(namespace) && "source".equals(localName)) { AttributeHelper helper = new AttributeHelper(attrs); stat.setCountBySource(helper.consume("name", true), helper.consumeInteger("count", true)); helper.assertAllConsumed(); } return new XmlParser.ElementHandler(); } }
@Override public XmlParser.ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (GoogleBaseNamespaces.GM_URI.equals(namespace) && "source".equals(localName)) { AttributeHelper helper = new AttributeHelper(attrs); stat.setCountBySource(helper.consume("name", true), helper.consumeInteger("count", true)); helper.assertAllConsumed(); } return new XmlParser.ElementHandler(); } }
@Override public void processEndElement() throws ParseException { /* don't call super.processEndElement() because it doesn't allow text() data */ // consume attributes if (helper != null) { helper.setContent(value); consumeAttributes(helper); helper.assertAllConsumed(); } // validate try { validate(); } catch (IllegalStateException e) { throw new ParseException(e.getMessage(), e); } } }
/** Parses gm:attribute sub-elements. */ @Override public XmlParser.ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (namespace.equals(GoogleBaseNamespaces.GM_URI) && "attribute".equals(localName)) { AttributeHelper helper = new AttributeHelper(attrs); String nameAttr = helper.consume("name", true); GoogleBaseAttributeType typeAttr = GoogleBaseAttributeType .getInstance(helper.consume("type", false)); GmAttribute.Importance importanceAttr = helper .consumeEnum("importance", false, GmAttribute.Importance.class); GoogleBaseAttributeId attributeId = new GoogleBaseAttributeId(nameAttr, typeAttr); addAttribute(attributeId, importanceAttr); helper.assertAllConsumed(); return new XmlParser.ElementHandler(); } else { return super.getChildHandler(namespace, localName, attrs); } } };
/** Parses gm:attribute sub-elements. */ @Override public XmlParser.ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (namespace.equals(GoogleBaseNamespaces.GM_URI) && "attribute".equals(localName)) { AttributeHelper helper = new AttributeHelper(attrs); String nameAttr = helper.consume("name", true); GoogleBaseAttributeType typeAttr = GoogleBaseAttributeType .getInstance(helper.consume("type", false)); GmAttribute.Importance importanceAttr = helper .consumeEnum("importance", false, GmAttribute.Importance.class); GoogleBaseAttributeId attributeId = new GoogleBaseAttributeId(nameAttr, typeAttr); addAttribute(attributeId, importanceAttr); helper.assertAllConsumed(); return new XmlParser.ElementHandler(); } else { return super.getChildHandler(namespace, localName, attrs); } } };