Umesh,
 
Such a feature would be very nice, I agree. Unfortunately, it would also be completely subjective and practically impossible to implement in a generic way. How could you possibly decide which schema to validate with? By looking at the outer element name (and therefore parsing twice)? By attempting to validate the document against a cached list of known and frequently-used schemas? By introducing the concept of a "default" schema for a given namespace? It seems like everything about the XML Schema spec is geared against this kind of assumptive processing, and towards the notion of the author or source of the document attaching the correct schema reference.
 
The safest course, I think, is to validate every document as-is. That way you can guarantee that the following documents are never processed:
 
- Documents that have no schema reference at all.
- Documents that have the wrong schema reference.
- Documents that have the correct schema reference, but are invalid according to that schema.
 
All that's left is documents that have the correct schema reference, and are valid according to that schema, leaving no possible surprises during downstream processing (bugs notswithstanding).
 
Thanks for your input,

Wayne M. Bradney
Wall Street Systems, Inc.
30 Broad Street, 24th Floor
New York, NY 10004
Phone:   +1 (212) 401 8239
E-Mail:    [EMAIL PROTECTED]

-----Original Message-----
From: Umesh Subramanian [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 20, 2001 1:37 PM
To: [EMAIL PROTECTED]
Subject: Re: Validation of an XML against Schema

Wayne:
I take a more pessimistic view point, by not completely trusting the sender of the XML .
From the standpoint of a service provider with an XML interface, I would like all incoming messages to be validated before processing them. Even if the client does not specify the schemaLocation (or worse, specifies a wrong location), I would iike to intercept the message and validate it. So a feature that allows us to associate a message that does not specify a schemaLocation with a schema (or better yet a validator object - to avoid the overhead of reading the schema file everytime) would be really useful
Thanks
-Umesh
 
 
 
 

Wayne Bradney wrote:

 No nerds around here - only geeks ;-)I've been considering the same issues recently -- and I'm left curious as to why any system would want to play around with the schema reference of an incoming document. If someone sends you a document that references a particular schema, they're doing so for very good reason, they're telling you that their document conforms to that schema. Of course you can use the EntityResolver to point the way to a locally cached version and avoid the network traffic, but in that case you'd better be sure that the cached version is in sync with the referenced one. On the other hand, if you get a document without a schema reference, that may also be telling you something very important -- that the document does not conform to any particular schema, and that you probably shouldn't attempt to validate it at all.It's true that you're at the mercy of the sending systems to get these things right, but I try to avoid making assumptions about the documents I receive, and I never manipulate the schema reference (if it doesn't validate as is -- it gets bounced back to the sender). I'd be interested to get the group's views on how other systems handle schema references.Regards,

Wayne M. Bradney
Wall Street Systems, Inc.
30 Broad Street, 24th Floor
New York, NY 10004
Phone:   +1 (212) 401 8239
E-Mail:    [EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 11:25 AM
To: [EMAIL PROTECTED]
Subject: Validation of an XML against Schema
 

I get XML documents from partners which we want to validate against schema.
If they do specify any schema refernces thats fine I can use MyEntityResolver to override resovleEntity and tell the parser to use the schema based on the public and system ids But If they do not specify any xsi:schemaLocation attribute then there is no way for my parser to validate against  a schema.

i know there will be a hack developed by nerd.

Thanks for your help

--------------------------------------------------------------
Tushar Dave
Employease Inc.
Phone: 404-495-5948
Email: [EMAIL PROTECTED]
--------------------------------------------------------------

Reply via email to