static ApplicationClientDocument convertToApplicationClientSchema(XmlObject xmlObject) throws XmlException {
if (ApplicationClientDocument.type.equals(xmlObject.schemaType())) {
XmlBeansUtil.validateDD(xmlObject);
return (ApplicationClientDocument) xmlObject;
}
XmlCursor cursor = xmlObject.newCursor();
XmlCursor moveable = xmlObject.newCursor();
String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application-client_5.xsd";
String version = "5";
try {
cursor.toStartDoc();
cursor.toFirstChild();
if ("http://java.sun.com/xml/ns/j2ee".equals(cursor.getName().getNamespaceURI())) {
SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
XmlObject result = xmlObject.changeType(ApplicationClientDocument.type);
XmlBeansUtil.validateDD(result);
return (ApplicationClientDocument) result;
}
// otherwise assume DTD
SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
cursor.toStartDoc();
cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "application-client");
cursor.toFirstChild();
SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
} finally {
cursor.dispose();
moveable.dispose();
}
XmlObject result = xmlObject.changeType(ApplicationClientDocument.type);
if (result != null) {
XmlBeansUtil.validateDD(result);
return (ApplicationClientDocument) result;