File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Are these the correct steps to installing & running Xerces? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Are these the correct steps to installing & running Xerces?" Watch "Are these the correct steps to installing & running Xerces?" New topic

Are these the correct steps to installing & running Xerces?

Kevin Thompson
Ranch Hand

Joined: May 04, 2001
Posts: 237
BACKGROUND INFORMATION: I have Java 1.4.0 installed as follows:

Step 01 - download the Xerces files to my c drive:

Step 02 - unpack the zip files:
c:\jar xf
c:\jar xf
The above two commands will place the contents into: c:\xerces-2_2_1
c:\jar xf
The above command will place the contents into: c:\tools

Step 03 - Set the path:
c:\set path=c:\jdk1.4.0\bin

Step 04 - Set the classpath:
c:\set CLASSPATH=c:\xerces-2_2_1\xercesSamples.jar;c:\xerces-2_2_1\xercesImpl.jar

Step 05 - Create an XML File named "intro.xml" and place inside xerces-2_2_1 folder:
<?xml version = "1.0"?>
<message>Figure this stuff out!!!</message>

Step 06 - Run the sample sax program named "Counter":
c:\xerces-2_2_1\java sax.Counter -v intro.xml
The only results I get from my intro.xml file or any xml file for that matter is:
[Error] intro.xml:2:11: Document is invalid: no grammar found.
[Error] intro.xml:2:11: Document root element "myMessage", must match DOCTYPE root "null".
intro.xml: 125 ms (2 elems, 0 attrs, 0 spaces, 34 chars)

My Questions:
Are my results to be expected? Is this correct?
When I run the sample sax program named "sax.DocumentTracer" and "sax.Writer" I pretty much get same [Error] messages.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
You're asking it to validate (that's what the "-v" is for on the sax.Counter command line), but you have not declared any DTD.
Here's what I get when I take out the "-v":
% java sax.Counter intro.xml
intro.xml: 118 ms (2 elems, 0 attrs, 0 spaces, 31 chars)
And here's what the other two commands do for me:
% java sax.DocumentTracer intro.xml
characters(text="Figure this stuff out!!!")
% java sax.Writer intro.xml
<?xml version="1.0" encoding="UTF-8"?>
<message>Figure this stuff out!!!</message>
[ November 19, 2002: Message edited by: Ron Newman ]

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Brian Coates
Ranch Hand

Joined: Jul 03, 2001
Posts: 42
do you get errors running any of the other examples, like Counter?
Kevin Thompson
Ranch Hand

Joined: May 04, 2001
Posts: 237
Thanks! I dropped the "-v" on the run command and I get the exact same results that Ron does for sax.Counter and sax.DocumentTracer and sax.Writer. Thanks!
Now of course, there are still more Xerces run instructions that are not clear to me.
This text is from the "Installation" section of the Xerces Apache web site ==> "In order to compile the source code using Ant or to build the release distributions yourself, you must have the contents of on your classpath; i.e., you will need access to a version of ant.....For ease of use, we recommend extracting in your xerces root directory; the and build.bat scripts are written for this case."
Background Story: There are no "readme.txt" files anywhere regarding the "tools" file folder, OR the "" file or the "build.bat" file.
My questions/comments:
1. In plain English, is this what they mean => If I want to make a change to the sax.Counter program, I need to put the entire tools folder in my classpath and run one of the provided batch files (either or build.bat).?
2. I guess the "build.bat" file is for windows? NOTE: the build.bat file they provided references two separate jar files that do not appear to exist, so maybe they have errors in their batch files? (I am talking about the c:\tools\bin\xjavac.jar file and also the c:\jdk1.4.0\lib\ file.)
3. I guess the "" file is for UNIX?
These are my steps to making my own source code changes (I tried to make out what they are doing in the build.bat file and follow it
Step 01 - set the Path:
c:\xerces-2_2_1>set path=jdk1.4.0\bin
Step 02 - set the JAVA_HOME per their batch file instructions:
c:\xerces-2_2_1> set JAVA_HOME=c:\jdk1.4.0\bin\java.exe;c:\jdk1.4.0\lib\tools.jar
Step 03 - set the CLASSPATH (add the tools jars):
c:\xerces-2_2_1> set CLASSPATH=
Step 04: I save the sax.Counter program as sax.Counter1 and within the program change all occurances of "Counter" to "Counter1" and try to recompile as follows:
I get these results:
error: cannot read :
Step 05: Even the provided sax.Counter can not be recompiled:
I get these results:
error: cannot read :
Their batch file instructions refer to two file that do not exit:
c:\jdk1.4.0\lib\ <- this zip file does not exist as part of JDK1.4.0
c:\tools\bin\xjavac.jar <- this jar file does not exist in Xerces-2_2_1
Interpreting batch files is not one of my strong points. Does anyone have suggestions?
[ November 21, 2002: Message edited by: Kevin Thompson ]
I agree. Here's the link:
subject: Are these the correct steps to installing & running Xerces?
It's not a secret anymore!