<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/components/<a href="#file1">SimpleContentComponent.java</a></tt> </td><td></td><td align="right" id="added">+9</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">169 -&gt; 170</td></tr>
<tr class="alt"><td><tt>test/java/uk/co/badgersinfoil/asxsd/schemas/<a href="#file2">SimpleContentTest.java</a></tt> </td><td></td><td align="right" id="added">+6</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">169 -&gt; 170</td></tr>
<tr><td><tt>test/resources/xsd/<a href="#file3">SimpleContentTest.xsd</a></tt> </td><td></td><td align="right" id="added">+17</td><td></td><td nowrap="nowrap" align="center">169 -&gt; 170</td></tr>
<tr><td></td><td></td><td align="right" id="added">+32</td><td align="right" id="removed">-10</td><td></td></tr>
</table>
<small id="info">3 modified files</small><br />
<pre class="comment">
also handle anonymous complexType's that have simpleContent
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd/components</span><br />
<div class="fileheader"><big><b>SimpleContentComponent.java</b></big> <small id="info">169 -&gt; 170</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/SimpleContentComponent.java        2007-10-14 21:53:56 UTC (rev 169)
+++ trunk/src/main/java/uk/co/badgersinfoil/asxsd/components/SimpleContentComponent.java        2007-10-14 22:13:57 UTC (rev 170)
@@ -11,6 +11,7 @@
</small></pre><pre class="diff" id="context"> import uk.co.badgersinfoil.asxsd.StringUtils;
 import uk.co.badgersinfoil.asxsd.TypeBuilder;
 import uk.co.badgersinfoil.asxsd.UnmarshalBuilder;
</pre><pre class="diff" id="added">+import uk.co.badgersinfoil.asxsd.XSDUtils;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASClassType;
 import uk.co.badgersinfoil.metaas.dom.ASField;
 import uk.co.badgersinfoil.metaas.dom.StatementContainer;
</pre><pre class="diff"><small id="info">@@ -58,12 +59,15 @@
</small></pre><pre class="diff" id="context">         public String variableNameFor(CodegenContext context,
                                       XSDConcreteComponent component)
         {
</pre><pre class="diff" id="removed">-                String typeName = context.createTypeNameFor(component.getContainer());
-                int pos = typeName.lastIndexOf('.');
-                if (pos &gt; 0) {
-                        typeName = typeName.substring(pos + 1);
</pre><pre class="diff" id="added">+                XSDComplexTypeDefinition containingType = (XSDComplexTypeDefinition)component.getContainer();
+                String name;
+                if (XSDUtils.isAnonymous(containingType)) {
+                        XSDElementDeclaration elementDecl = (XSDElementDeclaration)containingType.getContainer();
+                        name = elementDecl.getName();
+                } else {
+                        name = containingType.getName();
</pre><pre class="diff" id="context">                 }
</pre><pre class="diff" id="removed">-                return typeName + "Value";
</pre><pre class="diff" id="added">+                return StringUtils.sanitize(name) + "Value";
</pre><pre class="diff" id="context">         }
 
 
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">asxsd/trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas</span><br />
<div class="fileheader"><big><b>SimpleContentTest.java</b></big> <small id="info">169 -&gt; 170</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas/SimpleContentTest.java        2007-10-14 21:53:56 UTC (rev 169)
+++ trunk/src/test/java/uk/co/badgersinfoil/asxsd/schemas/SimpleContentTest.java        2007-10-14 22:13:57 UTC (rev 170)
@@ -1,19 +1,20 @@
</small></pre><pre class="diff" id="context"> package uk.co.badgersinfoil.asxsd.schemas;
 
 import uk.co.badgersinfoil.metaas.dom.ASClassType;
</pre><pre class="diff" id="removed">-import uk.co.badgersinfoil.metaas.dom.ASCompilationUnit;
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASField;
 
 public class SimpleContentTest extends SchemaTestCase {
</pre><pre class="diff" id="removed">-        public void testClassName() {
-                ASCompilationUnit unit = (ASCompilationUnit)project.getCompilationUnits().get(0);
-                ASClassType clazz = (ASClassType)unit.getType();
-                assertEquals("Test", clazz.getName());
</pre><pre class="diff" id="added">+        public void testIt() {
+                ASClassType clazz = getTestASClass();
</pre><pre class="diff" id="context"> 
                 ASField field = clazz.getField("prop");
                 assertEquals("String", field.getType());
 
                 ASField body = clazz.getField("TestValue");
                 assertEquals("String", body.getType());
</pre><pre class="diff" id="added">+                
+                ASClassType elemClazz = (ASClassType)findType("org.example.test.Element_TestElem");
+                ASField elemBody = elemClazz.getField("TestElemValue");
+                assertEquals("String", elemBody.getType());
</pre><pre class="diff" id="context">         }
 }
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname">asxsd/trunk/src/test/resources/xsd</span><br />
<div class="fileheader"><big><b>SimpleContentTest.xsd</b></big> <small id="info">169 -&gt; 170</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/resources/xsd/SimpleContentTest.xsd        2007-10-14 21:53:56 UTC (rev 169)
+++ trunk/src/test/resources/xsd/SimpleContentTest.xsd        2007-10-14 22:13:57 UTC (rev 170)
@@ -9,4 +9,21 @@
</small></pre><pre class="diff" id="context">       &lt;/extension&gt;
     &lt;/simpleContent&gt;
   &lt;/complexType&gt;
</pre><pre class="diff" id="added">+  
+  &lt;!-- just so that there's a reference to TestElem --&gt;
+  &lt;complexType name="Blah"&gt;
+    &lt;sequence&gt;
+      &lt;element ref="t:TestElem"/&gt;
+    &lt;/sequence&gt;
+  &lt;/complexType&gt;
+
+  &lt;element name="TestElem"&gt;
+    &lt;complexType&gt;
+      &lt;simpleContent&gt;
+        &lt;extension base="string"&gt;
+          &lt;attribute name="prop" type="string"/&gt;
+        &lt;/extension&gt;
+      &lt;/simpleContent&gt;
+    &lt;/complexType&gt;
+  &lt;/element&gt;
</pre><pre class="diff" id="context"> &lt;/schema&gt;
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.12</small></center>
</body></html>