axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jake Goulding (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-3910) "Namespace URI may not be null" when parsing attributes
Date Mon, 14 Jul 2008 19:40:31 GMT
"Namespace URI may not be null" when parsing attributes
-------------------------------------------------------

                 Key: AXIS2-3910
                 URL: https://issues.apache.org/jira/browse/AXIS2-3910
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: Jake Goulding


org.apache.axis2.AxisFault: Namespace URI may not be null
 at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
 at vivisimo.Stub.fromOM(Stub.java:46095)
 at vivisimo.Stub.Simple(Stub.java:194)
 at Main.main(Main.java:75)
Caused by: java.lang.IllegalArgumentException: Namespace URI may not be null
 at org.apache.axiom.om.impl.dom.NamespaceImpl.<init>(NamespaceImpl.java:32)
 at org.apache.axiom.om.impl.dom.NamespaceImpl.<init>(NamespaceImpl.java:38)
 at vivisimo.Stub$Document_type0$Factory.parse(Stub.java:40060)
 at vivisimo.Stub$List_type0$Factory.parse(Stub.java:23215)
 at vivisimo.Stub$Vce$Factory.parse(Stub.java:2113)
 at vivisimo.Stub.fromOM(Stub.java:46089) 

Looking at the code, it comes from this section: 

// now run through all any or extra attributes
// which were not reflected until now
for (int i=0; i < reader.getAttributeCount(); i++) {
 if (!handledAttributes.contains(reader.getAttributeLocalName(i))) {
   // this is an anyAttribute and we create
   // an OMAttribute for this

   org.apache.axiom.om.impl.llom.OMAttributeImpl attr =
     new org.apache.axiom.om.impl.llom.OMAttributeImpl(
       reader.getAttributeLocalName(i),
       new org.apache.axiom.om.impl.dom.NamespaceImpl(
         reader.getAttributeNamespace(i), reader.getAttributePrefix(i)),
       reader.getAttributeValue(i),
       org.apache.axiom.om.OMAbstractFactory.getOMFactory());

The node that is causing the failure is:

<vce xmlns="urn:/vivisimo/velocity">
<list path="" num="118" level="0" start="0" per="10">
<document url="http://blogs.usatoday.com/popcandy/2008/07/pop-forum-tal-2.html" rank="0"
source="USAToday" score="0.111111" context="v%3astate=%28root%29%7croot&amp;v%3aframe=tree&amp;subquery=id%3aNdoc1.30&amp;active%3d=root&amp;v%3asubsearch=1&amp;"
/>
</list>
</vce>

The problematic attribute is @context, which is not defined in my XSD.

In all, I think there are 2 problems:

1/ I don't actually have an anyAttribute in my schema, so I would have expected to see an
error similar to the "unexpected subelement" error.
2/ I don't think that this should cause my program to generate an exception in this manner.
According to the spec:

"The namespace name for an unprefixed attribute name always has no value." [1] 

On further reading of the spec, I think that this sentence makes it more clear what should
happen:

"Default namespace declarations do not apply directly to attribute names; the interpretation
of unprefixed attributes is determined by the element on which they appear"

That is, the code should be something like:

if (namespace uri of attribute == null)
  use namespace uri of containing element 

[1] http://www.w3.org/TR/xml-names/#defaulting


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message