logo       

[jira] Commented: (XERCESJ-1165) Problem resolving namespace prefix for QNa: msg#00016

Subject: [jira] Commented: (XERCESJ-1165) Problem resolving namespace prefix for QName, suspected bug in NamespaceSupport
    [ 
http://issues.apache.org/jira/browse/XERCESJ-1165?page=comments#action_12412378 
] 

Jonathan Mezach commented on XERCESJ-1165:
------------------------------------------

I see. I didn't notice this because for some reason, my debugger (Eclipse) 
doesn't show me any local variables. But anyway, I am in fact using the 
validator in Java 5, but isn't that in fact Xerces. As far as I can tell, the 
Xerces implementation is used when validating. Unfortunately I'm not able to 
check it right now.

> 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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe