Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAX parse and validate with XSD

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using SAX to parse a huge doc.
my Q is: How to set that Validation must occur?

The xerces parser I use seems to be only checking well-formedness, but noth validation ; although I force it to do so:

Approach 1:
in the root element of the XML Document.
PS:By default the XML Docs I receive do not have either noNamespaceSchemaLocation or schemaLocation set. so I added them manually programmatically just to be able to test; by using reader.set(..., ...);


Approach 2:
within the SAX Parser:

PS: THE TARGETNAMESPACE OF THE XSD DOC and the DEFAULT NAMESPACE OF THE RECEIVED Instance XML DOC ARE THE SAME; I guess this means I should NOT use noNamespaceSchemaLocation. Am I right?
also, xsi:schemaLocation="http://www.R�STEM.RU/XYZ.KUR file:/C:/schemas/schema1.xsd" this can or cannot exist in the XML Instance document. it should not make any difference. is this also correct?
In the Xerces web site, it claims when one programmatically defines the schema location, then the schemaLocation on the XML instance document (if ever exists) will be overwritten..


Thx
R�stem
[ January 26, 2005: Message edited by: R�stem-� Zal� ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried leaving just one (1) space between "http://www.RUSTEM.RU/XYZ.KUR" and "XSDSchemaURI" for the "http://apache.org/xml/properties/schema/external-schemaLocation" property?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
Have you tried leaving just one (1) space between "http://www.RUSTEM.RU/XYZ.KUR" and "XSDSchemaURI" for the "http://apache.org/xml/properties/schema/external-schemaLocation" property?


Thx, I solved the problem.
it was that in the web application I get the location of the XSD File using but the web application context name contained spaces, so it is interpreted as having more than 1 Namespaces and so accompanying schemas...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic