Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Instanciation d'un objet schéma depuis schema1.xsd à partir d'un SchemaFactory
- SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
- Schema schema = schemaFactory.newSchema(new File(".", "schema1.xsd"));
- //Attribution du schema instancié au Unmarshaller
- //Si le flux ne respecte pas le schema, une erreur est levée
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- unmarshaller.setSchema(schema);
- Formation unmarshall = (Formation) unmarshaller.unmarshal(new File("formation.xml"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement