public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
try {
flushText();
int idx = name.indexOf(':');
String prefix = idx < 0 ? "" : name.substring(0, idx);
ElementNodeBuilder enb = createENB();
startChildInParent(enb);
int uriCode = db.lookup(uri);
int localNameCode = db.lookup(localName);
int prefixCode = db.lookup(prefix);
enb.setName(uriCode, localNameCode, prefixCode);
if (attachTypes) {
int typeUriCode = db.lookup(XQueryConstants.XS_NSURI);
int typeLocalNameCode = db.lookup(BuiltinTypeQNames.UNTYPED_STR);
int typePrefixCode = db.lookup(XQueryConstants.XS_PREFIX);
enb.setType(typeUriCode, typeLocalNameCode, typePrefixCode);
}
if (createNodeIds) {
enb.setLocalNodeId(nodeIdCounter++);
}
enb.startAttributeChunk();
final int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; ++i) {
String aName = atts.getQName(i);
int aIdx = aName.indexOf(':');
int aPrefixCode = db.lookup(aIdx < 0 ? "" : aName.substring(0, aIdx));
int aLocalNameCode = db.lookup(atts.getLocalName(i));
int aUriCode = db.lookup(atts.getURI(i));
String aValue = atts.getValue(i);
tempABVS.reset();
DataOutput tempOut = tempABVS.getDataOutput();
tempOut.write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
tempOut.writeUTF(aValue);
enb.startAttribute(anb);
anb.setName(aUriCode, aLocalNameCode, aPrefixCode);
if (attachTypes) {
int typeUriCode = db.lookup(XQueryConstants.XS_NSURI);
int typeLocalNameCode = db.lookup(BuiltinTypeQNames.UNTYPED_ATOMIC_STR);
int typePrefixCode = db.lookup(XQueryConstants.XS_PREFIX);
anb.setType(typeUriCode, typeLocalNameCode, typePrefixCode);
}
if (createNodeIds) {
anb.setLocalNodeId(nodeIdCounter++);
}
anb.setValue(tempABVS);
enb.endAttribute(anb);
}
enb.endAttributeChunk();
enb.startChildrenChunk();
enbStack.add(enb);
} catch (IOException e) {
e.printStackTrace();
throw new SAXException(e);
}