Code example for Attributes

Methods: toStringgetValue

    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        if(qName.equals("piraso")) {
            id = attributes.getValue("id");
            watchedAddr = attributes.getValue("watched-address");
            fireEntryReadStartedEvent(new EntryReadEvent(this, id, watchedAddr));
        } else if(qName.equals("entry")) {
            try { 
                currentEntryClassName = attributes.getValue("class-name");
                currentEntryDate = mapper.readValue(attributes.getValue("date"), Date.class);
                currentEntryId = Long.valueOf(attributes.getValue("id"));
            } catch (Exception e) {
                LOG.warn(String.format("Unable to parse entry with attributes '%s'", attributes.toString()));
                currentEntryClassName = null;
                currentEntryDate = null; 
                currentEntryId = null;
Stop searching for code, let great code find you!  Add Codota to your java IDE