<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#copied {background-color:#ccccff;}
tr.alt #copied {background-color:#bbbbf7;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="5">Commit in <b><tt>asxsd/trunk/src</tt></b></td></tr>
<tr><td><tt>main/java/uk/co/badgersinfoil/asxsd/<a href="#file1">MappingRegistryFactory.java</a></tt> </td><td></td><td align="right" id="added">+4</td><td></td><td nowrap="nowrap" align="center">170 -> 171</td></tr>
<tr class="alt"><td><tt>main/java/uk/co/badgersinfoil/asxsd/components/<a href="#file2"><span id="added">AttributeGroupComponent.java</span></a></tt> </td><td></td><td align="right" id="added">+28</td><td></td><td nowrap="nowrap" align="right">added 171</td></tr>
<tr><td><tt> /<a href="#file3"><span id="added">AttributeGroupReferenceComponent.java</span></a></tt> </td><td></td><td align="right" id="added">+27</td><td></td><td nowrap="nowrap" align="right">added 171</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/asxsd/schemas/<a href="#file4"><span id="added">AttributeGroupTest.java</span></a></tt> </td><td></td><td align="right" id="added">+18</td><td></td><td nowrap="nowrap" align="right">added 171</td></tr>
<tr><td><tt>test/resources/xsd/<a href="#file5"><span id="added">AttributeGroupTest.xsd</span></a></tt> </td><td></td><td align="right" id="added">+13</td><td></td><td nowrap="nowrap" align="right">added 171</td></tr>
<tr><td></td><td></td><td align="right" id="added">+90</td><td></td><td></td></tr>
</table>
<small id="info">4 added + 1 modified, total 5 files</small><br />
<div class="tasklist"><ul>
<li><a href="#task1">TODO: ideally an interface should be created for the attribute group, so that marshal/unmarshal code can be shared by all uses</a></li>
<li><a href="#task2">TODO: wildcards?</a></li>
<li><a href="#task3">TODO: a reference to an attribute group would ideally cause the given type to implement a shared interface, and delegate to shared marshal/unmarshal functions</a></li>
</ul></div>
<pre class="comment">
simplistic attributeGroup support
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd</span><br />
<div class="fileheader"><big><b>MappingRegistryFactory.java</b></big> <small id="info">170 -> 171</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/asxsd/MappingRegistryFactory.java        2007-10-14 22:13:57 UTC (rev 170)
+++ trunk/src/main/java/uk/co/badgersinfoil/asxsd/MappingRegistryFactory.java        2007-10-14 23:02:12 UTC (rev 171)
@@ -7,6 +7,8 @@
</small></pre><pre class="diff" id="context"> import uk.co.badgersinfoil.asxsd.components.ArrayElementDeclarationComponent;
import uk.co.badgersinfoil.asxsd.components.ArrayTypeDeclarationComponent;
import uk.co.badgersinfoil.asxsd.components.AttributeDeclarationComponent;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.asxsd.components.AttributeGroupComponent;
+import uk.co.badgersinfoil.asxsd.components.AttributeGroupReferenceComponent;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.asxsd.components.AttributeUseComponent;
import uk.co.badgersinfoil.asxsd.components.BooleanSimpleTypeComponent;
import uk.co.badgersinfoil.asxsd.components.ChoiceMappingComponent;
</pre><pre class="diff"><small id="info">@@ -65,6 +67,8 @@
</small></pre><pre class="diff" id="context">                 reg.register(new ComplexTypeComponent());
                reg.register(new AttributeUseComponent());
                reg.register(new AttributeDeclarationComponent());
