/** * Sets the Handler for the Child LDAPXMLHandler, it expects only * one handler for each code base. * @param handler This handler for specific child element. */ protected final void setchildelement(LDAPXMLHandler handler) { if (state != INIT) throw new IllegalStateException("setchildelement"); m_handler_map.put(handler.getName(), handler); } /**
/** * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) */ public void endElement(String uri, String localName, String qName) throws SAXException { // Kind of assertion if (!localName.equals(currenthandler.getName())) { throw new SAXException("Invalid System State"); } currenthandler.value(buffer); // Reset StringBuffer. buffer.delete(0, buffer.length()); currenthandler.endElement(); //Pop the element. currenthandler = (LDAPXMLHandler) Handlerstack.pop(); super.endElement(uri, localName, qName); }
/** * This method is used to set the Deserialized Object and it also calls * the parent LDAPXMLHandler (if not null), returning the value using * addValue() * @param data Object data. * @see #addValue(String, Object) */ protected final void setObject(Object data) { if ((state != START) && (state != CHILDELEMENT)) throw new IllegalStateException("setObject"); resultantObject = data; if (getParent() != null) { getParent().addValue(getName(), data); } } }
/** * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) */ public void startElement( String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Handlerstack.push(currenthandler); if (currenthandler == null) { currenthandler = defaulthandler; } else { currenthandler = currenthandler.nextHandler(localName); } //process Elements. if (!localName.equals(currenthandler.getName())) { throw new SAXException("Unknown tag:" + localName); } currenthandler.startElement(); currenthandler.handleAttributes(attributes); }