throws SAXException
{
_character = false;
String qName;
String value;
AnyNode tempNode = null;
//Namespace handling code to be moved once we integrate
//the new event API
/////////////////NAMESPACE HANDLING/////////////////////
_context = _context.createNamespaces();
String prefix = "";
String namespaceURI = null;
int idx = name.indexOf(':');
if (idx >= 0) {
prefix = name.substring(0,idx);
}
namespaceURI = _context.getNamespaceURI(prefix);
//--Overhead here since we process attributes twice
for (int i=0; i<atts.getLength(); ++i) {
qName = atts.getName(i);
value = atts.getValue(i);
String nsPrefix = null;
if (qName.startsWith(XMLNS_PREFIX)) {
//handles namespace declaration
// Extract the prefix if any
nsPrefix = (qName.equals(XMLNS_PREFIX))?null:qName.substring(XMLNS_PREFIX_LENGTH);
tempNode = new AnyNode(AnyNode.NAMESPACE, getLocalPart(qName), nsPrefix, value, null);
_context.addNamespace(nsPrefix, value);
_namespaces.push(tempNode);
if (prefix.equals(nsPrefix))
namespaceURI = value;
}
}
////////////////////////END OF NAMESPACE HANDLING///////////////
createNodeElement(namespaceURI, getLocalPart(name), name);
while (!_namespaces.empty()) {
tempNode = (AnyNode)_namespaces.pop();
_node.addNamespace(tempNode);
}
//process attributes
for (int i=0; i<atts.getLength(); ++i) {
qName = atts.getName(i);
value = atts.getValue(i);
//Namespace handling already done
if (!qName.startsWith(XMLNS_PREFIX)) {
tempNode = new AnyNode(AnyNode.ATTRIBUTE, getLocalPart(qName), null, null, value);
_node.addAttribute(tempNode);
}
}
tempNode = null;
}