ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Aston" <...@pigbite.com>
Subject RE: xmlvalidate task and external catalogs
Date Wed, 07 Apr 2004 08:56:52 GMT
Ok then...

my build target now looks like this...

<target name="validate" description="Validate structure files">
	<xmlvalidate
		failonerror="no"
		lenient="no"
		warn="yes"
		file="${src.dir}/structure.xml"
		classname="org.apache.xerces.parsers.SAXParser"
		classpath="d:/java/xerces-2_6_2/xercesImpl.jar">

		<attribute name="http://apache.org/xml/features/validation/schema"
value="true"/>
		<xmlcatalog>
			<catalogpath>
				<pathelement
location="d:/sandbox/realms/realmsPublisher/resources/schema/catalog.xml"/>
			</catalogpath>
		</xmlcatalog>
	</xmlvalidate>
</target>

my build command is...

ant -v -lib d:\java\xml-commons-resolver-1.1\resolver.jar validate

the output is...

Apache Ant version 1.6.1 compiled on March 3 2004
Buildfile: build.xml
Detected Java version: 1.4 in: d:\java\j2SDK1.4.2_03\jre
Detected OS: Windows XP
parsing buildfile D:\sandbox\realms\realmsSample\build.xml with URI =
file:///D:/sandbox/realms/realmsSample/build.xml
Project base dir set to: D:\sandbox\realms\realmsSample
Build sequence for target `validate' is [validate]
Complete build sequence is [validate, publish-all, val, ]

validate:
[xmlvalidate] Using SAX2 reader org.apache.xerces.parsers.SAXParser
[xmlvalidate] Validating structure.xml...
Apache resolver library not found, internal resolver will be used
Warning: catalogpath listing external catalogs will be ignored
[xmlvalidate]
/D:/sandbox/realms/realmsSample/src/content/xml/sample/structure.x
ml:7:130: cvc-elt.1: Cannot find the declaration of element 'manifest'.
[xmlvalidate]
D:\sandbox\realms\realmsSample\src\content\xml\sample\structure.xm
l is not a valid XML document
[xmlvalidate] 1 file(s) have been successfully validated.

Interestingly enough, (but probably a btw) if I do a -diagnostics it tells
me that...

-------------------------------------------
 XML Parser information
-------------------------------------------
XML Parser : org.apache.xerces.jaxp.SAXParserImpl
XML Parser Location: D:\java\apache-ant-1.6.1\lib\xercesImpl.jar

which means it is not using the jar specified in the xmlvalidate task.

Could anything in the xml or catalog files be screwing things up or is it
obvious that the catalog is not even being resolved?

Rgds

Jeremy


-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: 07 April 2004 09:20
To: user@ant.apache.org
Subject: Re: xmlvalidate task and external catalogs


On Tue, 6 Apr 2004, Jeremy Aston <jez@pigbite.com> wrote:

> I beleive the declarations to be correct but I could quite easily be
> wrong!

Could you try a few things, please:

(1) Move your catalog definition into the task.  There have been bugs
with using <xmlcatalog refid="..."/> and I'm not convinced that we've
fixed all of them.

(2) Move the resolver jar into ANT_HOME/lib - or simply use
ant -lib path/to/resolver.jar - so that it ends up on Ant's default
CLASSPATH.  I don't think that the nested <classpath> of <xmlvalidate>
will be used to look up the resolver.  In particular in combination
with (1) I'm almost sure that the classpath doesn't have any effect
since the resolver will be searched for in your <xmlcatalog>
definition that doesn't ever see you <classpath>.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message