cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <>
Subject C2: Problems with SQLTransformer and Xerces solved
Date Fri, 04 Aug 2000 12:39:30 GMT

after some experimenting with the SQLTransformer I found out the following:

The problems are not based on the Transformer itself but on Xerces. Using the following simple
XML-File, Xerces generates wrong endElement()-Events:

<?xml version="1.0"?>

<html xmlns:sql="">

			select * from user

In version 1.1.2 of Xerces the SQLTransformer receives an endElement() event with 
uri="", name="sql:execute-query" and raw="sql:execute-query".
So the name attribute is wrong and you get a SAXException: Raw/Local Name mismatch.

In version 1.1.3 of Xerves this bug is fixed but there is still another bug, as the SQLTransformer
now receives an endElement() event with uri="", name="body"
and raw="body".
In this case the uri is wrong. The SQLTransformer now gets his uri and then assumes body is
the value element.

The following diff of the SQLTransformer performs an additional check. If the incoming element
is not one of those 
the SQLTransformer recognizes (execute-query, query, ancestor-value, value) the endElement()
method passes this to super.

So the end of the endElement() method should look like this:
        if (name.equals(MAGIC_EXECUTE_QUERY)) {
        } else if (name.equals(MAGIC_QUERY)) {
		} else if (name.equals(MAGIC_ANCESTOR_VALUE)) {
		} else if (name.equals("value")) {  // THIS CHECK IS NEW
		} else {
                    super.endElement(uri, name, raw); // SEND IT TO SUPER

This patch only works if you update from Xerces 1.1.2 to version 1.1.3. If you want to use
Xerces 1.1.2 you have to add  the following lines at the beginning of endElement():
       if (!uri.equals(my_uri)) {
        int pos = name.indexOf(":");                 // THIS PATCH IS NEW
        if (pos != -1) name = name.substring(pos+1);

I don't know if the Xerces bug is known to the Xerces development team as the mailinglists
are currently still down. Perhaps someone in this list can give them a hint.

Carsten Ziegeler

Open Source Group              sunShine - Lighting up e:Business
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn                  

...this mail was scanned for viruses by mailserver...

View raw message