You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2006/05/18 19:37:06 UTC

[jira] Resolved: (XERCESJ-1165) Problem resolving namespace prefix for QName, suspected bug in NamespaceSupport

     [ http://issues.apache.org/jira/browse/XERCESJ-1165?page=all ]
     
Michael Glavassevich resolved XERCESJ-1165:
-------------------------------------------

    Resolution: Incomplete

Not Xerces, but something derived from it. Java 5 contains a Sun repackaged (com.sun.org.apache.xerces.internal.*) fork of the Xerces codebase.  It has quite a different implementation of JAXP 1.3 than the Apache version, including bugs which have never existed in Xerces.  If this problem is in Java 5, there's nothing we can do it about it here. You would need to report the problem to Sun to get that fixed. If you actually run into this problem with Xerces 2.8.0, please re-open this issue.

> Problem resolving namespace prefix for QName, suspected bug in NamespaceSupport
> -------------------------------------------------------------------------------
>
>          Key: XERCESJ-1165
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1165
>      Project: Xerces2-J
>         Type: Bug

>   Components: XML Schema API
>     Versions: 2.8.0
>  Environment: Windows XP SP2, JRE 1.5.0_06
>     Reporter: Jonathan Mezach

>
> I think I found a bug in the NamespaceSupport class which is part of Xerces2-J. I'm working on a project which involves elements which have a QName as type. Let me just write some XML to clarify:
> <xbrli:xbrl xmlns:iso4217="http://www.xbrl.org/2003/iso4217">
>  <xbrli:unit id="EUR">
>   <xbrli:measure>iso4217:EUR</xbrli:measure>
>  </xbrli:unit>
> </xbrli:xbrl>
> I'm trying to validate this using JAXP with the Xerces implementation. The schema for the measure element is as follows:
> <xsd:element name="measure" type="QName"/>
> Now, when the validation is run an exception is thrown which reads as follows:
> UndeclaredPrefix: Cannot resolve 'iso4217:EUR' as a QName: the prefix 'iso4217' is not declared.
> This is quite strange because the namespace prefix is clearly declared at the top level element. So I decided to have a debug through the code and found that the problem is in the NamespaceSupport class. At the bottom of the getActualValue method of the QNameDV class the method getURI is called on the ValidationContext that was passed to it. This eventually calls the getURI(String) method on the NamespaceSupport class. The code here reads as follows:
> 1.       // find prefix in current context
> 2.        for (int i = fNamespaceSize; i > 0; i -= 2) {
> 3.            if (fNamespace[i - 2] == prefix) {
> 4.                return fNamespace[i - 1];
> 5.            }
> 6.        }
> 7.
> 8.        // prefix not found
> 9.        return null;
> The fNamespace instance variable is a String array and the prefix argument is a String as well. This leads me to conclude that line 3 of the above code should have been written as follows:
> if (fNamespace[i -2].equals(prefix)) {
> String comparison in Java is done using the equals method rather than the equals operator as far as I know.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org