Bonjour,

Mon fichier XML est le suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
 
-<GUEN_MAJDU xsi:noNamespaceSchemaLocation="guen.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
....
 
</GUEN_MAJDU>
Mon fichier XSD ressemble à ça:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:altova="http://www.altova.com/xml-schema-extensions" elementFormDefault="qualified" attributeFormDefault="unqualified"
	<xs:include schemaLocation="guen_types.xsd"/>
....
Mon code de validation est celui-ci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
public static boolean validerFichierXML(final String xsdFile, final String xmlFile, final ErrorChecker errors) {
        boolean resultatValidation = false;
        try {
            // Parse an XML document into a DOM tree.
            final DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            final Document document = parser.parse(new File(xmlFile));
 
            // Create a SchemaFactory capable of understanding WXS schemas.
            final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
 
            // Load a WXS schema, represented by a Schema instance.
            final URL schemaFile = new URL(xsdFile);
            // StreamSource schemaFile = new StreamSource(new File(xsdFile));
            final Schema schema = factory.newSchema(schemaFile);
 
            // Create a Validator object, which can be used to validate an instance document.
            final Validator validator = schema.newValidator();
            validator.setErrorHandler(errors);
            validator.validate(new DOMSource(document));
 
            if (errors.isOK()) {
                resultatValidation = true;
            }
 
        } catch (final ParserConfigurationException e) {
            LOGGER.error("Erreur parser : " + e.getMessage(), e);
        } catch (final SAXException e) {
            LOGGER.error("Erreur SAX : " + e.getMessage(), e);
        } catch (final IOException e) {
            LOGGER.error("Erreur IO : " + e.getMessage(), e);
        }
        return resultatValidation;
 
    }
J'ai toujours l'erreur [cvc-elt.1.a: Cannot find the declaration of element qui ressort. Quelqu'un a une idée de comment résoudre ça. Je suis vraiment coincée

Merci d'avance!