Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
None
-
None
-
None
-
Java 1.6 included Xerces: com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
Description
A certain attribute is not transferred back properly through the SAX interface. I ran the parsing of one and the same XML first with Xerces and then with Crimson. Please find the isolated code including the XML string below.
Somehow the attribute following the wrong one is mixing in.
I hope it's not me doing some foolish thing...
This is the test class
======================
package org.eclnt.zztest;
import java.io.StringReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class TestParser
{
public static class MyParser extends DefaultHandler
{
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException
{
super.startElement(uri, localName, name, attributes);
System.out.println("ELEMENT: " + name);
for (int i=0; i<attributes.getLength(); i++)
}
}
public static void main(String[] args)
{
String s =
"<t:modalpopup id='g_24'"+
" bgpaint='#
" actionListener='#{eclntdefscr.modalPopups[0].onPopupClosedByUser}'"+
" height='#{eclntdefscr.modalPopups[0].height}'"+
" opened='#{eclntdefscr.modalPopups[0].opened}'"+
" title='#{eclntdefscr.modalPopups[0].title}'"+
" undecorated='#{eclntdefscr.modalPopups[0].undecorated}'"+
" width='#{eclntdefscr.modalPopups[0].width}'"+
" harryleft='#{eclntdefscr.modalPopups[0].left}'"+
" harrytop='#{eclntdefscr.modalPopups[0].top}'"+
" >"+
"</t:modalpopup>";
try
{ SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); System.out.println("Parser = " + saxParser.getClass().getName()); InputSource is = new InputSource(new StringReader(s)); saxParser.parse(is,new MyParser()); }
catch (Throwable t)
{ t.printStackTrace(); }
}
}
This is the output with XERCES parser (included in Java 1.6):
=============================================================
Parser = com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
ELEMENT: t:modalpopup
id = g_24
bgpaint = #{eclntdefscr.modalPopups[0].bgpaint}
actionListener = #
{eclntdefscr.modalPopups[0].onPopupClosedByUser}height = #{eclntdefscr.modalPopups[0].height}
opened = #{eclntdefscr.modalPopups[0].opened}
title = #{eclntdefscr.modalPopups[0].title}
undecorated = #{eclntdefscr.modalPopups[0].undecorated}
width = #{eclntdefscr.modalPopups[0].left}}
harryleft = #{eclntdefscr.modalPopups[0].left}
harrytop = #{eclntdefscr.modalPopups[0].top}
This is the output with CRIMSON parser:
=======================================
Parser = org.apache.crimson.jaxp.SAXParserImpl
ELEMENT: t:modalpopup
id = g_24
bgpaint = #{eclntdefscr.modalPopups[0].bgpaint}
actionListener = #{eclntdefscr.modalPopups[0].onPopupClosedByUser}
height = #
{eclntdefscr.modalPopups[0].height}opened = #
{eclntdefscr.modalPopups[0].opened}title = #
{eclntdefscr.modalPopups[0].title}undecorated = #
{eclntdefscr.modalPopups[0].undecorated}width = #
{eclntdefscr.modalPopups[0].width}harryleft = #{eclntdefscr.modalPopups[0].left}
harrytop = #{eclntdefscr.modalPopups[0].top}
Please focus on the line with "width":
======================================
Xerces : width = #{eclntdefscr.modalPopups[0].left}}
Crimson: width = #{eclntdefscr.modalPopups[0].width}