geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r430380 - /geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
Date Thu, 10 Aug 2006 13:41:08 GMT
Author: jstrachan
Date: Thu Aug 10 06:41:08 2006
New Revision: 430380

URL: http://svn.apache.org/viewvc?rev=430380&view=rev
Log:
bug fix for XBEAN-42 so that the generated XSDs can be used with validation and spring 2 to
create beans with id attributes

Modified:
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java

Modified: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java?rev=430380&r1=430379&r2=430380&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
(original)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
Thu Aug 10 06:41:08 2006
@@ -103,10 +103,22 @@
                 generateElementMappingComplexPropertyAsRef(out, attributeMapping);
             }
         }
+        generateIDAttributeMapping(out, namespaceMapping, element);
+
         out.println("      <xs:anyAttribute namespace='##other' processContents='lax'/>");
         out.println("    </xs:complexType>");
         out.println("  </xs:element>");
         out.println();
+    }
+
+    private void generateIDAttributeMapping(PrintWriter out, NamespaceMapping namespaceMapping,
ElementMapping element) {
+        for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();)
{
+            AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
+            if ("id".equals(attributeMapping.getAttributeName())) {
+                return;
+            }
+        }
+        out.println("      <xs:attribute name='id' type='xs:ID'/>");
     }
 
     private void generateElementMappingSimpleProperty(PrintWriter out, AttributeMapping attributeMapping)
{



Mime
View raw message