Dennis is right in that the most robust solution at this point probably is to accept both null and "" to indicate the empty/default namespace, since historically this was not clearly defined (either by the specs, or by StaxTest test suite).
For what it's worth, the consensus regarding this issue, last time it was discussed on stax-builders list , was that null should be returned; and thus both Woodstox and the ref. impl., behave this way, with the latest builds (2.9.3 wstx, 1.2rc2). I do not know if sjsxp behaves this way, but change should be easy. StaxTest test suite, likewise, now expects this behavior as the correct one. There is one more thing to be aware of: QName implementations do not like nulls at all, so whenever you get a QName instance, you generally never get nulls, just empty strings. ;-/ -+ Tatu +- --- Dennis Sosnoski <[EMAIL PROTECTED]> wrote: > I believe this is actually an error in XMLBeans, > given that the StAX > specification doesn't specify the result. I ran into > this when adding > StAX support to JiBX. From what I saw the reference > implementation > always returns null for the no-namespace namespace, > while the other > implementations return an empty string. XMLBeans > should accept either > result. > > There's been discussion of a StAX 1.1 specification, > which would > hopefully clean up some of the many ambiguities and > oversights in the > current specification. AFAIK this is stuck in limbo, > though, because BEA > owns the specification and as I understand it > they're the ones who'd > need to initiate the 1.1 JSR. > > - Dennis > > Dennis M. Sosnoski > SOA, Web Services, and XML > Training and Consulting > http://www.sosnoski.com - http://www.sosnoski.co.nz > Seattle, WA +1-425-296-6194 - Wellington, NZ > +64-4-298-6117 > > > > Davanum Srinivas wrote: > > > Ajith, > > > > Do you have a stripped down test that we can use > to chase the woodstox > > folks for a fix? > > > > thanks, > > dims > > > > On 5/13/06, Ajith Ranabahu > <[EMAIL PROTECTED]> wrote: > > > >> Hi all, > >> I've found that the cause of numerous bug reports > concerning the > >> deserililzation of XMLBeans is actually an issue > with the > >> getNamespaceURI(int index) method of the > pullparser where it returns > >> null for the empty namespace URI. XMLBeans > assumes the uri is never > >> null but the reader implementations (including > the wstx implementation > >> that we use inside Axis2) return null for the > empty namespace URI. I > >> can work around the bug but this is one fine > point that should get > >> very clear about :) > >> > >> The Javadoc for XMLStreamReader is silent on this > >> > (https://stax-utils.dev.java.net/nonav/javadoc/api/javax/xml/stream/XMLStreamReader.html#getNamespaceURI(int)) > > >> > >> but since the empty namespace is decalred with an > empty string, I > >> would say it should return an empty string rather > than a null! > >> > >> Thoughts ? > >> > >> -- > >> Ajith Ranabahu > >> > >> PS - From a very quick test I've found out that > the change occurred in > >> the transition of wstx version 2.8 to 2.9 - wstx > 2.8.* returns "" but > >> 2.9.* returns null!. > >> > > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
