// policy itself.
final MarkerGeneratingErrorReporter errorReporter =
new MarkerGeneratingErrorReporter(resource,
node, null);
// create a validator
XercesBasedDOMValidator validator =
createDOMValidator(errorReporter);
// Add a UniqueAssetValidator to each of the dependent
// elements (if any) using the validator for this resource
UniqueAssetValidator.addValidatorToProvider(
node, validator);
// Add the layout constraints supplementary validator.
validator.addSupplementaryValidator(
MCSNamespace.LPDM.getURI(),
LayoutSchemaType.LAYOUT.getName(),
new LayoutConstraintsValidator());
// Add the layout duplicate name supplementary validator.
validator.addSupplementaryValidator(
MCSNamespace.LPDM.getURI(),
LayoutSchemaType.LAYOUT.getName(),
new DuplicateNameValidator());
// Validate the policy using the root element.
validator.validate(node);
}
} catch (JDOMException e) {
// this exception is likely to occur if the DOM is badly
// formed. The user may be able rectify this by editing the
// file directly so we should add a marker that highlights