• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java XML Validation Framework Alternative to Xerces

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
What alternatives are there to Apache Xerces, concerning XML validation from inside a Java application?
As far as I understand, Xerces is incorporated in the XML validation offered by the Java SE API (correct me if I am wrong).
I am looking for something that is not related to, or use, Xerces in any way.
Thanks in advance!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to use Xerces, specifically. JAXP can be configured to use whichever parser you prefer, although I don't think there are many other validating parsers left by now.

See http://www.coderanch.com/how-to/java/HowToValidateXmlAgainstAnySchema for how to use JAXP for validation.

What is the reason for wanting to avoid Xerces?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Thanks!
Ulf Dittmer wrote:
What is the reason for wanting to avoid Xerces?

A supposed bug in Xerces. I would want to give another validating framework a try to see if this is indeed the problem or if there is some other reason.
Best wishes!
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crimson supports validation via DTD and (supposedly) a subset of XML Schema.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xerces is an XML parser, it is not a framework.

A version of Xerces was included in the Java SE. However, this version is not exactly the same as the Apache version. There are some differences in regards to performance.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Thanks for the replies - now I know how to tell a parser from a framework! :-)
It turned out that there was no bug in Apache Xerces - at least not that cause the problem I was set to solve.
The problem was deep hierarchies of XML schemas. In order for Xerces to traverse the entire hierarchies, a property telling Xerces to honour all XML schema locations had to be set (http://apache.org/xml/features/honour-all-schemaLocations).
There were some other issues as well, but the main issue was the honour-all-schema-locations.
Reference: http://xerces.apache.org/xerces2-j/features.html
Best wishes!
 
Suresh K Babu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is list of Open Source XML Parsers in Java

http://java-source.net/open-source/xml-parsers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic