* the schema
* @throws XMLSchemaFileImportException
*/
private static void readSyntax( Element element, Schema schema ) throws XMLSchemaFileImportException
{
SyntaxImpl syntax = null;
// OID
Attribute oidAttribute = element.attribute( OID_TAG );
if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
{
syntax = new SyntaxImpl( oidAttribute.getValue() );
}
else
{
throw new XMLSchemaFileImportException( "A syntax definition must contain an attribute for the OID." );
}
// Schema
syntax.setSchema( schema.getName() );
// Aliases
Element aliasesElement = element.element( ALIASES_TAG );
if ( aliasesElement != null )
{
List<String> aliases = new ArrayList<String>();
for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
{
Element aliasElement = ( Element ) i.next();
aliases.add( aliasElement.getText() );
}
if ( aliases.size() >= 1 )
{
syntax.setNames( aliases.toArray( new String[0] ) );
}
}
// Description
Element descriptionElement = element.element( DESCRIPTION_TAG );
if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
{
syntax.setDescription( descriptionElement.getText() );
}
// Obsolete
Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
{
syntax.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
}
// Human Readible
Attribute humanReadibleAttribute = element.attribute( HUMAN_READABLE_TAG );
if ( ( humanReadibleAttribute != null ) && ( !humanReadibleAttribute.getValue().equals( "" ) ) )
{
syntax.setHumanReadable( readBoolean( humanReadibleAttribute.getValue() ) );
}
// Adding the syntax to the schema
schema.addSyntax( syntax );
}