if ( !module.getModuleNameSpace( id ).canContain( name ) )
if ( module.getNameSpace( id ).contains( name ) )
	protected boolean addToSlot( DesignElement container, int slotID,			DesignElement content )	{		ElementDefn containerDefn = (ElementDefn) container.getDefn( );		ElementDefn contentDefn = (ElementDefn) content.getDefn( );		// The following conditions should not occur in the parser --		// they indicate parser design errors since they can be prevented		// with the right syntax checks.		assert containerDefn.isContainer( );		SlotDefn slotInfo = (SlotDefn) containerDefn.getSlot( slotID );		assert slotInfo != null;		assert slotInfo.canContain( content );		// If this is a single-item slot, ensure that the slot is empty.		if ( !slotInfo.isMultipleCardinality( )				&& container.getSlot( slotID ).getCount( ) > 0 )		{			handler.getErrorHandler( ).semanticError(					new ContentException( container, slotID,							ContentException.DESIGN_EXCEPTION_SLOT_IS_FULL ) );			return false;		}		// The name should not be null if it is required. The parser state		// should have already caught this case.		String name = content.getName( );		assert !StringUtil.isBlank( name )				|| contentDefn.getNameOption( ) != MetaDataConstants.REQUIRED_NAME;		// Disallow duplicate names.		Module module = handler.getModule( );		if ( name == null				&& contentDefn.getNameOption( ) == MetaDataConstants.REQUIRED_NAME )		{			handler.getErrorHandler( ).semanticError(					new NameException( container, name,							NameException.DESIGN_EXCEPTION_NAME_REQUIRED ) );			return false;		}		int id = contentDefn.getNameSpaceID( );		if ( name != null				&& id != MetaDataConstants.NO_NAME_SPACE				&& !( container instanceof Theme && slotID == Theme.STYLES_SLOT ) )		{			NameSpace ns = module.getNameSpace( id );			if ( !module.getModuleNameSpace( id ).canContain( name ) )			// if ( module.resolveElement( name, id ) != null )			{				handler.getErrorHandler( ).semanticError(						new NameException( container, name,								NameException.DESIGN_EXCEPTION_DUPLICATE ) );				return false;			}			DesignElement parent = content.getExtendsElement( );			if ( id == Module.ELEMENT_NAME_SPACE && parent != null )			{				if ( parent.getContainerSlot( ) != Module.COMPONENT_SLOT )				// if ( !module.getSlot( Module.COMPONENT_SLOT ).contains(				// parent ) )				{					handler							.getErrorHandler( )							.semanticError(									new ExtendsException(											content,											content.getElementName( ),											ExtendsException.DESIGN_EXCEPTION_PARENT_NOT_IN_COMPONENT ) );					return false;				}			}			ns.insert( content );		}		// Add the item to the element ID map, check whether the id is unique		// if the element has no ID, we will allocate it in the endDocument		long elementID = content.getID( );		if ( elementID > 0 )		{			DesignElement element = module.getElementByID( elementID );			// the content never add to the container before			assert element != content;			if ( element == null )				module.addElementID( content );			else			{				handler						.getErrorHandler( )						.semanticError(								new DesignParserException(										new String[]{content.getIdentifier( ),												element.getIdentifier( )},										DesignParserException.DESIGN_EXCEPTION_DUPLICATE_ELEMENT_ID ) );				return false;			}		}		// Add the item to the container.		container.getSlot( slotID ).add( content );		// Cache the inverse relationship.		content.setContainer( container, slotID );		return true;	}