Code example for Attributes

Methods: getIndex, getValue

0
    private class DefaultHandlerImpl 
    extends DefaultHandler {
 
        @Override 
        public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException {
            final String classAttr = attributes.getValue("class");
 
            if(classAttr != null) {
                if ((classAttr.indexOf(" map/map ") > -1) ||
                        (classAttr.indexOf(" topic/topic ") > -1)) {
                    if (attributes.getIndex("ditaarch:DITAArchVersion") > -1) {
                        setActiveProjectProperty("ws.runtime.publishing.map.dita.version",attributes.getValue("ditaarch:DITAArchVersion"));
                    } else { 
                        setActiveProjectProperty("ws.runtime.publishing.map.dita.version","132"); 
                    } 
                    /* Successfully found ditaarch, so stop parsing. */ 
                    throw new SAXException("Search finished");
                } 
 
            }