protected static XmlObject[] convert(XmlObject[] xmlObjects, NamespaceElementConverter converter, SchemaType type) throws DeploymentException {
//bizarre ArrayStoreException if xmlObjects is loaded by the wrong classloader
XmlObject[] converted = new XmlObject[xmlObjects.length];
for (int i = 0; i < xmlObjects.length; i++) {
XmlObject xmlObject = xmlObjects[i].copy();
if (xmlObject.schemaType() != type) {
converter.convertElement(xmlObject);
converted[i] = xmlObject.changeType(type);
} else {
converted[i] = xmlObject;
}