This patch fixes bug: Castor 0.9.4.2 builder generates erroneous xmlName
for 
top level attributes referenced by an element. I just lifted this code
from similar code in ElementDecl.java.

Please see attached testcase.


Hugh Winkler
BetweenMarkets Inc.


---
castor-0.9.4.2/src/main/org/exolab/castor/xml/schema/AttributeDecl.java
Thu Jan 16 18:53:50 2003
+++
castor-0.9.4.2-bmi/src/main/org/exolab/castor/xml/schema/AttributeDecl.j
ava     Fri Jan 31 23:58:35 2003
@@ -206,9 +206,15 @@
     **/
     public String getName(boolean ignoreRef) {
         if (isReference() && ignoreRef == false) {
-            return _attributeRef;
+            String localName = _attributeRef;
+            //-- check for namespace prefix
+            int idx = localName.indexOf(':');
+            if (idx > 0) {
+                localName = localName.substring(idx+1);
         }
-               else return _name;
+            return localName;
+        }
+        return _name;
     } //-- getName
 
     /**

Attachment: castor-attribute-ns-bug.zip
Description: castor-attribute-ns-bug.zip

Reply via email to