Hi Simon, "Simon Bøggild" <[EMAIL PROTECTED]> wrote on 12/03/2007 02:32:28 PM:
> Hi Michael, > > The problem seems to be this initial declaration in the xmldsig- > core-schema.xsd: > > <!DOCTYPE schema > PUBLIC "-//W3C//DTD XMLSchema 200102//EN" > "http://www.w3.org/2001/XMLSchema.dtd" > [ > <!ATTLIST schema > xmlns:ds CDATA #FIXED "http://www.w3.org/2000/09/xmldsig#"> > <!ENTITY dsig 'http://www.w3.org/2000/09/xmldsig#'> > <!ENTITY % p ''> > <!ENTITY % s ''> > ]> One of these days we really should improve the reporting of that. I think we're just trapping every IOException and reporting that generic and not particularly very helpful error message in its place. > If I remove that section from the xsd file, then there's no problem > using the catalog with the SchemaFactory. If the declaration is there > I get the error message mentioned previously. XMLSchema.dtd is > referenced in that declaration. > I've tried to solve the problem by writing this in the xml catalog: > > <public publicId = "-//W3C//DTD XMLSchema 200102//EN" > uri="/path/to/XMLSchema.dtd"/> > , keeping a local copy of XMLSchema.dtd. > > I've also tried putting: > > <public publicId="http://www.w3.org/2000/09/xmldsig#" > uri="/path/to/xmldsig-core-schema.xsd"/> > > No luck with any of those. > So status is that cutting out the DOCTYPE declaration from the > xmldsig-core-schema makes it possible to validate all schemas locally > with the catalog, otherwise not. > > Regarding your question if I tried opening an InputStream with > java.net.URL I'm not sure what you want me to accomplish? It was to confirm that you could actually read the document from the location you specified. It was just a sanity check. Sometimes folks have a typo in their URI or forgot to copy the document to the location. Of course now we know that wasn't the problem here. > In short, a > schema I have makes use of elements from xmldsig-core-schema, and I > would simply like to be able to do my schema validation with a local > copy of this schema rather than having Xerces SchemaValidator be > dependant on establishing a connection to: > http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd (I think I > gave an incorrect address to this schema in my previous mail) > > Thanks, > Simon > > On Dec 3, 2007 2:19 AM, Michael Glavassevich <[EMAIL PROTECTED]> wrote: > > Hi Simon, > > > > "file:/path/to/xmldsig-core/xmldsig-core-schema.xsd" seems like the correct > > result for the "rewriteSystem" you wrote. What are you expecting to get as > > the resolved URI from the catalog resolver? Have you tried opening an > > InputStream for this URI yourself with java.net.URL? > > > > Thanks. > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: [EMAIL PROTECTED] > > E-mail: [EMAIL PROTECTED] > > > > "Simon Bøggild" <[EMAIL PROTECTED]> wrote on 12/02/2007 02:06:23 PM: > > > > > > > Hi, > > > > > > I'm trying to use XMLCatalogResolver as the ResourceResolver for a > > > SchemaFactory when validating schemas. I've created a catalog file > > > following the > > http://www.oasis-open.org/committees/entity/spec-2001-08-06.html > > > . > > > In the schemas that I check I have references to external schemas on > > > the Internet, which is why I'm interested in keeping a local copy of > > > those, and use a xml catalog to make the re-references when parsing > > > schemas with SchemaFactory. It goes well for most of the referenced > > > schemas, except when it comes to a particular schema: > > > > > http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd > > . > > > For some reason the local copy I'm re-referencing to is not enough to > > > make the schema validate. I'm getting the following error when > > > SchemaFactory tries to parse it: > > > > > > org.xml.sax.SAXParseException: schema_reference.4: Failed to read > > > schema document 'file:/path/to/xmldsig-core/xmldsig-core-schema.xsd', > > > because 1) could not find the document; 2) the document could not be > > > read; 3) the root element of the document is not <xsd:schema>. > > > > > > The schema is imported the following way from one of the schemas I use: > > > > > > <import namespace="http://www.w3.org/2000/09/xmldsig#" > > > schemaLocation="http://www.w3.org/TR/xmldsig- > > > core/xmldsig-core-schema.xsd"/> > > > > > > I'm suspecting the problem might have something to do with the > > > namespace, which contains the '#' symbol? The xmldsig-core-schema does > > > not import any schemas itself. > > > > > > I've tried using a rewrite like this: > > > <rewriteSystem systemIdStartString="http://www.w3.org/TR/xmldsig-core/" > > > rewritePrefix="file:///path/to/xmldsig-core/"/> > > > > > > and I've also tried a systemId: > > > <system systemId=" > > http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd" > > > uri="/path/to/xmldsig-core/xmldsig-core-schema.xsd"/> > > > > > > No matter how I seem to make the catalog I get the SAXParseException > > > when SchemaFactory tries to parse the local xmldsig-core.schema file. > > > All schemas are validated without any problems without the catalog. > > > > > > How is it possible to correct the catalog to solve the problem? > > > > > > Thanks, > > > Simon > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]