[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Bulk XSD validation in Java

java xsd
Title: Bulk XSD validation in Java
If you chose to tackle this job using Saxon, you could do it as follows. Create a Saxon Configuration object, which acts as a container for a schema cache. Then write some kind of listener that listens for the events indicating a validation request (or do it as an HTTP servlet). When a request arrives, fire off a new thread to do the validation: you can use the standard JAXP validation interface, or Saxon's internal interface if you want more control. If you need to, you can write a URIResolver that interprets the schemaLocation attribute, giving the option to redirect the URIs. If a document requests a schema that is already loaded in the cache, then it will be used from the cache; otherwise it will be fetched from disk, compiled, and added to the cache.
The only limitations with this approach are that (a) the cache can only contain one schema component with any given name (which may be a problem if you have many unrelated no-namespace schemas), and (b) a newly-loaded schema isn't allowed to "modify" definitions that have already been used. "Modifications" here includes using xs:redefine, adding to a substitution group, or extending a complex type. You can usually get around the "modifying" restrictions by preloading schemas into the cache rather than adding them incrementally as they are first encountered.
Michael Kay

From: Chris Wilper [mailto:cwilper@c...]
Sent: 28 February 2006 01:54
To: xml dev
Subject: Bulk XSD validation in Java

Hi all,

I've got a java process that needs to continously validate xml documents according to the w3c schemas they indicate in their xsd:schemaLocations.  The documents arrive at a high rate and must be processed as quickly as possible.  The exact schemas they employ are not known ahead of time and there may be several of them required to validate each document.

My question is, what library/libraries are appropriate in this situation and how do I tell them to only load the required schema(s) only once?  Any advice?



Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.