xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Glavassevich <mrgla...@apache.org>
Subject Re: Validation feature problems
Date Fri, 19 Dec 2003 15:30:13 GMT
Hello Thomas,

Try specifying your schema location as 'file:///C:/xml/bogus.xsd'. I
believe the URI you have now will cause the parser to try to connect
via FTP to a non-existent host called 'C:'. I doubt that's what you
intended.

Hope that helps.

On Fri, 19 Dec 2003, Thomas Cox wrote:

> 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);
> 	...
>
> 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: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Mime
View raw message