if ( useValueAsId && ( source.getAttribute( "value" ) == null ))
model.setAttribValue( model.getAttribute( "value" ), source.getAttribute( "id" ));
// Add the children of the source element
for ( int i = 0; i < numChildren; i++ ) {
XmlElement ele = ( XmlElement )children.elementAt( i );
Object elementName = ele.getAttribute( "id" );
// Give a unique id for unnamed elements
if (( elementName == null ) || ( elementName.toString().length() == 0 )) {
if ( useValueAsId )
elementName = ele.getAttribute( "value" );
else {
elementName = String.valueOf( getNextId() );
hasAutoId = true;
}
}
// Create a node/model for the child
XModel childModel = (XModel)model.get( (String)elementName );
// XModel childModel = ( XModel )model.append( ( String )elementName );
// Allocate store for the child's children
childModel.hasAutoId( hasAutoId );
childModel.setNumChildren( Math.max( childModel.getNumChildren(), ele.getChildren().size() ) );
// Recurse to add the childs details
loadTable( ele, childModel );
}
}