br.ufg.integrate.xml
Class XMLValidator
java.lang.Object
br.ufg.integrate.xml.XMLValidator
public class XMLValidator
- extends Object
- Version:
- 0.1
Classe utilitária que valida arquivos XML baseados em um arquivo
XML Schema informado como argumento.
O principal método () foi baseado
no texto
The Java XML Validation API, de Elliotte Rusty Harold
disponível na IBM DeveloperWorks.
.
- Author:
- Rogerio
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLValidator
public XMLValidator(String xsdFile,
String xmlFile,
String schemaLanguage)
throws XMLException
- Parameters:
xsdFile
- A XML Schema file model.xmlFile
- A XML file to validate.schemaLanguage
- Specifies the schema language
which the returned SchemaFactory
will understand. See the list of
available schema languages for
the possible values in
javax.xml.validation.SchemaFactory
javadoc.
- Throws:
XMLException
XMLValidator
public XMLValidator(File xsdFile,
File xmlFile,
String schemaLanguage)
throws XMLException
- Parameters:
xsdFile
- A XML Schema file model.xmlFile
- A XML file to validate.schemaLanguage
- Specifies the schema language
which the returned SchemaFactory
will understand. See the list of
available schema languages for
the possible values in
javax.xml.validation.SchemaFactory
javadoc.
- Throws:
XMLException
XMLValidator
public XMLValidator(URL xsdFile,
URL xmlFile,
String schemaLanguage)
throws XMLException
- Parameters:
xsdFile
- A XML Schema file model.xmlFile
- A XML file to validate.schemaLanguage
- Specifies the schema language
which the returned SchemaFactory
will understand. See the list of
available schema languages for
the possible values in
javax.xml.validation.SchemaFactory
javadoc.
- Throws:
XMLException
getErrors
public ArrayList<Exception> getErrors()
- Retorna a coleção de erros gerados durante a validação.
- Returns:
- Coleção de erros gerados.
getWarnings
public ArrayList<Exception> getWarnings()
- Retorna a coleção de avisos (warnings) gerados
durante a validação.
- Returns:
- Coleção de avisos gerados.
validate
public void validate()
throws XMLException
- Checa um arquivo XML. Armazena os
possíveis erros e avisos (warnings) em coleções
que podem ser obtidas após o processamento.
- Throws:
XMLException
Copyright © 2008 Rogério Arantes Gaioso. All Rights Reserved.