Hi, In the snippet you posted you're passing an input to the parser without specifying a base URI for the XML document. You should always specify one (i.e. call InputSource.setSystemId()) otherwise relative URIs such as the one you specified in the xsi:schemaLocation attribute get resolved against the current working directory which may not actually be where your schema document is.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] vkoro <[EMAIL PROTECTED]> wrote on 10/08/2008 08:51:27 AM: > My xml file has DOCTYPE with entities. Something like this > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE ss:manifest [ > <!ENTITY ent1 "http://some1.com/qqq/qqqq/"> > <!ENTITY ent2 "http://some2.com/qqq/qqqq/">]> > <ss:manifest ss:version="1.0" > xmlns:ss="http://some3.com/www/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://some3.com/www/ some.xsd"> > <ss:prolog> ..... > > > I validate it using catalog > > XMLCatalogResolver resolver = new XMLCatalogResolver(); > resolver.setCatalogList(new > String[]{"C:\\Project\\parser\\xml\\catalog.xml"}); > > SAXParserFactory factory = SAXParserFactory.newInstance(); > factory.setNamespaceAware(true); > > SAXParser parser = factory.newSAXParser(); > > parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", > "http://www.w3.org/2001/XMLSchema"); > > XMLReader reader = parser.getXMLReader(); > > reader.setProperty("http://apache.org/xml/properties/internal/entity-resolver > ", > resolver); > reader.setFeature("http://apache.org/xml/features/validation/schema", > true); > reader.setFeature("http://xml.org/sax/features/validation", true); > > reader.parse(new InputSource(new > FileInputStream("C:\\Project\\parser\\xml\\manifest.xml"))); > > Somehow when DOCTYPE is in the xml the reader stops using schema for > validation. It just cannot find it. > As soon as DOCTYPE is removed the problem disappears > > Could anybody suggest how to make it use schema when DOCTYPE is declared ? > > Thank you > > > > > -- > View this message in context: http://www.nabble.com/Validating-XML- > file-using-catalogs-tp19877883p19877883.html > Sent from the Xerces - J - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]