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

Re: Two tips for dramatically increasing the speed ofvalidatin

  • From: Ihe Onwuka <ihe.onwuka@gmail.com>
  • To: Roger L Costello <costello@mitre.org>
  • Date: Wed, 10 Feb 2021 14:03:41 -0500

Re:  Two tips for dramatically increasing the speed ofvalidatin
and parallelize execution with GNU parallel or xargs

On Wed, Feb 10, 2021 at 1:06 PM Roger L Costello <costello@mitre.org> wrote:
Hi Folks,

Note: The following only applies if you are using SAXON for schema validation.

I have over 6,000 XML files that I need to validate against an XML Schema. Initially, I used commands in a batch (.bat) file to loop over all the XML files and call SAXON to validate them. I never got through all 6,000 files because it was taking so long; I estimate it would have taken 3 hours or more.

I looked on the SAXON web page and found some tips for dramatically increasing the speed of validating a large number of XML documents.

Tip #1: Compile your XML Schema to a Schema Component Model (SCM). Here's how to generate the SCM file:

java com.saxonica.Validate -export:file.scm -xsd:file.xsd

That results in creating file.scm which is a compiled version of file.xsd

You can use file.scm anywhere you would use file.xsd and it will run much faster.

Tip #2: Specify all your XML files to be validated using the glob syntax, *.xml

Suppose all the XML files to be validated are in the folder named instances. Then use this command to validate all of them:

java com.saxonica.Validate -xsd:file.scm instances\*.xml

Notice that that uses the SCM file not the XSD file.

I used those two tips to validate my 6,000 XML files. How long did it take to validate the entire bunch? Answer: Immediate (i.e., way less than one second). So, the time to validate all 6,000 XML files dropped from 3 hours to less than one second. Pretty cool, aye?

/Roger

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.