seen.put( item, 0 );
for( QName item : sequence )
seen.put( item, seen.get( item ) + 1 );
for( Map.Entry<QName, Integer> entry : seen.entrySet() )
{
Particle particle = particles.get( entry.getKey() );
if( Integer.parseInt( particle.getAttribute( "minOccurs" ) ) > entry.getValue() )
{
if( context.getHandler().callback( ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.ELEMENT,
entry.getKey(), context.getPath(), "Element occurs less times than required." ) )
{
particle.setAttribute( "minOccurs", entry.getValue().toString() );
}
else
throw new XmlException( "Element '" + entry.getKey().getLocalPart()
+ "' required at least minOccurs times!" );
}
if( !particle.getAttribute( "maxOccurs" ).equals( "unbounded" )
&& Integer.parseInt( particle.getAttribute( "maxOccurs" ) ) < entry.getValue() )
{
if( context.getHandler().callback( ConflictHandler.Event.MODIFICATION, ConflictHandler.Type.TYPE,
new QName( schema.getNamespace(), context.getAttribute( "typeName" ) ), context.getPath(),
"Element occurs more times than allowed." ) )
{
particle.setAttribute( "maxOccurs", entry.getValue().toString() );
}
else
throw new XmlException( "Element '" + entry.getKey().getLocalPart()
+ "' must not occur more than maxOccurs times!" );
}