Your xml and xsd validate fine for me. I'm haven't gotten around to upgrading to Xerces 2.6 but I doubt something this basic is broken since 2.5.

I think the problem is your setFeature lines. For schema validation, try:

"http://apache.org/xml/features/validation/schema"
instead of the
"http://xml.org/sax/features/validation/schema"
that you have.





"Thomas Cox" <[EMAIL PROTECTED]>

01/06/2004 01:57 PM
Please respond to xerces-j-user

       
        To:        <[EMAIL PROTECTED]>
        cc:        
        Subject:        Validation feature problems redux



I'll try this again, as I didn't get an answer to the main question last time. (Probably lost in the holidays...)

Thanks,
Thomas Cox

> -----Original Message-----
> From: Thomas Cox [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 19, 2003 10:22 AM
> To: [EMAIL PROTECTED]
> Subject: Validation feature problems
>
>
> When I try to parse this xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <myns:BOGUS xmlns:myns="http://www.bogus.com"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://www.bogus.com file://C:/xml/bogus.xsd">
>     <myns:FOO>
>         Yada yada yada
>     </myns:FOO>
> </myns:BOGUS>
>
> with this schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="http://www.bogus.com"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:myns="http://www.bogus.com"
>     elementFormDefault="qualified"
>     attributeFormDefault="unqualified">
>     <xs:element name="BOGUS">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="FOO" maxOccurs="unbounded">
>                     <xs:simpleType>
>                         <xs:restriction base="xs:string">
>                             <xs:maxLength value="80"/>
>                         </xs:restriction>
>                     </xs:simpleType>
>                 </xs:element>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
>
> in Xerces 2.6.0 using these features:
>
>                  org.apache.xerces.parsers.SAXParser saxParser;
>                  ...
>     saxParser.setFeature("http://xml.org/sax/features/validation", true);    
>     saxParser.setFeature("http://xml.org/sax/features/validation/schema", true);

and with or without:

    saxParser.setFeature("http://apache.org/xml/features/validation/dynamic", true);

>                  ...
>
> I get this error:
>
>   Exception class: org.xml.sax.SAXParseException
>   Message:         Document is invalid: no grammar found.
>   Line:            2
>   Column:          12
>
> Any idea why? It works with other validating parsers, and has
> no problems if the validation feature is turned off.
>
> Thanks,
> Thomas Cox

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


Reply via email to