• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

SAX validating error only on 2nd try

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm seeing a weird behavior in the SAX validation that fails after succeeding the first time. I appreciate any help on this.

So I have the XMLReader and have it parse & validate the same XML document twice. It will complain only on the second try with:

Error: URI = "null", Line = "5", : cvc-elt.1: Cannot find the declaration of element 'row'.

Here's my sample program. Btw, I'm using JDK 1.5.0_10 on Windows XP:



Here are the schema and xml file I'm using:





[ January 25, 2007: Message edited by: Alan W. Smith ]
[ January 25, 2007: Message edited by: Alan W. Smith ]
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then I would suggest creating a new XMLReader for each document you want to parse.
 
Alan W. Smith
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would prefer not having to recreate a new XMLReader each time I want to validate/parse a document. Also, according to the documentation, I can reuse the XMLReader object. Am I using this incorrectly?

Originally posted by Paul Clapham:
Then I would suggest creating a new XMLReader for each document you want to parse.

 
Paul Clapham
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Alan W. Smith:
I would prefer not having to recreate a new XMLReader each time I want to validate/parse a document.

Why not?

Also, according to the documentation, I can reuse the XMLReader object. Am I using this incorrectly?

Yes, the documentation does say that, doesn't it? And as far as I can see you're using it correctly -- what else would you have to do? Well, I suppose you could call setProperty() on it again before reusing it, but that doesn't sound right to me. If that doesn't work then to me it looks like a bug.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!