Class PrideXmlValidator
java.lang.Object
com.compomics.util.pride.validation.PrideXmlValidator
public class PrideXmlValidator extends Object
PRIDE XML schema validation.
- Author:
- Phil Jones, Florian Reisinger, Harald Barsnes
-
Field Summary
Fields Modifier and Type Field Description static org.iso_relax.verifier.VerifierFactory
VERIFIER_FACTORY
The verifier factory. -
Constructor Summary
Constructors Constructor Description PrideXmlValidator()
Set up a PrideXmlValidator using the default schema.PrideXmlValidator(URL schemaUrl)
Set up a PrideXmlValidator using the provided schema. -
Method Summary
Modifier and Type Method Description XMLValidationErrorHandler
getErrors()
Returns the XML validation error object.String
getErrorsAsString()
Returns the errors formatted as s single string.void
setSchema(URL schemaUrl)
Set the schema.boolean
validate(File prideXmlFile)
Returns true of the given PRIDE XML file is valid.
-
Field Details
-
VERIFIER_FACTORY
public static final org.iso_relax.verifier.VerifierFactory VERIFIER_FACTORYThe verifier factory.
-
-
Constructor Details
-
PrideXmlValidator
public PrideXmlValidator() throws IOException, org.iso_relax.verifier.VerifierConfigurationException, SAXExceptionSet up a PrideXmlValidator using the default schema.- Throws:
IOException
- if an IOException occursorg.iso_relax.verifier.VerifierConfigurationException
- if a VerifierConfigurationException occursSAXException
- if a SAXException occurs
-
PrideXmlValidator
public PrideXmlValidator(URL schemaUrl) throws IOException, org.iso_relax.verifier.VerifierConfigurationException, SAXExceptionSet up a PrideXmlValidator using the provided schema.- Parameters:
schemaUrl
- the URL to the schema- Throws:
IOException
- if an IOException occursorg.iso_relax.verifier.VerifierConfigurationException
- if a VerifierConfigurationException occursSAXException
- if a SAXException occurs
-
-
Method Details
-
setSchema
public void setSchema(URL schemaUrl) throws IOException, org.iso_relax.verifier.VerifierConfigurationException, SAXExceptionSet the schema.- Parameters:
schemaUrl
- the schema to set- Throws:
IOException
- if an IOException occursorg.iso_relax.verifier.VerifierConfigurationException
- if a VerifierConfigurationException occursSAXException
- if a SAXException occurs
-
validate
public boolean validate(File prideXmlFile) throws FileNotFoundException, IOException, org.iso_relax.verifier.VerifierConfigurationException, SAXExceptionReturns true of the given PRIDE XML file is valid.- Parameters:
prideXmlFile
- the PRIDE XML file to test- Returns:
- true of the given PRIDE XML file is valid
- Throws:
FileNotFoundException
- if a FileNotFoundException occursIOException
- if an IOException occursorg.iso_relax.verifier.VerifierConfigurationException
- if a VerifierConfigurationException occursSAXException
- if a SAXException occurs
-
getErrorsAsString
Returns the errors formatted as s single string. Returns null if the file has not been validated.- Returns:
- the errors formatted as s single string, null if the file has not yet been validated
-
getErrors
Returns the XML validation error object. Returns null if the file has not been validated.- Returns:
- the XML validation error object, null if the file has not yet been validated
-