type.setSchemaType(new QName("urn:test", "test"));
XmlSchema schema = newXmlSchema("urn:test");
type.writeSchema(schema);
XmlSchemaSerializer ser = new XmlSchemaSerializer();
Document doc = ser.serializeSchema(schema, false)[0];
addNamespace("xsd", SOAPConstants.XSD);
assertValid("//xsd:simpleType[@name='test']/xsd:restriction[@base='xsd:string']", doc);
assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='VALUE1']", doc);
assertValid("//xsd:restriction[@base='xsd:string']/xsd:enumeration[@value='VALUE2']", doc);
}