protected void addDescriptor( Descriptor nodeDescriptor ) throws SAXException {
Object top = digester.peek();
if ( top instanceof XMLBeanInfo ) {
log.warn( "It is advisable to put an <addDefaults/> element inside an <element> tag" );
XMLBeanInfo beanInfo = (XMLBeanInfo) top;
// if there is already a root element descriptor then use it
// otherwise use this descriptor
if ( nodeDescriptor instanceof ElementDescriptor ) {
ElementDescriptor elementDescriptor = (ElementDescriptor) nodeDescriptor;
ElementDescriptor root = beanInfo.getElementDescriptor() ;
if ( root == null ) {
beanInfo.setElementDescriptor( elementDescriptor );
} else {
root.addElementDescriptor( elementDescriptor );
}
} else {
throw new SAXException(