Does anyone know if this bug has been reported and/or fixed since the version of Xerces I am using? I’m using 2.6.0.

 

The problem is this:

 

I have some code that goes like this:

                                    m_grammar=loadGrammar();

 

                                    m_model=m_grammar.toXSModel();

                                    m_typeMap=m_model.getComponents(XSConstants.TYPE_DEFINITION);

 

                                    // This is a nasty bug in xerces.  I suspect that somewhere under the

                                    // covers it is doing an equality test using == instead of .equals().

                                    for (int i=0;i<m_model.getNamespaces().getLength();i++)

                                    {

                                                //System.out.println(i + ":" + m_model.getNamespaces().item(i));

                                                if (m_model.getNamespaces().item(i).equals(m_typeNamespace))

                                                {

                                                            m_typeNamespace = m_model.getNamespaces().item(i);

                                                }

                                    }

 

Now note that later on I do this line:

 

namedMap = m_model.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION, typeNamespace);

 

If I don’t have my nasty hack, I don’t return everything for the appropriate namespace.  “typeNamespace” happens to be the same string (identity) as the m_typeNamespace.  I’m pretty sure that this is a case of “==” instead of “.equals()” somewhere in getComponentsByNamespace().

 

My workaround is doing just fine, but it should be fixed. ;)

 

Thanks,

 

Reply via email to