} else if (localName.equals("update"))
} else if ("update".equals(localName))
	public void startElement(		String namespaceURI,		String localName,		String qName,		Attributes atts)		throws SAXException {		// save accumulated character content		if (inModification && charBuf.length() > 0) {			final String normalized =				charBuf.getNormalizedString(FastStringBuffer.SUPPRESS_BOTH);			if (normalized.length() > 0) {				Text text = doc.createTextNode(normalized);				if (stack.isEmpty()) {					//LOG.debug("appending text to fragment: " + text.getData());					contents.add(text);				} else {					Element last = (Element) stack.peek();					last.appendChild(text);				}			}			charBuf.setLength(0);		}		if (namespaceURI.equals(XUPDATE_NS)) {			if (localName.equals("modifications")) {				String version = atts.getValue("version");				if (version == null)					throw new SAXException(						"version attribute is required for "							+ "element modifications");				if (!version.equals("1.0"))					throw new SAXException(						"Version "							+ version							+ " of XUpdate "							+ "not supported.");				return;			}			String select = null;			// variable declaration			if (localName.equals("variable")) {				select = atts.getValue("select");				if (select == null)					throw new SAXException("variable declaration requires a select attribute");				String name = atts.getValue("name");				if (name == null)					throw new SAXException("variable declarations requires a name attribute");				createVariable(name, select);				return;			}			if (localName.equals("append")				|| localName.equals("insert-before")				|| localName.equals("insert-after")				|| localName.equals("remove")				|| localName.equals("rename")				|| localName.equals("update")) {				if (inModification)					throw new SAXException("nested modifications are not allowed");				select = atts.getValue("select");				if (select == null)					throw new SAXException(						localName + " requires a select attribute");				doc = builder.newDocument();				contents = new NodeListImpl();				inModification = true;			} else if (				(localName.equals("element")					|| localName.equals("attribute")					|| localName.equals("text")					|| localName.equals("processing-instruction")					|| localName.equals("comment"))					&& (!inModification))				throw new SAXException(					"creation elements are only allowed inside "						+ "a modification");			// start a new modification section			if (localName.equals("append")) {			    String child = atts.getValue("child");				modification = new Append(broker, documentSet, select, child, namespaces);			} else if (localName.equals("update"))				modification = new Update(broker, documentSet, select, namespaces);			else if (localName.equals("insert-before"))				modification =					new Insert(broker, documentSet, select, Insert.INSERT_BEFORE, namespaces);			else if (localName.equals("insert-after"))				modification =					new Insert(broker, documentSet, select, Insert.INSERT_AFTER, namespaces);			else if (localName.equals("remove"))				modification = new Remove(broker, documentSet, select, namespaces);			else if (localName.equals("rename"))				modification = new Rename(broker, documentSet, select, namespaces);			// process commands for node creation			else if (localName.equals("element")) {				String name = atts.getValue("name");				if (name == null)					throw new SAXException("element requires a name attribute");				int p = name.indexOf(':');				String namespace = "";				String prefix = "";				if (p > -1) {					prefix = name.substring(0, p);					if (name.length() == p + 1)						throw new SAXException(							"illegal prefix in qname: " + name);					name = name.substring(p + 1);					namespace = (String) namespaces.get(prefix);					if (namespace == null) {						throw new SAXException(							"no namespace defined for prefix " + prefix);					}				}				Element elem = doc.createElementNS(namespace, name);				elem.setPrefix(prefix);				if (stack.isEmpty()) {					contents.add(elem);				} else {					Element last = (Element) stack.peek();					last.appendChild(elem);				}				stack.push(elem);			} else if (localName.equals("attribute")) {				String name = atts.getValue("name");				if (name == null)					throw new SAXException("attribute requires a name attribute");				int p = name.indexOf(':');				String namespace = "";				if (p > -1) {					String prefix = name.substring(0, p);					if (name.length() == p + 1)						throw new SAXException(							"illegal prefix in qname: " + name);					name = name.substring(p + 1);					namespace = (String) namespaces.get(prefix);					if (namespace == null)						throw new SAXException(							"no namespace defined for prefix " + prefix);				}				Attr attrib = doc.createAttributeNS(namespace, name);				if (stack.isEmpty())					contents.add(attrib);				else {					Element last = (Element) stack.peek();					last.setAttributeNode(attrib);				}				inAttribute = true;				currentNode = attrib;				// process value-of			} else if (localName.equals("value-of")) {				select = atts.getValue("select");				if (select == null)					throw new SAXException("value-of requires a select attribute");				List nodes;				if (select.startsWith("$")) {					nodes = (List) variables.get(select);					if (nodes == null)						throw new SAXException(							"variable " + select + " not found");				} else					nodes = processQuery(select);				LOG.debug("found " + nodes.size() + " nodes for value-of");				Node node;				for (Iterator i = nodes.iterator(); i.hasNext();) {					node = XMLUtil.copyNode(doc, (Node) i.next());					if (stack.isEmpty())						contents.add(node);					else {						Element last = (Element) stack.peek();						last.appendChild(node);					}				}			}		} else if (inModification) {			Element elem = doc.createElementNS(namespaceURI, qName);			Attr a;			for (int i = 0; i < atts.getLength(); i++) {				a = doc.createAttributeNS(atts.getURI(i), atts.getQName(i));				a.setValue(atts.getValue(i));				elem.setAttributeNodeNS(a);			}			if (stack.isEmpty()) {				contents.add(elem);			} else {				Element last = (Element) stack.peek();				last.appendChild(elem);			}			stack.push(elem);		}	}