}
// Perform schema validation if required
if (schemaValidation)
{
XSD xsd = version == 1 ? XSD.PORTLET_1_0 : XSD.PORTLET_2_0;
try
{
xsd.validate(new StreamSource(new ByteArrayInputStream(bytes)));
}
catch (Exception e)
{
throw new DeploymentException("The portlet.xml file is not valid XML", e);
}