• [^] # Re: idée

    Posté par (site web personnel) . En réponse au message Valider un document XML ne contenant pas de declaration DOCTYPE. Évalué à 1.

    Sinon, sur ce lien [http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPSAX13.htm(...)] il semble qu'ils expliquent comment fournir un "schema" à ton parser. Et ils précisent qu'une DTD est considérée comme un schéma :

    There are multiple schema-definition languages, including RELAX NG, Schematron, and the W3C "XML Schema" standard. (Even a DTD qualifies as a "schema", although it is the only one that does not use XML syntax to describe schema constraints.) However, "XML Schema" presents us with a terminology challenge. While the phrase "XML Schema schema" would be precise, we'll use the phrase "XML Schema definition" to avoid the appearance of redundancy.



    Plus bas ils expliquent comment faire l'association :

    You can also specify the schema file in the application, using code like this:


    static final String JAXP_SCHEMA_SOURCE =
    "http://java.sun.com/xml/jaxp/properties/schemaSource(...)";

    ...
    SAXParser saxParser = spf.newSAXParser();
    ...
    saxParser.setProperty(JAXP_SCHEMA_SOURCE,
    new File(schemaSource));


    Il doit y avoir des options equivalentes pour un DOMParser. Il faut que ton implémentation du parseur supporte la propriété.

    Voila, en espérant que cela t'aide.

    Bon courage.