public Object end(final String uri,
final String localName,
final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
FunctionDescr functionDescr = ( FunctionDescr ) parser.getCurrent();
final NodeList parameters = element.getElementsByTagName( "parameter" );
for ( int i = 0, length = parameters.getLength(); i < length; i++ ) {
final String identifier = ((Element)parameters.item( i )).getAttribute( "identifier" );
final String type = ((Element)parameters.item( i )).getAttribute( "type" );
emptyAttributeCheck("parameter", "identifier", identifier, parser);
emptyAttributeCheck("parameter", "type", type, parser);
functionDescr.addParameter( type,
identifier );
}
// we allow empty, "", bodies - but make sure that we atleast have a body element
NodeList list = element.getElementsByTagName( "body" );
if ( list.getLength() == 0 ) {
throw new SAXParseException( "function must have a <body>",
parser.getLocator() );
}
functionDescr.setText( ((org.w3c.dom.Text)list.item( 0 ).getChildNodes().item( 0 )).getWholeText() );
final PackageDescr packageDescr = (PackageDescr) parser.getData();
packageDescr.addFunction( functionDescr );