</pre><pre class="diff" id="added">+                reg.register(new AttributeGroupReferenceComponent());
+                reg.register(new AttributeGroupComponent());
</pre><pre class="diff" id="context">                 reg.register(new ModelGroupParticleComponent());
                reg.register(new UnionSimpleTypeComponent());
                return reg;
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added">asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd/components</span><br />
<div class="fileheader" id="added"><big><b>AttributeGroupComponent.java</b></big> <small id="info">added at 171</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/AttributeGroupComponent.java         (rev 0)
+++ trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/AttributeGroupComponent.java        2007-10-14 23:02:12 UTC (rev 171)
@@ -0,0 +1,28 @@
</small></pre><pre class="diff" id="added">+package uk.co.badgersinfoil.asxsd.components;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDConcreteComponent;
+import uk.co.badgersinfoil.asxsd.CodegenContext;
+
<a name="task1" />+// <span class="task">TODO</span>: ideally an interface should be created for the attribute group, so that marshal/unmarshal code can be shared by all uses
+
+public class AttributeGroupComponent extends AbstractMappingComponent {
+
+        public void generateCode(CodegenContext context,
+         XSDConcreteComponent component)
+        {
+                XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)component;
+                List attrUses = attrGroup.getAttributeUses();
+                for (Iterator i=attrUses.iterator(); i.hasNext(); ) {
+                        context.generateCode((XSDAttributeUse)i.next());
+                }
<a name="task2" />+                // <span class="task">TODO</span>: wildcards?
+        }
+
+        public boolean willAccept(XSDConcreteComponent component) {
+                return component instanceof XSDAttributeGroupDefinition;
+        }
+}
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="added">asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd/components</span><br />
<div class="fileheader" id="added"><big><b>AttributeGroupReferenceComponent.java</b></big> <small id="info">added at 171</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/AttributeGroupReferenceComponent.java         (rev 0)
+++ trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/AttributeGroupReferenceComponent.java        2007-10-14 23:02:12 UTC (rev 171)
@@ -0,0 +1,27 @@
</small></pre><pre class="diff" id="added">+package uk.co.badgersinfoil.asxsd.components;
+
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import uk.co.badgersinfoil.asxsd.CodegenContext;
+import uk.co.badgersinfoil.asxsd.CodegenRole;
+
<a name="task3" />+// <span class="task">TODO</span>: a reference to an attribute group would ideally cause the given type to implement a shared interface, and delegate to shared marshal/unmarshal functions
+
+public class AttributeGroupReferenceComponent extends AbstractMappingComponent {
+
+        public void generateCode(CodegenContext context,
+         XSDConcreteComponent component)
+        {
+                CodegenRole role = context.getCurrentRole();
+                context.generateCode(resolve(component));
+        }
+        
+        private static XSDAttributeGroupDefinition resolve(XSDConcreteComponent component) {
+                return ((XSDAttributeGroupDefinition)component).getResolvedAttributeGroupDefinition();
+        }
+
+        public boolean willAccept(XSDConcreteComponent component) {
+                return component instanceof XSDAttributeGroupDefinition
+                 && ((XSDAttributeGroupDefinition)component).isAttributeGroupDefinitionReference();
+        }
+}
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="added">asxsd/trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas</span><br />
<div class="fileheader" id="added"><big><b>AttributeGroupTest.java</b></big> <small id="info">added at 171</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas/AttributeGroupTest.java         (rev 0)
+++ trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas/AttributeGroupTest.java        2007-10-14 23:02:12 UTC (rev 171)
@@ -0,0 +1,18 @@
</small></pre><pre class="diff" id="added">+package uk.co.badgersinfoil.asxsd.schemas;
+
+import uk.co.badgersinfoil.metaas.dom.ASClassType;
+import uk.co.badgersinfoil.metaas.dom.ASCompilationUnit;
+import uk.co.badgersinfoil.metaas.dom.ASField;
+
+public class AttributeGroupTest extends SchemaTestCase {
+        public void testClassName() {
+                ASCompilationUnit unit = (ASCompilationUnit)project.getCompilationUnits().get(0);
+                ASClassType clazz = (ASClassType)unit.getType();
+                assertEquals("Test", clazz.getName());
+
+                ASField a = clazz.getField("a");
+                assertEquals("String", a.getType());
+                ASField b = clazz.getField("b");
+                assertEquals("String", b.getType());
+        }
+}
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname" id="added">asxsd/trunk/src/test/resources/xsd</span><br />
<div class="fileheader" id="added"><big><b>AttributeGroupTest.xsd</b></big> <small id="info">added at 171</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/resources/xsd/AttributeGroupTest.xsd         (rev 0)
+++ trunk/src/test/resources/xsd/AttributeGroupTest.xsd        2007-10-14 23:02:12 UTC (rev 171)
@@ -0,0 +1,13 @@
</small></pre><pre class="diff" id="added">+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://example.org/test"
+ xmlns:t="http://example.org/test">
+ <attributeGroup name="TestAttrGrp">
+ <attribute name="b" type="string"/>
+ </attributeGroup>
+
+ <complexType name="Test">
+ <attribute name="a" type="string"/>
+ <attributeGroup ref="t:TestAttrGrp"/>
+ </complexType>
+</schema>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.12</small></center>
</body></html>