if (skipFirstElement) {
skipFirstElement = false;
return;
}
assert localName != null;
Name nodeName = null;
ElementEntry element;
if (!elementStack.isEmpty()) {
// Add the parent
elementStack.peek().addAsNode();
element = new ElementEntry(elementStack.peek(), currentPath, null);
} else {
element = new ElementEntry(null, currentPath, null);
}
elementStack.addFirst(element);
properties.clear();
Object typePropertyValue = null;
// Convert each of the attributes to a property ...
for (int i = 0, len = attributes.getLength(); i != len; ++i) {
String attributeLocalName = attributes.getLocalName(i);
String attributeUri = attributes.getURI(i);
Name attributeName = null;
if ((attributeUri == null || attributeUri.length() == 0) && attributes.getQName(i).indexOf(':') == -1) {
switch (this.attributeScoping) {
case INHERIT_ELEMENT_NAMESPACE:
attributeName = nameFactory.create(uri, attributeLocalName, decoder);
break;
case USE_DEFAULT_NAMESPACE:
attributeName = nameFactory.create(attributeLocalName, decoder);
break;
}
} else {
attributeName = nameFactory.create(attributeUri, attributeLocalName, decoder);
}
assert attributeName != null;
// Check to see if this is an attribute that represents the node name (which may be null) ...
if (nodeName == null && attributeName.equals(nameAttribute)) {
nodeName = nameFactory.create(attributes.getValue(i)); // don't use a decoder
element.setName(nodeName);
continue;
}
if (typePropertyValue == null && attributeName.equals(typeAttribute)) {
typePropertyValue = nameFactory.create(attributes.getValue(i)); // don't use a decoder
continue;
}
// Create a property for this attribute ...
element.addProperty(attributeName, attributes.getValue(i));