It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes Schema validation performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Schema validation performance" Watch "Schema validation performance" New topic

Schema validation performance

Stuart J W Bell

Joined: Nov 23, 2006
Posts: 23
Hi there,

Has anyone had any issues with CPU usage when performing schema validation? I am investigating the possibility of this scenario but I am yet to be convinced that this is the case.

The code I am looking over makes use of a JAXP/DOM parser (DocumentBuilder) and applies the schema location by setting it as an attribute. Good details of how this is achieved can be found in to the article below:

The code seems to be constructed sensibly enough, however I was wondering what the thoughts were of schema validation, with regards to the best parser to use in that circumstance? SAX or DOM? Would SAX always be faster? The XML document is not particularly large.

Would it be advisable to use a grammer cache instead?

I welcome anyone's thoughts on this.


William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13028
best parser to use in that circumstance? SAX or DOM? Would SAX always be faster?

DOM builders actually use SAX parsers under the covers so SAX will be faster in all cases, and of course use the minium memory.

I agree. Here's the link:
subject: Schema validation performance
jQuery in Action, 3rd edition