Title: RE: Using JAXP with Xerces-J Question

Try using Xerces version 1.4.2. I had the same  problem, this version solved it i think.

Richard

    -----Oorspronkelijk bericht-----
    Van:    Bin Xu [SMTP:[EMAIL PROTECTED]]
    Verzonden:      vrijdag 27 juli 2001 1:51
    Aan:    '[EMAIL PROTECTED]'
    Onderwerp:      Using JAXP with Xerces-J Question


    I have a question about how to turn on schema validation with Xerces-J and
    JAXP. I can turn it on with Xerces-J's own API by:
            DOMParser p = new DOMParser();
            p.setFeature("http://apache.org/xml/features/validation/schema",
    true);
           
            p.parse(new InputSource(new FileInputStream(filename)));
            Document document = p.getDocument();


    But when I try to use JAXP1.1 (It is suggested that better to use it for
    better interoperation with different parsers), it is not working:
          DocumentBuilderFactory dbf =
                DocumentBuilderFactoryImpl.newInstance();

            dbf.setValidating(true);
            DocumentBuilder db = dbf.newDocumentBuilder();

            ==>It did not work, the complaints are:
    F:\>java TestXerces personal-schema.xml
    Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
    set, which is probably not what is desired.  Parser will use a default
    ErrorHandler to print the first 10 errors.  Please call
    the 'setErrorHandler' method to fix this.
    Error: URI=null Line=3: Element type "personnel" must be declared.
    Error: URI=null Line=5: Element type "person" must be declared.
    Error: URI=null Line=6: Element type "name" must be declared.
    Error: URI=null Line=6: Element type "family" must be declared.
    Error: URI=null Line=6: Element type "given" must be declared.
    Error: URI=null Line=7: Element type "email" must be declared.
    Error: URI=null Line=8: Element type "link" must be declared.
    Error: URI=null Line=11: Element type "person" must be declared.
    Error: URI=null Line=12: Element type "name" must be declared.
    Error: URI=null Line=12: Element type "family" must be declared.


    Did I miss something here?

    -Bin Xu

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to