assertEquals(EXPECTED, map);
}
public void testManual() throws Exception
{
SchemaBinding schema = new SchemaBinding();
// Type declarations
TypeBinding mapType = new TypeBinding();
// default model group is all, we want sequence
mapType.setParticle(new ParticleBinding(new SequenceBinding(schema)));
TypeBinding entry1Type = new TypeBinding();
TypeBinding entry2Type = new TypeBinding();
TypeBinding entry3Type = new TypeBinding();
TypeBinding entry4Type = new TypeBinding();
// Schema assembling
mapType.addElement(QNAME_ENTRY1, entry1Type, 0, true);
mapType.addElement(QNAME_ENTRY2, entry2Type, 0, true);
mapType.addElement(QNAME_ENTRY3, entry3Type, 0, true);
mapType.addElement(QNAME_ENTRY4, entry4Type, 0, true);
// sequence as entry
SequenceBinding entrySeq = new SequenceBinding(schema);
ElementBinding keyElement = new ElementBinding(schema, new QName(NS, "key"), new TypeBinding());
entrySeq.addParticle(new ParticleBinding(keyElement));
ElementBinding valueElement = new ElementBinding(schema, new QName(NS, "value"), new TypeBinding());
entrySeq.addParticle(new ParticleBinding(valueElement));
ParticleBinding entryParticle = new ParticleBinding(entrySeq);
entryParticle.setMinOccurs(0);
entryParticle.setMaxOccursUnbounded(true);
mapType.addParticle(entryParticle);
mapType.addElement(QNAME_SUBMAP, mapType, 0, true);
schema.addElement(QNAME_MAP, mapType);
// Handler implementations
mapType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)