• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Parse/Validate with DSIG schema issue

Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to validate a digital XML signature (which corresponds to the XML dsig xsd). In order to do this, I downloaded the schema from: http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd

When validating, I get an error like 'element Signature not found', which smells like the parser being unable to find the schema. But, it works perfectly with other schema's, just not with this one.

After some time fiddling around, I found that there is a DOCTYPE in the schema (any one knows why they put a doctype in an xml schema ? I don't understand this) . After removing the doctype, everything works. So the parser is trying to validate against the DTD and the XML schema, but it could not find the DTD and that gave the error.

Now, I'm not happy with this solution (removing the doctype). I feel that it is bad to change the original schema, even if it is a very small modification. So I want to tell the parser that it should totally ignore the Doctypes in the XSD and only perform the schema validation.

That should do it accordinhg to the xerces FAQ on http://xerces.apache.org/xerces2-j/faq-pcfp.html ("How can I tell the parser to validate against XML Schema and not to report DTD validation")

It does indeed work, the parser does not uses the DTD anymore, BUT it still expects to FIND the DTD. So I still get an error:

Error: URI=null Line=2: schema_reference.4: Failed to read schema document 'null', 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>.
Error: URI=null Line=2: cvc-elt.1: Cannot find the declaration of element 'Signature'. class org.apache.xerces.jaxp.DocumentBuilderImpl

When I add an EntityResolver that returns an empty 'DTD', it works:

Is there any other, more clean, solution for this ?
    Bookmark Topic Watch Topic
  • New Topic