You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Jason E. Fabritz" <ja...@pmel.noaa.gov> on 2000/10/25 01:36:50 UTC

Xalan-J bug

Hi, I think I have run across a namespace reporting bug, if not at least
confusing behavior by the Transformer regarding the way it generates SAX
2.0 Events.  For example if I am expecting output like:


<?xml version="1.0" encoding="UTF-8" ?> 
   <meta:items
	xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
	xmlns:meta="uri://pmel.noaa.gov/xml/metadata-database" 
	action="merge" 
	xsi:schemaLocation="uri://pmel.noaa.gov/xml/metadata-database 
                            meta://metadatabase-schema.xml">

      <meta:item name="TestExperiment" type="experiment">
         <meta:item name="NB-DOMES10-" type="cruise">

My SAX event sniffer gives me the following if it is the ContentHandler
of the Transformer:

startDocument()

startPrefixMapping()
	prefix=xsi
	uri=http://www.w3.org/1999/XMLSchema-instance

startPrefixMapping()	
	prefix=meta
	uri=uri://pmel.noaa.gov/xml/metadata-database

startElement()	
	localName=[items]	
	qName=[meta:items]
	namespaceURI=[uri://pmel.noaa.gov/xml/metadata-database]

Attribute:	
	localName: [xsi]	
	QName: [xmlns:xsi]	
	Type: [CDATA]
	URI: [http://www.w3.org/2000/xmlns/]
	Value: [http://www.w3.org/1999/XMLSchema-instance]

Attribute:	
	localName: [meta]	
	QName: [xmlns:meta]	
	Type: [CDATA]
	URI: [http://www.w3.org/2000/xmlns/]
	Value: [uri://pmel.noaa.gov/xml/metadata-database]

Attribute:	
	localName: [action]	
	QName: [action]	
	Type: [CDATA]	
	URI: []
	Value: [merge]

Attribute:	
	localName: [schemaLocation]	
	QName: [xsi:schemaLocation]
	Type: [CDATA]	
	URI: [http://www.w3.org/1999/XMLSchema-instance]
	Value: [uri://pmel.noaa.gov/xml/metadata-database 
			meta://metadatabase-schema.xml]


startElement()	
	localName=[item]	
	qName=[meta:item]
	namespaceURI=[null]  <<<<<<< THIS IS THE CONFUSING PART

Attribute:	
	localName: [name]	
	QName: [name]	
	Type: [CDATA]	
	URI: []
	Value: [TestExperiment]

Attribute:	
	localName: [type]	
	QName: [type]	
	Type: [CDATA]	
	URI: []
	Value: [experiment]


startElement()	
	localName=[item]	
	qName=[meta:item]
	namespaceURI=[null]  <<<<<< Again .....

.... etc, etc .....

But if I route the SAX events to the Serializer (file on disk) and then
reload it throught the Xerces 1.2 XMLReader I get the following:

setDocumentLocator()

startDocument()

startPrefixMapping()	
	prefix=xsi
	uri=http://www.w3.org/1999/XMLSchema-instance

startPrefixMapping()	
	prefix=meta
	uri=uri://pmel.noaa.gov/xml/metadata-database

startElement()	
	localName=[items]	
	qName=[meta:items]
	namespaceURI=[uri://pmel.noaa.gov/xml/metadata-database]

Attribute:	
	localName: [xsi]	
	QName: [xmlns:xsi]	
	Type: [CDATA]
	URI: []	Value: [http://www.w3.org/1999/XMLSchema-instance]

Attribute:	
	localName: [meta]	
	QName: [xmlns:meta]	
	Type: [CDATA]
	URI: []	Value: [uri://pmel.noaa.gov/xml/metadata-database]

Attribute:	
	localName: [action]	
	QName: [action]	
	Type: [CDATA]	
	URI: []
	Value: [merge]

Attribute:	
	localName: [schemaLocation]	
	QName: [xsi:schemaLocation]
	Type: [CDATA]	URI: [http://www.w3.org/1999/XMLSchema-instance]
	Value: [uri://pmel.noaa.gov/xml/metadata-database
		meta://metadatabase-schema.xml]

startElement()	
	localName=[item]	
	qName=[meta:item]
	namespaceURI=[uri://pmel.noaa.gov/xml/metadata-database] << GOOD

Attribute:	
	localName: [name]	
	QName: [name]	
	Type: [CDATA]	
	URI: []
	Value: [TestExperiment]

Attribute:	
	localName: [type]	
	QName: [type]	
	Type: [NMTOKENS]
	URI: []	
	Value: [experiment]


startElement()	
	localName=[item]	
	qName=[meta:item]
	namespaceURI=[uri://pmel.noaa.gov/xml/metadata-database] << GOOD


.... etc, etc ....

I don't understand what it is about the org.apache.serialize.Serializer
that can take the output from the Transformer and serialize it to a file
properly when It looks like the Transformer is passing a null value for
the URI (which I think is against the spec in the first place, I thought
it need to be an empty string if it were undefined)

Also, I've noticed another interesting feature, If I have a default output
namespace, I have to make the namespace declaration in the
<xsl:stylesheet> tag for the SAX events to appear as expected.  If I save
it for, say an <xsl:template> tag, then I get the behavior above (meaning,
the root tag URI is specified, but all the children receive a null value).

Please forgive me if this is a misunderstanding on my part regarding the
SAX spec, I'm trying my hardest to keep up.  I can try to provide specific
sample code if necessary.

Sincerly,

Jason Fabritz
JIASO/PMEL
University of Washington.


Re: Xalan-J bug

Posted by Gary L Peskin <ga...@firstech.com>.
"Jason E. Fabritz" wrote:
> 
> Hi, I think I have run across a namespace reporting bug, if not at least
> confusing behavior by the Transformer regarding the way it generates SAX
> 2.0 Events.  For example if I am expecting output like:

Jason --

I recreated your output on XalanJ2 and the SAX events are being called
properly.  Which version of Xalan are you using?

Gary

Re: Xalan-J bug

Posted by Gary L Peskin <ga...@firstech.com>.
"Jason E. Fabritz" wrote:
> 
> Hi, I think I have run across a namespace reporting bug, if not at least
> confusing behavior by the Transformer regarding the way it generates SAX
> 2.0 Events.

Jason --

What version of Xalan are you using?

Gary