attributes.put( qname, newAttribute );
newAttribute.validate( context );
}
}
else
throw new XmlException( "Illegal attribute!" );
seen.add( qname );
}
while( cursor.toNextAttribute() );
}
// Make sure all attributes have been accounted for
for( QName item : attributes.keySet() )
{
if( !seen.contains( item ) && !attributes.get( item ).getAttribute( "use" ).equals( "optional" ) )
{
if( context.getHandler().callback( ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.ATTRIBUTE,
item, context.getPath(), "Required attribute missing." ) )
{
attributes.get( item ).setAttribute( "use", "optional" );
}
else
throw new XmlException( "Required attribute missing!" );
}
}
cursor.pop();
if( !cursor.toFirstChild() )
cursor.toFirstContentToken();