node.setAttributes((short) attributes.getLength()); if (prefixes.size() > 0) node.setPrefixes(prefixes);
node.setAttributes((short) attrLength); if (nsMappings != null && nsMappings.size() > 0) { node.setNamespaceMappings(nsMappings); nsMappings.clear(); }
	public void startElement(String namespace, String name, String qname, Attributes attributes) {		ElementImpl last = null;		ElementImpl node = null;		if (!stack.empty()) {			last = (ElementImpl) stack.peek();			if (charBuf != null && charBuf.length() > 0) {				// mixed element content: don't normalize the text node, just check				// if there is any text at all				final XMLString normalized = charBuf.normalize(normalize);				if (normalized.length() > 0) {					text.setData(charBuf);					text.setOwnerDocument(document);					last.appendChildInternal(text);					if (!validate)						broker.store(text, currentPath);					text.clear();					charBuf.reset();				}			}			if (!usedElements.isEmpty()) {				node = (ElementImpl) usedElements.pop();				node.setNodeName(qname);			} else				node = new ElementImpl(qname);			last.appendChildInternal(node);			node.setOwnerDocument(document);			node.setAttributes((short) attributes.getLength());			if (prefixes.size() > 0)				node.setPrefixes(prefixes);			stack.push(node);			currentPath.append('/').append(qname);			if (!validate) {				broker.store(node, currentPath);			}		} else {			if (validate)				node = new ElementImpl(0, qname);			else				node = new ElementImpl(1, qname);			rootNode = node;			node.setOwnerDocument(document);			node.setAttributes((short) attributes.getLength());			if (prefixes.size() > 0)				node.setPrefixes(prefixes);			stack.push(node);			currentPath.append('/').append(qname);			if (!validate) {				broker.store(node, currentPath);			}			document.appendChild(node);		}		level++;		if (document.getMaxDepth() < level)			document.setMaxDepth(level);		int attrLength = attributes.getLength();		String attrQName;		String attrPrefix;		String attrNS;		for (int i = 0; i < attributes.getLength(); i++) {			attrNS = attributes.getURI(i);			attrQName = attributes.getQName(i);			// skip xmlns-attributes and attributes in eXist's namespace			if (attrQName.startsWith("xmlns")				|| attrNS.equals("http://exist.sourceforge.net/NS/exist"))				--attrLength;			else {				final AttrImpl attr = new AttrImpl(attrQName, attributes.getValue(i));				attr.setOwnerDocument(document);				if (attributes.getType(i).equals("ID"))					attr.setType(AttrImpl.ID);				node.appendChildInternal(attr);				if (!validate)					broker.store(attr, currentPath);			}		}		if (attrLength > 0)			node.setAttributes((short) attrLength);		// notify observers about progress every 100 lines		currentLine = locator.getLineNumber();		if (!validate) {			progress.setValue(currentLine);			if (progress.changed()) {				setChanged();				notifyObservers(progress);			}		}	}