{
if (BINDING_TAG.equals(tagName)) {
currentBindingName = atts.get(BINDING_NAME_ATT);
if (currentBindingName == null) {
throw new SAXException(BINDING_NAME_ATT + " attribute missing for " + BINDING_TAG + " element");
}
}
else if (URI_TAG.equals(tagName)) {
try {
currentValue = valueFactory.createURI(text);
}
catch (IllegalArgumentException e) {
// Malformed URI
throw new SAXException(e.getMessage());
}
}
else if (BNODE_TAG.equals(tagName)) {
currentValue = valueFactory.createBNode(text);
}
else if (LITERAL_TAG.equals(tagName)) {
String xmlLang = atts.get(LITERAL_LANG_ATT);
String datatype = atts.get(LITERAL_DATATYPE_ATT);
if (datatype != null) {
try {
currentValue = valueFactory.createLiteral(text, valueFactory.createURI(datatype));
}
catch (IllegalArgumentException e) {
// Illegal datatype URI
throw new SAXException(e.getMessage());
}
}
else if (xmlLang != null) {
currentValue = valueFactory.createLiteral(text, xmlLang);
}
else {
currentValue = valueFactory.createLiteral(text);
}
}
else if (RESULT_TAG.equals(tagName)) {
currentSolution = new MapBindingSet(bindingNames.size());
}
else if (VAR_TAG.equals(tagName)) {
String varName = atts.get(VAR_NAME_ATT);
if (varName == null) {
throw new SAXException(VAR_NAME_ATT + " missing for " + VAR_TAG + " element");
}
bindingNames.add(varName);
}
else if (RESULT_SET_TAG.equals(tagName)) {
try {
handler.startQueryResult(bindingNames);
}
catch (TupleQueryResultHandlerException e) {
throw new SAXException(e);
}
}
}