michael shea

Greenhorn
+ Follow
since Nov 11, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by michael shea

Guys,
I'm having problems using an XML catalog with the Xerces 2 parser. Here is the code that I used to add an entity resolver:

I am using version 1.1 of Sun's Resolver package.
The code listed above compiles OK. The following is the CatalogManager.properties file:

When running my program it reads in the catalog correctly, as shown in the following output:

This is the catalog.xml files contents:

The following is the error message that gets return after running the parser:

Each time the error occurs, the entity resolver tries to resolve the following:

I don't know why it adds the base directories to the name of the schema file as I have explicitly told the entity resolver to not use absolute locations.
Lastly, here is a sample of the xml file which contains the "lookup name" for the xml catalog to look up:

As you can see, the xml file only references SchemaFile.xsd, and the entity resolver at runtime should lookup that name in the catalog and substitute file:///home/acct/mshea/generated/schema/SchemaFile.xsd for it, but it does not.
Any help would be appreciated and if I'm doing this the wrong way, then I'd definately want to nkow about it.
Thanks.
Senthil, I'm not sure what code you wanted, but here is the code that I use and it dynamically validates xml files with the 1.4.4 parser.
Guys, just to let you know and anyone else who has run into the same problem. I updated the Xerces parser to the latest (1.4.4) and the dynamic feature works correctly as it should.
Thanks for all the help.
Does anyone know when Xerces 2 will be released? It must getting close now if its up to beta 3.
Thanks.
Yep, I've set the errorHandler and it still has the same problem. I beginning to think that the Dynamic feature is not yet implemented. I may have to email the Xerces-J-User mailing list to see if anyone knows more about this.
[This message has been edited by michael shea (edited November 13, 2001).]

Originally posted by arul senthil:

Doesn't these two options appear complementary?


Yes, good point but I've also tried that and it still doesn't work. I've also tried using the sample DOMCount.java that came in the Xerces package. It too has the same problem. Could it be because the schema is incorrectly declared in the xml file? Here is a sample:

Actually the more i think about it, i realise that this may be a bug!?!? in the software. Could this be the case?
Thanks for the reply. I actually may have the said the wrong version because we can validate against a schema. It works fine without the setFeature(dynamic, true) line in the code, except it validates all files, including those without schema's specified, which results in a whole bunch of errors being displayed)
Guys, as the subject suggests, i have turned on validation via:

The reason I've set dynamic to true is because if an xml file does not include a schema to validate against, then I do NOT want to validate the xml file, however, if a schema has been specified, then i want to validate the xml file. The problem is that the xml files are never validated regardless of whether or not an xml file has specified a schema. (I've also sabotaged a few xml files to deliberately introduce known errors into the xml so i can see if it has been validated).
Thanks for any information.
Edit:
I forgot to say which parser: Its Xerces 1.4 using the DOM Parser.
[This message has been edited by michael shea (edited November 11, 2001).]