xml doctypes 2

Posted by anton
on Tuesday, July 18, 2006

something that bit me recently: editing sqlmap-config.xml for ibatis and getting strange xml validation errors during deployment:

Error parsing XML. org.xml.sax.SAXParseException: Element type "sqlMapConfig" must be declared.

the file looked perfectly fine and myeclipse happily validated it (i could change a property and get a validation error), however, during deployment it failed

it turns out that the problem was in the DOCTYPE declaration. what i had was

<!DOCTYPE sqlMapConfig
  PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
  "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

what i should have had was

<!DOCTYPE sqlMapConfig
  PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
  "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

a small typo that cost me a couple of hours of grief and confusion. reading up on it here, i learned that what threw me off was a Formal Public Identifier (FPI) that has the following syntax

"Owner//Keyword Description//Language"

therefore my description was incorrect. once it was fixed, everything worked as expected.

i suppose i knew that browsers, for instance, use the doctype description to figure out which parser to use, but i guess in this case i expected a gentle warning message in the console, a soft friendly whisper from the IDE - not globs of violent stacktraces.

Comments

Leave a response

  1. KenAugust 10, 2007 @ 03:48 PM
    Thank you! I had spent hours on a similar problem and this saved me.
  2. DaveJanuary 30, 2008 @ 11:18 AM
    Thanks as well. I probably would have spent hours, but googling found your note, and saved me.
Comment