Here's a patch to resolve addAttribute problem. I confirmed that this patch
works fine with the Address example. 

Thanks,

Ias.
> 
> -----Original Message-----
> From: WWW [mailto:[EMAIL PROTECTED] On Behalf Of Jochen Wiedmann
> Sent: Friday, August 01, 2003 12:19 AM
> To: Ias
> Cc: [EMAIL PROTECTED]
> 
> 
> Hi, Ias,
> 
> thanks, the preferred prefix should indeed be considered. 
> I'll add your patch to the CVS tonight. Same for the JWSDP 
> 1.2 patch. I'll have to think a little bit about the attribute issue.
> 
> 
> Kind regards,
> 
> Jochen
> 
> 
Index: ComplexTypeSGImpl.java
===================================================================
RCS file: 
/cvsroot/jaxme/JaxMe2/src/net/sf/jaxme/generator/javasg/types/ComplexTypeSGImpl.java,v
retrieving revision 1.8
diff -u -r1.8 ComplexTypeSGImpl.java
--- ComplexTypeSGImpl.java      12 May 2003 19:47:09 -0000      1.8
+++ ComplexTypeSGImpl.java      4 Aug 2003 09:45:31 -0000
@@ -310,16 +310,21 @@
     Set uris = new HashSet();
     for (int i = 0;  i < pData.getNumOfAttributes();  i++) {
       SchemaAttribute attr = pData.getAttribute(i);
-      String uri = attr.getQName().getNamespaceURI();
+      QName qname = attr.getQName();
+      String uri = qname.getNamespaceURI();
       if (uri == null) { uri = ""; }
-
+         String prefix = qname.getPrefix();
+         if (prefix == null) { prefix = ""; }
+         
       // Skip, if this namespace was already processed.
       if (uris.contains(uri)) {
         continue;
       }
 
       jm.addLine((uris.isEmpty() ? "" : "} else "),
-                 "if (", JavaSource.getQuoted(uri), ".equals(pURI)) {");
+                 "if (", JavaSource.getQuoted(uri), ".equals(pURI)",
+                 (prefix.equals("") ? " || \"\".equals(pURI)": ""),
+                 ") {");
       jm.indent();
       for (int j = i;  j < pData.getNumOfAttributes();  j++) {
         attr = pData.getAttribute(j);

Reply via email to