ben le XSD, c'est du XML... donc tu peux le lire
ben le XSD, c'est du XML... donc tu peux le lire exactement comme tu lirais un fichier XML
Il y a aussi une classe XmlSchema spécialisée pour lire un schema XSD
An XML schema describes the structure of an XML document
parser xml:
sequence
fichier xml entree
564IN
SEQ.0.20C.
http://onjava.com/pub/a/onjava/2001/10/24/xmldatabind.html
castor
http://www.lulu.com/items/volume_62/1161000/1161336/1/print/JsfFaceletsSpringmaven.pdf
http://sheikyerbouti.developpez.com/pl_sql/?page=Chap1
http://www.jmdoudoux.fr/java/dej/chap020.htm
https://forum.hibernate.org/viewtopic.php?f=11&t=1000992
<?xml version="1.0" encoding="ISO-8859-1"?>
<mapping>
<class name="XC.xml.node.Fichiercol">
<map-to xml="Fichier"/>
<field name="CC_dateDecl" handler="xxxxxxxx.xml.node.commun.Handler" direct="false" type="java.lang.String" get-method="">
<bind-xml name="dateDecl" node="attribute"/>
</field>
<field name="CC_dateCrea" handler="xxxxxxxxxxx.xml.node.commun.Handler" direct="false" type="java.lang.String" get-method="">
<bind-xml name="dateCrea" node="attribute"/>
</field>
<field name="CC_periode" handler="xxxxxxxxxxxxxxxx.xml.node.commun.Handler" direct="false" type="java.lang.String" get-method="">
<bind-xml name="periode" node="attribute"/>
</field>
<field name="CC_codeAE" handler="xxxxxxxxxxxxxxxx.xml.node.commun.Handler" direct="false" type="java.lang.String" get-method="">
<bind-xml name="codeAE" node="attribute"/>
</field>
<field name="listDossiercol" direct="false" type="xxxxxxxxxx.xml.node.col.Dossiercol" get-method="getListDossiercol" collection="arraylist">
<bind-xml name="DossierCredit" node="element"/>
</field>
</clas
ByteArrayOutputStream out =
super.serialize(dossiercol,false,dossierSelected);
File fileTempValidation = null;
FileOutputStream fos =null;
try {
fileTempValidation = File.createTempFile("col", "valide");
fos = new FileOutputStream(fileTempValidation);
fos.write(this.headerXml.getBytes());
fos.write(out.toByteArray());
fos.write(this.footerXml.getBytes());
fos.flush();
fos.close();
ErrorHandlerValidation errorHandler = new ErrorHandlerValidation();
XMLReader saxReader = XMLReaderFactory.createXMLReader() ;
saxReader.setErrorHandler(errorHandler);
saxReader.setFeature("http://xml.org/sax/features/validation", true) ;
saxReader.parse(fileTempValidation.getPath());
if (!errorHandler.getListException().isEmpty()){
throw errorHandler.getListException().get(0);
}
} catch (SAXException e) {
throw new Exception("Erreur lors de la sérialisation du dossier " + e.getMessage(),e);
}finally{
super.deleteFile(fos, null,fileTempValidation);
}