reader.getXMLStreamReader().close();
// Test writing
Element element = new Element("map", "urn:test");
Document doc = new Document(element);
JDOMWriter writer = new JDOMWriter(element);
type.writeObject(m, writer, new MessageContext());
writer.close();
assertValid("/t:map/t:entry[1]/t:key[text()='key1']", element);
assertValid("/t:map/t:entry[1]/t:value[text()='value1']", element);
assertValid("/t:map/t:entry[2]/t:key[text()='key2']", element);
assertValid("/t:map/t:entry[2]/t:value[text()='value2']", element);
Element types = new Element("types", Namespace.getNamespace("xsd", SoapConstants.XSD));
Element schema = new Element("schema", Namespace.getNamespace("xsd", SoapConstants.XSD));
types.addContent(schema);
doc = new Document(types);
type.writeSchema(schema);
assertValid("//xsd:complexType[@name='map']", doc);
assertValid("//xsd:complexType[@name='map']/xsd:sequence/xsd:element[@name='entry']", doc);