You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Loughran <st...@apache.org> on 2004/08/12 14:28:56 UTC
XML parser in junit not validating schemas
I have a fun little problem
1. unit tests for code that validates XSD documents -and which therefore
request validation
XMLReader xerces =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
xerces.setFeature("http://apache.org/xml/features/validation/schema",true);
2. intelliJ idea, which runs the tests happily from the in-IDE test runner
3. ant command line , which fails with
Feature 'http://apache.org/xml/features/validation/schema' is not
recognized.
org.xml.sax.SAXNotRecognizedException: Feature
'http://apache.org/xml/features/validation/schema' is not recognized. at
org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
the command line is running forking ant with XML Reporting.
Observations
(a) we have xerces, cos it is what I asked for and got in the stack trace
(b) there is an up to date version of xerces in ant/lib (the one that
comes with Xom1.0alpha5)
(c) but it isnt recognising the schema stuff
I am wondering if this is an endorsed directory thing. It also looks
like something relatively easy to write a unit test for, given that is
what I already (accidentally) have.
Anyone else hit this?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: XML parser in junit not validating schemas
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 12 Aug 2004, Steve Loughran <st...@apache.org> wrote:
> Observations (a) we have xerces, cos it is what I asked for and got
> in the stack trace (b) there is an up to date version of xerces in
> ant/lib (the one that comes with Xom1.0alpha5)
Is that up to date? Ant's own should be.
> I am wondering if this is an endorsed directory thing.
Which JDK?
The easiest thing to do would be to explicitly pass your "good"
version of Xerces on the bootclasspath in the JUnit task - this is
what Gump does to defeat the built-in parser without installation of
Xerces and Xalan's CVS HEAD into the endorsed directories.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org