* @throws SAXException 1. If the attribute tag is not inside an element tag.
* 2. If the name attribute is not valid XML attribute name.
*/
public void begin(String name, String namespace, Attributes attributes) throws SAXException {
AttributeDescriptor descriptor = new AttributeDescriptor();
String nameAttributeValue = attributes.getValue( "name" );
// check that name is well formed
if ( !XMLUtils.isWellFormedXMLName( nameAttributeValue ) ) {
throw new SAXException("'" + nameAttributeValue + "' would not be a well formed xml attribute name.");
}
String qName = nameAttributeValue;
descriptor.setLocalName( nameAttributeValue );
String uri = attributes.getValue( "uri" );
if ( uri != null ) {
descriptor.setURI( uri );
String prefix = getXMLIntrospector().getConfiguration().getPrefixMapper().getPrefix(uri);
qName = prefix + ":" + nameAttributeValue;
}
descriptor.setQualifiedName( qName );
String propertyName = attributes.getValue( "property" );
descriptor.setPropertyName( propertyName );
descriptor.setPropertyType( loadClass( attributes.getValue( "type" ) ) );
if ( propertyName != null && propertyName.length() > 0 ) {
configureDescriptor(descriptor);
} else {
String value = attributes.getValue( "value" );
if ( value != null ) {
descriptor.setTextExpression( new ConstantExpression( value ) );
}
}
Object top = digester.peek();
if ( top instanceof ElementDescriptor ) {