Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Delivered-To: moderator for cocoon-dev@xml.apache.org Received: (qmail 97110 invoked from network); 26 Oct 2000 15:29:53 -0000 Received: from dodo.prod.itd.earthlink.net (207.217.120.99) by locus.apache.org with SMTP; 26 Oct 2000 15:29:51 -0000 Received: from firstech.com (hsa232.pool006.at001.earthlink.net [216.249.77.232]) by dodo.prod.itd.earthlink.net (8.9.3/8.9.3) with ESMTP id IAA10027; Thu, 26 Oct 2000 08:24:17 -0700 (PDT) Message-ID: <39F84DE2.D8FE55E5@firstech.com> Date: Thu, 26 Oct 2000 08:29:38 -0700 From: Gary L Peskin Organization: The Firstech Corporation X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: xalan-dev@xml.apache.org CC: cocoon-dev@xml.apache.org Subject: Re: AW: Xalan2: XpathAPI Problem References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Carsten Ziegeler wrote: > After a little bit of investigation I found out the really difference between > your example and mine is the namespaceURI of the node in question. > In your example it is simply null (no object), in my example it is an empty > string of length 0. > So I assume that the testing of the namespaceURI in XalanJ2 only test for null > or not null and not for an empty string. Carsten -- I saw Joe's earlier message about null namespaces and I just wanted to add a little something after looking at your example. I notice that you use org.apache.cocoon.xml.dom.DomBuilder to build the DOM. The problem is that in SAX2, if there is no namespace associated with an element, startElement is called with a zero length string (http://www.megginson.com/SAX/Java/javadoc/org/xml/sax/ContentHandler.html#startElement). This is not a null value for the namespaceURI parameter but an empty string (ie ""). However, DOM Level 2 (http://www.w3.org/TR/2000/PR-DOM-Level-2-Core-20000927/core.html#Namespaces-Considerations) specifies: "Note that because the DOM does no lexical checking, the empty string will be treated as a real namespace URI in DOM Level 2 methods. Applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace." It is up to your (or DOMBuilder's) startElement method to take the empty string passed to it and convert that to a null when calling createElementNS. It does not seem to do that in it's present implementation. So, DOMBuilder.startElement() is actually telling createElementNS to create an element with a namespaceURI of the empty string. Because of the problems that this entails, which Joe mentioned, this is probably not a good thing. If you are going to continue to use DOMBuilder, you might want to submit this correction. Then your XPathAPI call should work with no problems. HTH, Gary