/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }
/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }
/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }