[jboss-svn-commits] JBoss Common SVN: r2919 - in jbossxb/tags: 2.0.0.CR14 and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 10 20:29:49 EDT 2008


Author: alex.loubyansky at jboss.com
Date: 2008-09-10 20:29:49 -0400 (Wed, 10 Sep 2008)
New Revision: 2919

Added:
   jbossxb/tags/2.0.0.CR14/
   jbossxb/tags/2.0.0.CR14/pom.xml
   jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java
   jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.java
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/loginconfig/
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java
   jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xml
   jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsd
   jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles.xml
   jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd
Removed:
   jbossxb/tags/2.0.0.CR14/pom.xml
   jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java
   jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
   jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java
   jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd
Log:
[maven-release-plugin]  copy for tag 2.0.0.CR14

Copied: jbossxb/tags/2.0.0.CR14 (from rev 2913, jbossxb/trunk)

Deleted: jbossxb/tags/2.0.0.CR14/pom.xml
===================================================================
--- jbossxb/trunk/pom.xml	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/pom.xml	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,143 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>3</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>jbossxb</artifactId>
-  <packaging>jar</packaging>
-  <version>2.0.0-SNAPSHOT</version>
-  <name>JBoss XML Binding</name>
-  <url>http://www.jboss.org</url>
-  <description>JBoss XML Binding</description>
-  <scm>
-    <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/trunk</connection>
-  </scm>
-  <build>
-    <finalName>jboss-xml-binding</finalName>
-    <plugins>
-      <plugin>
-        <artifactId>maven-release-plugin</artifactId>
-        <configuration>
-          <!-- The tagBase property is needed during the release process so that the maven release plugin
-            will create the release tag in the appropriate location. -->
-          <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <testFailureIgnore>true</testFailureIgnore>
-          <redirectTestOutputToFile>true</redirectTestOutputToFile>
-          <includes>
-            <include>**/*TestCase.java</include>
-          </includes>
-          <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
-        </configuration>
-      </plugin>    
-    </plugins>
-  </build>  
-  <repositories>
-    <repository>
-      <id>repository.jboss.org</id>
-      <name>JBoss Repository</name>
-      <layout>default</layout>
-      <url>http://repository.jboss.org/maven2/</url>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-    <repository>
-      <id>snapshots.jboss.org</id>
-      <name>JBoss Snapshot Repository</name>
-      <layout>default</layout>
-      <url>http://snapshots.jboss.org/maven2/</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-
-  <dependencies>
-  
-    <dependency>
-      <groupId>org.jboss.logging</groupId>
-      <artifactId>jboss-logging-spi</artifactId>
-      <version>2.0.5.GA</version>
-      <scope>compile</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-common-core</artifactId>
-      <version>2.2.8.GA</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-reflect</artifactId>
-      <version>2.0.0.CR1</version>
-      <scope>compile</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>jboss</groupId>
-          <artifactId>jboss-common-logging-spi</artifactId>
-        </exclusion>
-      </exclusions>      
-    </dependency>
-
-    <dependency>
-      <groupId>apache-xerces</groupId>
-      <artifactId>xml-apis</artifactId>
-      <version>2.9.1</version>
-      <scope>compile</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>apache-xerces</groupId>
-      <artifactId>xercesImpl</artifactId>
-      <version>2.9.1</version>
-      <scope>compile</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>wutka-dtdparser</groupId>
-      <artifactId>dtdparser121</artifactId>
-      <version>1.2.1</version>
-      <scope>compile</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>javax.activation</groupId>
-      <artifactId>activation</artifactId>
-      <version>1.0.2</version>
-      <scope>compile</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>sun-jaxb</groupId>
-      <artifactId>jaxb-api</artifactId>
-      <version>2.1.4</version>
-      <scope>compile</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss.test</groupId>
-      <artifactId>jboss-test</artifactId>
-      <version>1.1.1.GA</version>
-      <scope>test</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
-    </dependency>
-    
-  </dependencies>
-</project>

Copied: jbossxb/tags/2.0.0.CR14/pom.xml (from rev 2918, jbossxb/trunk/pom.xml)
===================================================================
--- jbossxb/tags/2.0.0.CR14/pom.xml	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/pom.xml	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,143 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>3</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jbossxb</artifactId>
+  <packaging>jar</packaging>
+  <version>2.0.0.CR14</version>
+  <name>JBoss XML Binding</name>
+  <url>http://www.jboss.org</url>
+  <description>JBoss XML Binding</description>
+  <scm>
+    <connection>scm:svn:https://svn.jboss.org/repos/common/jbossxb/tags/2.0.0.CR14</connection>
+  </scm>
+  <build>
+    <finalName>jboss-xml-binding</finalName>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <!-- The tagBase property is needed during the release process so that the maven release plugin
+            will create the release tag in the appropriate location. -->
+          <tagBase>https://svn.jboss.org/repos/common/jbossxb/tags</tagBase>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <testFailureIgnore>true</testFailureIgnore>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+          <includes>
+            <include>**/*TestCase.java</include>
+          </includes>
+          <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
+        </configuration>
+      </plugin>    
+    </plugins>
+  </build>  
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Repository</name>
+      <layout>default</layout>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshot Repository</name>
+      <layout>default</layout>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <dependencies>
+  
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <version>2.0.5.GA</version>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <version>2.2.8.GA</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-reflect</artifactId>
+      <version>2.0.0.CR1</version>
+      <scope>compile</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>jboss</groupId>
+          <artifactId>jboss-common-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>      
+    </dependency>
+
+    <dependency>
+      <groupId>apache-xerces</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>2.9.1</version>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>apache-xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <version>2.9.1</version>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>wutka-dtdparser</groupId>
+      <artifactId>dtdparser121</artifactId>
+      <version>1.2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <version>1.0.2</version>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>sun-jaxb</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.1.4</version>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.1.1.GA</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    
+  </dependencies>
+</project>

Deleted: jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/group/ValueList.java	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,229 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.xb.binding.group;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import javax.xml.namespace.QName;
-
-import org.jboss.xb.binding.JBossXBRuntimeException;
-import org.jboss.xb.binding.metadata.PropertyMetaData;
-import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
-import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtUtil;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public class ValueList
-{
-   private final ValueListInitializer initializer;
-   private final ValueListHandler handler;
-   private final Class<?> targetClass;
-   //private final int requiredTotal;
-
-   //private final Object[] requiredValues;
-   //private int state;
-   //private Map nonRequiredValues = Collections.EMPTY_MAP;
-   //private List nonRequiredBindings;
-   private List nonRequiredValues = Collections.EMPTY_LIST;
-
-   ValueList(ValueListInitializer initializer, ValueListHandler handler, Class<?> targetClass)
-   {
-      this.initializer = initializer;
-      this.handler = handler;
-      this.targetClass = targetClass;
-      //this.requiredTotal = initializer.getRequiredBindings().size();
-      //requiredValues = new Object[requiredTotal];
-   }
-
-   void setRequiredValue(int index, int stateIncrement, Object value)
-   {
-      throw new UnsupportedOperationException();
-/*
-      if(index >= requiredTotal)
-      {
-         throw new JBossXBRuntimeException(
-            "Maximum argument index for this value list is " + requiredTotal + " but got " + index
-         );
-      }
-      requiredValues[index] = value;
-      state += stateIncrement;
-*/
-   }
-
-   Object getRequiredValue(int index)
-   {
-/*
-      if(index >= requiredTotal)
-      {
-         throw new JBossXBRuntimeException(
-            "Maximum argument index for this value list is " + requiredTotal + " but got " + index
-         );
-      }
-      return requiredValues[index];
-*/
-      throw new UnsupportedOperationException();
-   }
-
-   int getState()
-   {
-//      return state;
-      throw new UnsupportedOperationException();
-   }
-
-   void setAttributeValue(QName qName, AttributeBinding binding, Object value)
-   {
-      setNonRequiredValue(qName, binding, null, value, null);
-   }
-
-   void addTextValue(QName qName, ParticleBinding particle, CharactersHandler handler, Object value)
-   {
-      setNonRequiredValue(qName, particle, handler, value, null);
-   }
-
-   void addTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle)
-   {
-      setNonRequiredValue(qName, binding, handler, value, parentParticle);
-   }
-
-   void addRepeatableTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle)
-   {
-      NonRequiredValue last = (NonRequiredValue) (nonRequiredValues.isEmpty() ? null : nonRequiredValues.get(nonRequiredValues.size() - 1));
-      if (last == null /*|| last.binding != binding*/)
-      {
-         Collection col;
-         PropertyMetaData propMetaData = binding.getTerm().getPropertyMetaData();
-         if(propMetaData != null && propMetaData.getCollectionType() != null)
-         {
-            Class<?> colCls = RtUtil.loadClass(propMetaData.getCollectionType(), true);
-            try
-            {
-               col = (Collection) colCls.newInstance();
-            }
-            catch (Exception e)
-            {
-               throw new JBossXBRuntimeException("Failed to create an instance of " + colCls.getName() + " for property " + propMetaData.getName());
-            }
-         }
-         else
-         {
-            col = new ArrayList();
-         }
-         
-         col.add(value);
-         setNonRequiredValue(qName, binding, handler, col, parentParticle);
-      }
-      else
-      {
-         Collection col = (Collection) last.value;
-         col.add(value);
-      }
-   }
-
-   void setNonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle)
-   {
-      NonRequiredValue val = new NonRequiredValue(qName, binding, handler, value, parentParticle);
-      switch(nonRequiredValues.size())
-      {
-         case 0:
-            nonRequiredValues = Collections.singletonList(val);
-            break;
-         case 1:
-            nonRequiredValues = new ArrayList<Object>(nonRequiredValues);
-         default:
-            nonRequiredValues.add(val);
-      }
-   }
-
-   Object getNonRequiredValue(QName qName)
-   {
-//      return nonRequiredValues.get(qName);
-      throw new UnsupportedOperationException();
-   }
-
-   public ValueListInitializer getInitializer()
-   {
-      return initializer;
-   }
-
-   public List<?> getRequiredValues()
-   {
-//      return Arrays.asList(requiredValues);
-      throw new UnsupportedOperationException();
-   }
-
-   public Map<?, ?> getNonRequiredValues()
-   {
-//      return nonRequiredValues;
-      throw new UnsupportedOperationException();
-   }
-
-   public List<?> getNonRequiredBindings()
-   {
-//      return nonRequiredBindings;
-      throw new UnsupportedOperationException();
-   }
-
-   public ValueListHandler getHandler()
-   {
-      return handler;
-   }
-
-   public Class<?> getTargetClass()
-   {
-      return targetClass;
-   }
-
-   public NonRequiredValue getValue(int i)
-   {
-      return (NonRequiredValue)nonRequiredValues.get(i);
-   }
-
-   public int size()
-   {
-      return nonRequiredValues.size();
-   }
-
-   public static final class NonRequiredValue
-   {
-      public final QName qName;
-      public final Object binding;
-      public final Object handler;
-      public Object value;
-      public ParticleBinding parentParticle;
-
-      public NonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle)
-      {
-         this.qName = qName;
-         this.binding = binding;
-         this.handler = handler;
-         this.value = value;
-         this.parentParticle = parentParticle;
-      }
-   }
-}

Copied: jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java (from rev 2917, jbossxb/trunk/src/main/java/org/jboss/xb/binding/group/ValueList.java)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/group/ValueList.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,247 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.xb.binding.group;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.metadata.PropertyMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtUtil;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class ValueList
+{
+   private final ValueListInitializer initializer;
+   private final ValueListHandler handler;
+   private final Class<?> targetClass;
+   //private final int requiredTotal;
+
+   //private final Object[] requiredValues;
+   //private int state;
+   //private Map nonRequiredValues = Collections.EMPTY_MAP;
+   //private List nonRequiredBindings;
+   private List nonRequiredValues = Collections.EMPTY_LIST;
+
+   ValueList(ValueListInitializer initializer, ValueListHandler handler, Class<?> targetClass)
+   {
+      this.initializer = initializer;
+      this.handler = handler;
+      this.targetClass = targetClass;
+      //this.requiredTotal = initializer.getRequiredBindings().size();
+      //requiredValues = new Object[requiredTotal];
+   }
+
+   void setRequiredValue(int index, int stateIncrement, Object value)
+   {
+      throw new UnsupportedOperationException();
+/*
+      if(index >= requiredTotal)
+      {
+         throw new JBossXBRuntimeException(
+            "Maximum argument index for this value list is " + requiredTotal + " but got " + index
+         );
+      }
+      requiredValues[index] = value;
+      state += stateIncrement;
+*/
+   }
+
+   Object getRequiredValue(int index)
+   {
+/*
+      if(index >= requiredTotal)
+      {
+         throw new JBossXBRuntimeException(
+            "Maximum argument index for this value list is " + requiredTotal + " but got " + index
+         );
+      }
+      return requiredValues[index];
+*/
+      throw new UnsupportedOperationException();
+   }
+
+   int getState()
+   {
+//      return state;
+      throw new UnsupportedOperationException();
+   }
+
+   void setAttributeValue(QName qName, AttributeBinding binding, Object value)
+   {
+      setNonRequiredValue(qName, binding, null, value, null);
+   }
+
+   void addTextValue(QName qName, ParticleBinding particle, CharactersHandler handler, Object value)
+   {
+      setNonRequiredValue(qName, particle, handler, value, null);
+   }
+
+   void addTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle)
+   {
+      setNonRequiredValue(qName, binding, handler, value, parentParticle);
+   }
+
+   void addRepeatableTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle)
+   {
+      NonRequiredValue last = (NonRequiredValue) (nonRequiredValues.isEmpty() ? null : nonRequiredValues.get(nonRequiredValues.size() - 1));
+      
+      boolean isSameBinding;
+      if(last == null)
+         isSameBinding = false;
+      else if(last.binding == binding)
+         isSameBinding = true;
+      else if(!(last.binding instanceof ParticleBinding))
+         isSameBinding = false;
+      else
+      {
+         ParticleBinding lastBinding = (ParticleBinding) last.binding;
+         if(lastBinding.getTerm().isElement() && binding.getTerm().isElement())
+            isSameBinding = ((ElementBinding)lastBinding.getTerm()).getQName().equals(((ElementBinding)binding.getTerm()).getQName());
+         else
+            isSameBinding = false;
+      }
+      
+      if (!isSameBinding)
+      {
+         Collection col;
+         PropertyMetaData propMetaData = binding.getTerm().getPropertyMetaData();
+         if(propMetaData != null && propMetaData.getCollectionType() != null)
+         {
+            Class<?> colCls = RtUtil.loadClass(propMetaData.getCollectionType(), true);
+            try
+            {
+               col = (Collection) colCls.newInstance();
+            }
+            catch (Exception e)
+            {
+               throw new JBossXBRuntimeException("Failed to create an instance of " + colCls.getName() + " for property " + propMetaData.getName());
+            }
+         }
+         else
+         {
+            col = new ArrayList();
+         }
+         
+         col.add(value);
+         setNonRequiredValue(qName, binding, handler, col, parentParticle);
+      }
+      else
+      {
+         Collection col = (Collection) last.value;
+         col.add(value);
+      }
+   }
+
+   void setNonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle)
+   {
+      NonRequiredValue val = new NonRequiredValue(qName, binding, handler, value, parentParticle);
+      switch(nonRequiredValues.size())
+      {
+         case 0:
+            nonRequiredValues = Collections.singletonList(val);
+            break;
+         case 1:
+            nonRequiredValues = new ArrayList<Object>(nonRequiredValues);
+         default:
+            nonRequiredValues.add(val);
+      }
+   }
+
+   Object getNonRequiredValue(QName qName)
+   {
+//      return nonRequiredValues.get(qName);
+      throw new UnsupportedOperationException();
+   }
+
+   public ValueListInitializer getInitializer()
+   {
+      return initializer;
+   }
+
+   public List<?> getRequiredValues()
+   {
+//      return Arrays.asList(requiredValues);
+      throw new UnsupportedOperationException();
+   }
+
+   public Map<?, ?> getNonRequiredValues()
+   {
+//      return nonRequiredValues;
+      throw new UnsupportedOperationException();
+   }
+
+   public List<?> getNonRequiredBindings()
+   {
+//      return nonRequiredBindings;
+      throw new UnsupportedOperationException();
+   }
+
+   public ValueListHandler getHandler()
+   {
+      return handler;
+   }
+
+   public Class<?> getTargetClass()
+   {
+      return targetClass;
+   }
+
+   public NonRequiredValue getValue(int i)
+   {
+      return (NonRequiredValue)nonRequiredValues.get(i);
+   }
+
+   public int size()
+   {
+      return nonRequiredValues.size();
+   }
+
+   public static final class NonRequiredValue
+   {
+      public final QName qName;
+      public final Object binding;
+      public final Object handler;
+      public Object value;
+      public ParticleBinding parentParticle;
+
+      public NonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle)
+      {
+         this.qName = qName;
+         this.binding = binding;
+         this.handler = handler;
+         this.value = value;
+         this.parentParticle = parentParticle;
+      }
+   }
+}

Deleted: jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,1555 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.xb.binding.sunday.unmarshalling;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.ListIterator;
-
-import javax.xml.namespace.QName;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.xb.binding.AttributesImpl;
-import org.jboss.xb.binding.Constants;
-import org.jboss.xb.binding.GenericValueContainer;
-import org.jboss.xb.binding.JBossXBRuntimeException;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.jboss.xb.binding.Util;
-import org.jboss.xb.binding.group.ValueList;
-import org.jboss.xb.binding.group.ValueListHandler;
-import org.jboss.xb.binding.group.ValueListInitializer;
-import org.jboss.xb.binding.group.ValueList.NonRequiredValue;
-import org.jboss.xb.binding.introspection.FieldInfo;
-import org.jboss.xb.binding.metadata.CharactersMetaData;
-import org.jboss.xb.binding.metadata.PropertyMetaData;
-import org.jboss.xb.binding.metadata.ValueMetaData;
-import org.jboss.xb.binding.parser.JBossXBParser;
-import org.jboss.xb.binding.sunday.xop.XOPIncludeHandler;
-import org.xml.sax.Attributes;
-
-/**
- * ContentHandler that is used as a sandbox for JBXB-76
- *
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public class SundayContentHandler
-   implements JBossXBParser.DtdAwareContentHandler
-{
-   private final static Logger log = Logger.getLogger(SundayContentHandler.class);
-
-   private final static Object NIL = new Object();
-
-   private final SchemaBinding schema;
-   private final SchemaBindingResolver schemaResolver;
-
-   private final StackImpl stack = new StackImpl();
-
-   private Object root;
-   private NamespaceRegistry nsRegistry = new NamespaceRegistry();
-
-   private ParticleHandler defParticleHandler = DefaultHandlers.ELEMENT_HANDLER;
-
-   private UnmarshallingContextImpl ctx = new UnmarshallingContextImpl();
-   // DTD information frm startDTD
-   private String dtdRootName;
-   private String dtdPublicId;
-   private String dtdSystemId;
-   private boolean sawDTD;
-
-   private final boolean trace = log.isTraceEnabled();
-
-   public SundayContentHandler(SchemaBinding schema)
-   {
-      this.schema = schema;
-      this.schemaResolver = null;
-   }
-
-   public SundayContentHandler(SchemaBindingResolver schemaResolver)
-   {
-      this.schemaResolver = schemaResolver;
-      this.schema = null;
-   }
-
-   
-   public void startDTD(String dtdRootName, String dtdPublicId, String dtdSystemId)
-   {
-      this.dtdRootName = dtdRootName;
-      this.dtdPublicId = dtdPublicId;
-      this.dtdSystemId = dtdSystemId;
-   }
-   public void endDTD()
-   {
-      this.sawDTD = true;
-   }
-
-   public void characters(char[] ch, int start, int length)
-   {
-      StackItem stackItem = stack.peek();
-      if(stackItem.cursor != null)
-      {
-         return;
-      }
-      
-      ElementBinding e = (ElementBinding) stackItem.particle.getTerm();
-/*      if(!stackItem.ended && e.getType().isTextContentAllowed())
-      {
-         int i = start;
-         while (i < start + length)
-         {
-            if(ch[i] == 0x0a)
-            {
-               stackItem.indentation = true;
-            }
-            else
-            {
-               if (ch[i] == ' ' || ch[i] == 0x0d)
-               {
-               }
-               else
-               {
-                  stackItem.indentation = false;
-                  break;
-               }
-            }
-            ++i;
-         }
-
-         if(!stackItem.indentation)
-         {
-            if (stackItem.textContent == null)
-            {
-               stackItem.textContent = new StringBuffer();
-            }
-            stackItem.textContent.append(ch, start, length);
-         }
-      }
-*/
-      // if current is ended the characters belong to its parent
-      if(stackItem.ended)
-      {
-         int i = 0;
-         do
-         {
-            stackItem = stack.peek(++i);
-         }
-         while(stackItem.cursor != null && i < stack.size());
-         
-         e = (ElementBinding) stackItem.particle.getTerm();
-      }
-
-      // collect characters only if they are allowed content
-      if(e.getType().isTextContentAllowed())
-      {
-         if(stackItem.indentation != Boolean.FALSE)
-         {
-            if(e.getType().isSimple())
-            {
-               // simple content is not analyzed
-               stackItem.indentation = Boolean.FALSE;
-               stackItem.ignorableCharacters = false;
-            }
-            else if(e.getSchema() != null && !e.getSchema().isIgnoreWhitespacesInMixedContent())
-            {
-               stackItem.indentation = Boolean.FALSE;
-               stackItem.ignorableCharacters = false;
-            }
-            else
-            {
-               // the indentation is currently defined as whitespaces with next line characters
-               // this should probably be externalized in the form of a filter or something
-               for (int i = start; i < start + length; ++i)
-               {
-                  if(ch[i] == 0x0a)
-                  {
-                     stackItem.indentation = Boolean.TRUE;
-                  }
-                  else if (!Character.isWhitespace(ch[i]))
-                  {
-                     stackItem.indentation = Boolean.FALSE;
-                     stackItem.ignorableCharacters = false;
-                     break;
-                  }
-               }
-            }
-         }
-         
-         if (stackItem.textContent == null)
-         {
-            stackItem.textContent = new StringBuffer();
-         }
-         stackItem.textContent.append(ch, start, length);
-      }
-   }
-
-   public void endElement(String namespaceURI, String localName, String qName)
-   {
-      ElementBinding elementBinding = null;
-      QName endName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName);
-      StackItem item;
-      while(true)
-      {
-         item = stack.peek();
-         if(item.cursor == null)
-         {
-            if(item.ended)
-            {
-               pop();
-               if(item.particle.isRepeatable())
-               {
-                  endRepeatableParticle(item.particle);
-               }
-            }
-            else
-            {
-               elementBinding = (ElementBinding)item.particle.getTerm();
-               item.ended = true;
-               break;
-            }
-         }
-         else
-         {
-            if(!item.ended) // could be ended if it's a choice
-            {
-               endParticle(item, endName, 1);
-            }
-
-            ParticleBinding currentParticle = item.cursor.getCurrentParticle();
-            TermBinding term = currentParticle.getTerm();
-            if(term.isWildcard() && currentParticle.isRepeatable())
-            {
-               endRepeatableParticle(currentParticle);
-            }
-
-            pop();
-            if(item.particle.isRepeatable())
-            {
-               endRepeatableParticle(item.particle);
-            }
-         }
-      }
-
-      if(elementBinding == null)
-      {
-         throw new JBossXBRuntimeException("Failed to endElement " + qName + ": binding not found");
-      }
-
-      if(!elementBinding.getQName().equals(endName))
-      {
-         throw new JBossXBRuntimeException("Failed to end element " +
-            new QName(namespaceURI, localName) +
-            ": element on the stack is " + elementBinding.getQName()
-         );
-      }
-
-      endElement();
-   }
-
-   public void startElement(String namespaceURI,
-                            String localName,
-                            String qName,
-                            Attributes atts,
-                            XSTypeDefinition xercesType)
-   {
-      QName startName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName);
-      ParticleBinding particle = null;
-      ParticleHandler handler = null;
-      TypeBinding parentType = null;
-      boolean repeated = false;
-      boolean repeatedParticle = false;
-      StackItem item = null;
-      ModelGroupBinding.Cursor cursor = null; // used only when particle is a wildcard
-      SchemaBinding schemaBinding = schema;
-
-      atts = preprocessAttributes(atts);
-      
-      if(stack.isEmpty())
-      {
-         if(schemaBinding != null)
-         {
-            particle = schemaBinding.getElementParticle(startName);
-         }
-         else if(schemaResolver != null)
-         {
-            String schemaLocation = atts == null ? null : Util.getSchemaLocation(atts, namespaceURI);
-            // Use the dtd info if it exists and there is no schemaLocation
-            if(sawDTD && (schemaLocation == null || schemaLocation.length() == 0))
-            {
-               schemaLocation = dtdSystemId;
-            }
-            // If there is still no schemaLocation, pass in the root local name
-            if(schemaLocation == null)
-               schemaLocation = localName;
-            schemaBinding = schemaResolver.resolve(namespaceURI, null, schemaLocation);
-            if(schemaBinding != null)
-            {
-               particle = schemaBinding.getElementParticle(startName);
-            }
-            else
-            {
-               throw new JBossXBRuntimeException("Failed to resolve schema nsURI=" + namespaceURI + " location=" + schemaLocation);
-            }
-         }
-         else
-         {
-            throw new JBossXBRuntimeException("Neither schema binding nor schema binding resolver is available!");
-         }
-      }
-      else
-      {
-         while(!stack.isEmpty())
-         {
-            item = stack.peek();
-            if(item.cursor == null)
-            {
-               TermBinding term = item.particle.getTerm();
-               ElementBinding element = (ElementBinding)term;
-               if(item.ended)
-               {
-                  if(element.getQName().equals(startName))
-                  {
-                     particle = item.particle;
-                     parentType = item.parentType;
-                     repeated = true;
-                     item.reset();
-
-                     if(!particle.isRepeatable())
-                     {
-                        endRepeatableParent(startName);
-                     }
-                  }
-                  else
-                  {
-                     pop();                     
-                     if(item.particle.isRepeatable())
-                     {
-                        endRepeatableParticle(item.particle);
-                     }
-                     continue;
-                  }
-               }
-               else
-               {
-                  parentType = element.getType();
-                  ParticleBinding typeParticle = parentType.getParticle();
-                  ModelGroupBinding modelGroup = typeParticle == null ? null : (ModelGroupBinding)typeParticle.getTerm();
-                  if(modelGroup == null)
-                  {
-                     if(startName.equals(Constants.QNAME_XOP_INCLUDE))
-                     {
-                        TypeBinding anyUriType = schema.getType(Constants.QNAME_ANYURI);
-                        if(anyUriType == null)
-                        {
-                           log.warn("Type " + Constants.QNAME_ANYURI + " not bound.");
-                        }
-
-                        TypeBinding xopIncludeType = new TypeBinding(new QName(Constants.NS_XOP_INCLUDE, "Include"));
-                        xopIncludeType.setSchemaBinding(schema);
-                        xopIncludeType.addAttribute(new QName("href"), anyUriType, DefaultHandlers.ATTRIBUTE_HANDLER);
-                        xopIncludeType.setHandler(new XOPIncludeHandler(parentType, schema.getXopUnmarshaller()));
-
-                        ElementBinding xopInclude = new ElementBinding(schema, Constants.QNAME_XOP_INCLUDE, xopIncludeType);
-
-                        particle = new ParticleBinding(xopInclude);
-                        
-                        ElementBinding parentElement = (ElementBinding) item.particle.getTerm();
-                        parentElement.setXopUnmarshaller(schema.getXopUnmarshaller());
-
-                        flushIgnorableCharacters();
-                        item.handler = DefaultHandlers.XOP_HANDLER;
-                        item.ignoreCharacters = true;
-                        item.o = item.handler.startParticle(stack.peek().o, startName, stack.peek().particle, null, nsRegistry);
-                        break;
-                     }
-
-                     QName typeName = parentType.getQName();
-                     throw new JBossXBRuntimeException((typeName == null ? "Anonymous" : typeName.toString()) +
-                        " type of element " +
-                        element.getQName() +
-                        " should be complex and contain " + startName + " as a child element."
-                     );
-                  }
-
-                  cursor = modelGroup.newCursor(typeParticle);
-                  List<ModelGroupBinding.Cursor> newCursors = cursor.startElement(startName, atts);
-                  if(newCursors.isEmpty())
-                  {
-                     throw new JBossXBRuntimeException(startName +
-                        " not found as a child of " +
-                        ((ElementBinding)term).getQName()
-                     );
-                  }
-                  else
-                  {
-                     flushIgnorableCharacters();
-
-                     Object o = item.o;
-                     // push all except the last one
-                     for(int i = newCursors.size() - 1; i >= 0; --i)
-                     {
-                        cursor = newCursors.get(i);
-
-                        ParticleBinding modelGroupParticle = cursor.getParticle();
-                        if(modelGroupParticle.isRepeatable())
-                        {
-                           startRepeatableParticle(startName, modelGroupParticle);
-                        }
-
-                        handler = getHandler(modelGroupParticle);
-                        o = handler.startParticle(o, startName, modelGroupParticle, atts, nsRegistry);
-                        push(cursor, o, handler, parentType);
-                     }
-                     particle = cursor.getCurrentParticle();
-                  }
-               }
-               break;
-            }
-            else
-            {
-               cursor = item.cursor;
-               if(cursor == null)
-               {
-                  throw new JBossXBRuntimeException("No cursor for " + startName);
-               }
-
-               // todo review
-               if(!item.ended && cursor.isPositioned() && cursor.getParticle().getTerm() instanceof ChoiceBinding)
-               {
-                  endParticle(item, startName, 1);
-                  if(!item.particle.isRepeatable()) // this is for repeatable choices that should stay on the stack
-                  {
-                     pop();
-                  }
-                  continue;
-               }
-
-               //int prevOccurence = cursor.getOccurence();
-               ParticleBinding prevParticle = cursor.isPositioned() ? cursor.getCurrentParticle() : null;
-               List<ModelGroupBinding.Cursor> newCursors = cursor.startElement(startName, atts);
-               if(newCursors.isEmpty())
-               {
-                  if(!item.ended) // this is for choices
-                  {
-                     endParticle(item, startName, 1);
-                  }
-                  pop();
-               }
-               else
-               {
-                  if(item.ended) // for repeatable choices
-                  {
-                     if(!item.particle.isRepeatable())
-                     {
-                        throw new JBossXBRuntimeException("The particle expected to be repeatable but it's not: " + item.particle.getTerm());
-                     }
-                     item.reset();
-                     
-                     handler = getHandler(item.particle);
-                     item.o = handler.startParticle(stack.peek(1).o, startName, item.particle, atts, nsRegistry);
-                  }
-                  
-                  ParticleBinding curParticle = cursor.getCurrentParticle();
-                  if(curParticle != prevParticle)
-                  {
-                     if(prevParticle != null && prevParticle.isRepeatable() && prevParticle.getTerm().isModelGroup())
-                     {
-                        endRepeatableParticle(prevParticle);
-                     }
-
-                     if(newCursors.size() > 1 && curParticle.isRepeatable())
-                     {
-                        startRepeatableParticle(startName, curParticle);
-                     }
-                  }
-                  else
-                  {
-                     repeatedParticle = true;
-                  }
-
-                  // push all except the last one
-                  parentType = item.parentType;
-                  Object o = item.o;
-                  for(int i = newCursors.size() - 2; i >= 0; --i)
-                  {
-                     cursor = newCursors.get(i);
-
-                     ParticleBinding modelGroupParticle = cursor.getParticle();
-                     handler = getHandler(modelGroupParticle);
-                     o = handler.startParticle(o, startName, modelGroupParticle, atts, nsRegistry);
-                     push(cursor, o, handler, parentType);
-                  }
-                  cursor = newCursors.get(0);
-                  particle = cursor.getCurrentParticle();
-                  break;
-               }
-            }
-         }
-      }
-
-      Object o = null;
-      if(particle != null)
-      {
-         Object parent = stack.isEmpty() ? null :
-            (repeated ? stack.peek(1).o : stack.peek().o);
-         if(particle.getTerm() instanceof WildcardBinding)
-         {
-            /*
-            WildcardBinding wildcard = (WildcardBinding)particle.getTerm();
-            ElementBinding element = wildcard.getElement(startName, atts);
-            */
-            ElementBinding element = cursor.getElement();
-            if(element == null)
-            {
-               throw new JBossXBRuntimeException("Failed to resolve element " +
-                  startName + " for wildcard."
-               );
-            }
-
-            if(!repeatedParticle && particle.isRepeatable())
-            {
-               startRepeatableParticle(startName, particle);
-            }
-            particle = new ParticleBinding(element/*, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded()*/);
-         }
-
-         ElementBinding element = (ElementBinding)particle.getTerm();
-
-         // todo xsi:type support should be implemented in a better way
-         String xsiType = atts.getValue("xsi:type");
-         if(xsiType != null)
-         {
-            if(trace)
-            {
-               log.trace(element.getQName() + " uses xsi:type " + xsiType);
-            }
-
-            String xsiTypePrefix;
-            String xsiTypeLocal;
-            int colon = xsiType.indexOf(':');
-            if(colon == -1)
-            {
-               xsiTypePrefix = "";
-               xsiTypeLocal = xsiType;
-            }
-            else
-            {
-               xsiTypePrefix = xsiType.substring(0, colon);
-               xsiTypeLocal = xsiType.substring(colon + 1);
-            }
-
-            String xsiTypeNs = nsRegistry.getNamespaceURI(xsiTypePrefix);
-            QName xsiTypeQName = new QName(xsiTypeNs, xsiTypeLocal);
-
-            TypeBinding xsiTypeBinding = schemaBinding.getType(xsiTypeQName);
-            if(xsiTypeBinding == null)
-            {
-               throw new JBossXBRuntimeException("Type binding not found for type " +
-                  xsiTypeQName +
-                  " specified with xsi:type for element " + startName
-               );
-            }
-
-            element = new ElementBinding(schemaBinding, startName, xsiTypeBinding);
-            particle =
-               new ParticleBinding(element,
-                  particle.getMinOccurs(),
-                  particle.getMaxOccurs(),
-                  particle.getMaxOccursUnbounded()
-               );
-         }
-
-         if(!repeated && particle.isRepeatable())
-         {
-            startRepeatableParticle(startName, particle);
-         }
-
-         TypeBinding type = element.getType();
-         if(type == null)
-         {
-            throw new JBossXBRuntimeException("No type for element " + element);
-         }
-
-         handler = type.getHandler();         
-         if(handler == null)
-         {
-            handler = defParticleHandler;
-         }
-
-         List<ElementInterceptor> localInterceptors = parentType == null ? Collections.EMPTY_LIST : parentType.getInterceptors(startName);         
-         List<ElementInterceptor> interceptors = element.getInterceptors();
-         if(interceptors.size() + localInterceptors.size() > 0)
-         {
-            if (repeated)
-            {
-               pop();
-            }
-
-            for (int i = 0; i < localInterceptors.size(); ++i)
-            {
-               ElementInterceptor interceptor = (ElementInterceptor) localInterceptors.get(i);
-               parent = interceptor.startElement(parent, startName, type);
-               push(particle, parent, handler, parentType);
-               interceptor.attributes(parent, startName, type, atts, nsRegistry);
-            }
-
-            for (int i = 0; i < interceptors.size(); ++i)
-            {
-               ElementInterceptor interceptor = (ElementInterceptor) interceptors.get(i);
-               parent = interceptor.startElement(parent, startName, type);
-               push(particle, parent, handler, parentType);
-               interceptor.attributes(parent, startName, type, atts, nsRegistry);
-            }
-
-            if (repeated)
-            {
-               // to have correct endRepeatableParticle calls
-               stack.push(item);
-            }
-         }
-
-         String nil = atts.getValue("xsi:nil");
-         if(nil == null || !("1".equals(nil) || "true".equals(nil)))
-         {
-            o = handler.startParticle(parent, startName, particle, atts, nsRegistry);
-         }
-         else
-         {
-            o = NIL;
-         }
-      }
-      else
-      {
-         ElementBinding parentBinding = null;
-         if(!stack.isEmpty())
-         {
-            ParticleBinding stackParticle = repeated ? stack.peek(1).particle : stack.peek().particle;
-            if(stackParticle != null)
-            {
-               parentBinding = (ElementBinding)stackParticle.getTerm();
-            }
-         }
-
-         if(parentBinding != null && parentBinding.getSchema() != null)
-         {
-            schemaBinding = parentBinding.getSchema();
-         }
-
-         String msg = "Element " +
-            startName +
-            " is not bound " +
-            (parentBinding == null ? "as a global element." : "in type " + parentBinding.getType().getQName());
-         if(schemaBinding != null && schemaBinding.isStrictSchema())
-         {
-            throw new JBossXBRuntimeException(msg);
-         }
-         else if(trace)
-         {
-            log.trace(msg);
-         }
-      }
-
-      if(repeated)
-      {
-         item.o = o;
-         // in case of collection of abstract types
-         item.particle = particle;
-      }
-      else
-      {
-         push(particle, o, handler, parentType);
-      }
-   }
-
-   private ParticleHandler getHandler(ParticleBinding modelGroupParticle)
-   {
-      ParticleHandler handler = ((ModelGroupBinding)modelGroupParticle.getTerm()).getHandler();
-      return handler == null ? defParticleHandler : handler;
-   }
-
-   private void endRepeatableParent(QName startName)
-   {
-      int parentPos = 1;
-      StackItem parentItem;
-      ParticleBinding parentParticle = null;
-      while(true)
-      {
-         parentItem = stack.peek(parentPos);
-         if(parentItem.cursor == null)
-         {
-            throw new JBossXBRuntimeException(
-               "Failed to start " + startName +
-               ": the element is not repeatable, repeatable parent expected to be a model group but got element " +
-               ((ElementBinding)parentItem.particle.getTerm()).getQName()
-            );
-         }
-
-         parentParticle = parentItem.particle;
-         if(parentParticle.isRepeatable())
-         {
-            break;
-         }
-
-         endParticle(parentItem, startName, ++parentPos);
-      }
-
-      if(!parentParticle.isRepeatable())
-      {
-         StringBuffer msg = new StringBuffer();
-
-         StackItem item = stack.peek();
-         ParticleBinding currentParticle = item.particle;
-         msg.append("Failed to start ").append(startName).append(": ")
-            .append(currentParticle.getTerm())
-            .append(" is not repeatable.")
-            .append(" Its parent ")
-            .append(parentParticle.getTerm())
-            .append(" expected to be repeatable!")
-            .append("\ncurrent stack: ");
-
-         for(int i = stack.size() - 1; i >= 0; --i)
-         {
-            item = stack.peek(i);
-            ParticleBinding particle = item.particle;
-            TermBinding term = particle.getTerm();
-            if(term.isModelGroup())
-            {
-               if(term instanceof SequenceBinding)
-               {
-                  msg.append("sequence");
-               }
-               else if(term instanceof ChoiceBinding)
-               {
-                  msg.append("choice");
-               }
-               else
-               {
-                  msg.append("all");
-               }
-            }
-            else if(term.isWildcard())
-            {
-               msg.append("wildcard");
-            }
-            else
-            {
-               msg.append(((ElementBinding)term).getQName());
-            }
-            msg.append("\\");
-         }
-
-         throw new JBossXBRuntimeException(msg.toString());
-      }
-
-      // todo startName is wrong here
-      endParticle(parentItem, startName, parentPos + 1);
-
-      parentItem = stack.peek(parentPos + 1);
-      while(parentPos > 0)
-      {
-         StackItem item = stack.peek(parentPos--);
-         ParticleHandler handler = getHandler(item.particle);
-         item.reset();
-         item.o = handler.startParticle(parentItem.o, startName, item.particle, null, nsRegistry);
-         parentItem = item;
-      }
-   }
-
-   private void startRepeatableParticle(QName startName, ParticleBinding particle)
-   {
-      if(trace)
-         log.trace(" start repeatable (" + stack.size() + "): " + particle.getTerm());
-      
-      TermBinding term = particle.getTerm();
-      if(term.isSkip())
-      {
-         return;
-      }
-      
-      StackItem item = stack.peek();
-      if(item.o != null &&
-            !(item.o instanceof GenericValueContainer) &&
-            (item.o instanceof Collection == false) &&
-            term.getAddMethodMetaData() == null &&
-            term.getMapEntryMetaData() == null &&
-            term.getPutMethodMetaData() == null)
-      {
-         ValueListHandler handler = ValueListHandler.FACTORY.lazy(item.o);
-         Class<?> cls = item.o.getClass();
-         item.repeatableParticleValue = new ValueListInitializer().newValueList(handler, cls);
-      }
-   }
-
-   private void endRepeatableParticle(ParticleBinding particle)
-   {
-      if(trace)
-         log.trace(" end repeatable (" + stack.size() + "): " + particle.getTerm());
-
-      StackItem item = stack.peek();
-      ValueList valueList = item.repeatableParticleValue;
-      if(valueList != null)
-      {
-         item.repeatableParticleValue = null;
-         if(valueList.size() == 0)
-         {
-            return;
-         }
-            
-         if(particle.getTerm().isWildcard())
-         {
-            ParticleHandler handler = null;
-/*
-            handler = ((WildcardBinding) particle.getTerm()).getWildcardHandler();
-            if (handler == null)
-            {
-               handler = defParticleHandler;
-            }
- */
-            
-            // that's not good. some elements can be handled as "unresolved" and some as "resolved"
-            QName qName = valueList.getValue(0).qName;
-            Collection<Object> col = new ArrayList<Object>();
-            for(int i = 0; i < valueList.size(); ++i)
-            {
-               NonRequiredValue value = valueList.getValue(i);
-               col.add(value.value);
-
-               if(handler != value.handler)
-               {
-                  if(handler == null && i == 0)
-                  {
-                     handler = (ParticleHandler) value.handler;
-                  }
-                  else
-                  {
-                     throw new JBossXBRuntimeException("Handlers in the list are supposed to be the same.");
-                  }
-               }
-            }
-
-            StackItem parentItem = stack.peek(1);
-            handler.setParent(parentItem.o, col, qName, particle, parentItem.particle);
-         }
-         else
-         {
-            valueList.getHandler().newInstance(particle, valueList);
-         }
-      }
-   }
-
-   private void endParticle(StackItem item, QName qName, int parentStackPos)
-   {
-      if(item.ended)
-      {
-         throw new JBossXBRuntimeException(item.particle.getTerm() + " has already been ended.");
-      }
-
-      ParticleBinding modelGroupParticle = item.particle;
-      ParticleHandler handler = item.handler;//getHandler(modelGroupParticle);
-
-      Object o;
-      if(item.o instanceof ValueList && !modelGroupParticle.getTerm().isSkip())
-      {
-         if(trace)
-         {
-            log.trace("endParticle " + modelGroupParticle.getTerm() + " valueList");
-         }
-         ValueList valueList = (ValueList)item.o;
-         o = valueList.getHandler().newInstance(modelGroupParticle, valueList);
-      }
-      else
-      {
-         o = handler.endParticle(item.o, qName, modelGroupParticle);
-      }
-
-      item.ended = true;
-
-      // model group should always have parent particle
-      item = (StackItem)stack.peek(parentStackPos);
-      if(item.o != null)
-      {
-         ParticleBinding parentParticle = getParentParticle();//item.particle;
-         if(parentParticle == null)
-         {
-            parentParticle = item.particle;
-         }
-         setParent(handler,
-               item.repeatableParticleValue == null ? item.o : item.repeatableParticleValue,
-               o, qName, modelGroupParticle, parentParticle);
-      }
-   }
-
-   public void startPrefixMapping(String prefix, String uri)
-   {
-      nsRegistry.addPrefixMapping(prefix, uri);
-   }
-
-   public void endPrefixMapping(String prefix)
-   {
-      nsRegistry.removePrefixMapping(prefix);
-   }
-
-   public void processingInstruction(String target, String data)
-   {
-   }
-
-   public Object getRoot()
-   {
-      return root;
-   }
-
-   // Private
-
-   private Attributes preprocessAttributes(Attributes attrs)
-   {
-      SchemaBindingResolver resolver = schemaResolver == null ? schema.getSchemaResolver() : schemaResolver;
-      if(resolver == null || !(resolver instanceof DefaultSchemaResolver))
-         return attrs;
-      
-      int ind = attrs.getIndex(Constants.NS_JBXB, "schemabinding");
-      if (ind != -1)
-      {
-         DefaultSchemaResolver defaultResolver = (DefaultSchemaResolver)resolver;
-         String value = attrs.getValue(ind);
-         java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(value);
-         while(tokenizer.hasMoreTokens())
-         {
-            String uri = tokenizer.nextToken();
-            if(!tokenizer.hasMoreTokens())
-               throw new JBossXBRuntimeException("jbxb:schemabinding attribute value is invalid: ns uri '" + uri + "' is missing value in '" + value + "'");
-            String cls = tokenizer.nextToken();
-            try
-            {
-               defaultResolver.addClassBinding(uri, cls);
-            }
-            catch (Exception e)
-            {
-               throw new JBossXBRuntimeException("Failed to addClassBinding: uri='" + uri + "', class='" + cls + "'", e);
-            }
-         }
-         
-         AttributesImpl attrsImpl = new AttributesImpl(attrs.getLength() - 1);
-         for(int i = 0; i < attrs.getLength(); ++i)
-         {
-            if(i != ind)
-               attrsImpl.add(attrs.getURI(i), attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i), attrs.getValue(i));
-         }
-         attrs = attrsImpl;
-      }
-      return attrs;
-   }
-   
-   private void flushIgnorableCharacters()
-   {
-      StackItem stackItem = stack.peek();
-      if(stackItem.cursor != null || stackItem.textContent == null)
-      {
-         return;
-      }
-
-      if(stackItem.indentation == Boolean.TRUE || stackItem.ignorableCharacters)
-      {
-         if(log.isTraceEnabled())
-         {
-            log.trace("ignored characters: " + ((ElementBinding) stackItem.particle.getTerm()).getQName() + " '"
-               + stackItem.textContent + "'");
-         }
-         stackItem.textContent = null;
-         stackItem.indentation = null;
-      }
-   }
-   
-   private ParticleBinding getParentParticle()
-   {
-      ListIterator<StackItem> iter = stack.prevIterator();
-      while(iter.hasPrevious())
-      {
-         StackItem prev = iter.previous();
-         ParticleBinding peeked = prev.particle;
-
-         TermBinding term = peeked.getTerm();
-         if(!term.isSkip())
-         {
-            return peeked;
-         }
-      }
-      return null;
-   }
-   
-   private void endElement()
-   {
-      StackItem item = stack.peek();
-      Object o = item.o;
-      ParticleBinding particle = item.particle;
-      
-      ElementBinding element = (ElementBinding)particle.getTerm();
-      QName endName = element.getQName();
-      TypeBinding type = element.getType();
-      List<ElementInterceptor> interceptors = element.getInterceptors();
-      int interceptorsTotal = interceptors.size();
-
-      List<ElementInterceptor> localInterceptors = item.parentType == null ? Collections.EMPTY_LIST : item.parentType.getInterceptors(endName);
-      int localInterceptorsTotal = localInterceptors.size();
-
-      if(o != NIL)
-      {
-         //
-         // characters
-         //
-
-         flushIgnorableCharacters();
-
-         TypeBinding charType = type.getSimpleType();
-         if(charType == null)
-         {
-            charType = type;
-         }
-
-         CharactersHandler charHandler = item.ignoreCharacters ? null : charType.getCharactersHandler();
-
-         /**
-          * If there is text content then unmarshal it and set.
-          * If there is no text content and the type is simple and
-          * its characters handler is not null then unmarshal and set.
-          * If the type is complex and there is no text data then the unmarshalled value
-          * of the empty text content is assumed to be null
-          * (in case of simple types that's not always true and depends on nillable attribute).
-          */
-         String textContent = item.textContent == null ? "" : item.textContent.toString();
-         if(textContent.length() > 0 || charHandler != null && !type.isIgnoreEmptyString())
-         {
-            String dataContent;
-            SchemaBinding schema = element.getSchema();
-            if(textContent.length() == 0)
-            {
-               dataContent = null;
-            }
-            else
-            {
-               dataContent = textContent.toString();
-               if(schema != null && schema.isReplacePropertyRefs())
-               {
-                  dataContent = StringPropertyReplacer.replaceProperties(dataContent);
-               }
-               
-               if(element.isNormalizeSpace())
-                  dataContent = dataContent.trim();
-            }
-
-            Object unmarshalled;
-
-            if(charHandler == null)
-            {
-               if(!type.isSimple() &&
-                  schema != null &&
-                  schema.isStrictSchema()
-                  // todo this isSkip() doesn't look nice here
-                  && !element.isSkip())
-               {
-                  throw new JBossXBRuntimeException("Element " +
-                     endName +
-                     " with type binding " +
-                     type.getQName() +
-                     " does not include text content binding: " + dataContent
-                  );
-               }
-               unmarshalled = dataContent;
-            }
-            else
-            {
-               ValueMetaData valueMetaData = element.getValueMetaData();
-               if(valueMetaData == null)
-               {
-                  CharactersMetaData charactersMetaData = type.getCharactersMetaData();
-                  if(charactersMetaData != null)
-                  {
-                     valueMetaData = charactersMetaData.getValue();
-                  }
-               }
-
-               // todo valueMetaData is available from type
-               unmarshalled = dataContent == null ?
-                  charHandler.unmarshalEmpty(endName, charType, nsRegistry, valueMetaData) :
-                  charHandler.unmarshal(endName, charType, nsRegistry, valueMetaData, dataContent);
-            }
-
-            if(unmarshalled != null)
-            {
-               // if startElement returned null, we use characters as the object for this element
-               if(o == null)
-               {
-                  o = unmarshalled;
-               }
-               else if(charHandler != null)
-               {
-                  TermBeforeSetParentCallback beforeSetParent = charType.getBeforeSetParentCallback();
-                  if(beforeSetParent != null)
-                  {
-                     ctx.parent = o;
-                     ctx.particle = particle;
-                     ctx.parentParticle = getParentParticle();
-                     unmarshalled = beforeSetParent.beforeSetParent(unmarshalled, ctx);
-                     ctx.clear();
-                  }
-                  
-                  if(o instanceof ValueList)
-                  {
-                     ValueList valueList = (ValueList)o;
-                     if(type.isSimple())
-                     {
-                        valueList.getInitializer().addTermValue(endName,
-                           particle,
-                           charHandler,
-                           valueList,
-                           unmarshalled,
-                           null
-                        );
-                     }
-                     else
-                     {
-                        valueList.getInitializer().addTextValue(endName,
-                           particle,
-                           charHandler,
-                           valueList,
-                           unmarshalled
-                        );
-                     }
-                  }
-                  else
-                  {
-                     charHandler.setValue(endName, element, o, unmarshalled);
-                  }
-               }
-            }
-
-            for(int i = interceptorsTotal - 1; i >= 0; --i)
-            {
-               ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
-               interceptor.characters(((StackItem)stack.peek(interceptorsTotal + localInterceptorsTotal - i)).o,
-                  endName, type, nsRegistry, dataContent
-               );
-            }
-
-            for(int i = localInterceptorsTotal - 1; i >= 0; --i)
-            {
-               ElementInterceptor interceptor = (ElementInterceptor)localInterceptors.get(i);
-               interceptor.characters(((StackItem)stack.peek(localInterceptorsTotal - i)).o,
-                  endName, type, nsRegistry, dataContent
-               );
-            }
-         }
-      }
-      else
-      {
-         o = null;
-      }
-
-      //
-      // endElement
-      //
-
-      StackItem parentItem = stack.size() == 1 ? null : stack.peek(1);
-      Object parent = parentItem == null ? null : parentItem.o;
-      ParticleHandler handler = stack.peek().handler;
-      
-      if(o instanceof ValueList && !particle.getTerm().isSkip())
-      {
-         if(trace)
-         {
-            log.trace("endParticle " + endName + " valueList");
-         }
-         ValueList valueList = (ValueList)o;
-         o = valueList.getHandler().newInstance(particle, valueList);
-      }
-      else
-      {
-         o = handler.endParticle(o, endName, particle);
-      }
-
-      for(int i = interceptorsTotal - 1; i >= 0; --i)
-      {
-         ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
-         interceptor.endElement(((StackItem)stack.peek(interceptorsTotal - i)).o, endName, type);
-      }
-
-      //
-      // setParent
-      //
-
-      if(localInterceptorsTotal + interceptorsTotal == 0)
-      {
-         ParticleBinding parentParticle = getParentParticle();
-         boolean hasWildcard = false;
-         ParticleHandler wildcardHandler = null;
-         if (parentParticle != null && parentParticle.getTerm().isElement())
-         {
-            WildcardBinding wildcard = ((ElementBinding) parentParticle.getTerm()).getType().getWildcard();
-            if (wildcard != null)
-            {
-               hasWildcard = true;
-               if(parentItem.cursor.isWildcardContent())
-               {
-                  wildcardHandler = wildcard.getWildcardHandler();
-               }
-            }
-         }
-
-         if(parent != null)
-         {
-            /*if(o == null)
-            {
-               throw new JBossXBRuntimeException(endName + " is null!");
-            } */
-            if(wildcardHandler != null)
-            {
-               setParent(wildcardHandler,
-                     parentItem.repeatableParticleValue == null ? parent : parentItem.repeatableParticleValue,
-                     o, endName, particle, parentParticle);
-            }
-            else
-            {
-               setParent(handler,
-                     parentItem.repeatableParticleValue == null ? parent : parentItem.repeatableParticleValue,
-                     o, endName, particle, parentParticle);
-            }
-         }
-         else if(parentParticle != null && hasWildcard && stack.size() > 1)
-         {
-            // the parent has anyType, so it gets the value of its child
-            ListIterator<StackItem> iter = stack.prevIterator();
-            while(iter.hasPrevious())
-            {
-               StackItem peeked = iter.previous();
-               peeked.o = o;
-               if(peeked.cursor == null)
-               {
-                  break;
-               }
-            }
-
-            if(trace)
-            {
-               log.trace("Value of " + endName + " " + o + " is promoted as the value of its parent element.");
-            }
-         }
-      }
-      else
-      {
-         StackItem popped = pop();
-
-         for(int i = interceptorsTotal - 1; i >= 0; --i)
-         {
-            ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
-            parent = pop().o;
-            interceptor.add(parent, o, endName);
-            o = parent;
-         }
-
-         for(int i = localInterceptorsTotal - 1; i >= 0; --i)
-         {
-            ElementInterceptor interceptor = (ElementInterceptor)localInterceptors.get(i);
-            parent = pop().o;
-            interceptor.add(parent, o, endName);
-            o = parent;
-         }
-
-         // need to have correst endRepeatableParticle events
-         stack.push(popped);
-      }
-
-      if(stack.size() == 1)
-      {
-         o = type.getValueAdapter().cast(o, Object.class);
-         root = o;
-         stack.clear();
-         if(sawDTD)
-         {
-            // Probably should be integrated into schema binding?
-            try
-            {
-               // setDTD(String root, String publicId, String systemId)
-               Class[] sig = {String.class, String.class, String.class};
-               Method setDTD = o.getClass().getMethod("setDTD", sig);
-               Object[] args = {dtdRootName, dtdPublicId, dtdSystemId};
-               setDTD.invoke(o, args);
-            }
-            catch(Exception e)
-            {
-               log.debug("No setDTD found on root: " + o);
-            }
-         }
-      }
-   }
-
-   private void setParent(ParticleHandler handler,
-                          Object parent,
-                          Object o,
-                          QName endName,
-                          ParticleBinding particle,
-                          ParticleBinding parentParticle)
-   {
-      TermBeforeSetParentCallback beforeSetParent = particle.getTerm().getBeforeSetParentCallback();
-      if(beforeSetParent != null)
-      {
-         ctx.parent = parent;
-         ctx.particle = particle;
-         ctx.parentParticle = parentParticle;
-         o = beforeSetParent.beforeSetParent(o, ctx);
-         ctx.clear();
-      }
-      
-      if(parent instanceof ValueList /*&& !particle.getTerm().isSkip()*/)
-      {
-         if(parent == o)
-         {            
-            return;
-         }
-         ValueList valueList = (ValueList)parent;
-         valueList.getInitializer().addTermValue(endName, particle, handler, valueList, o, parentParticle);
-      }
-      else
-      {
-         handler.setParent(parent, o, endName, particle, parentParticle);
-      }
-   }
-
-   private void push(ParticleBinding particle, Object o, ParticleHandler handler, TypeBinding parentType)
-   {
-      StackItem item = new StackItem(particle);
-      item.o = o;
-      item.handler = handler;
-      item.parentType = parentType;      
-      stack.push(item);
-      if(trace)
-      {
-         Object binding = null;
-         if(particle != null)
-         {
-            binding = particle.getTerm();
-         }
-         log.trace("pushed " + ((ElementBinding)particle.getTerm()).getQName() + "=" + o + ", binding=" + binding);
-      }
-   }
-
-   private void push(ModelGroupBinding.Cursor cursor, Object o, ParticleHandler handler, TypeBinding parentType)
-   {
-      StackItem item = new StackItem(cursor);
-      item.o = o;
-      item.handler = handler;
-      item.parentType = parentType;
-      stack.push(item);
-      if(trace)
-      {
-         log.trace("pushed cursor " + cursor + ", o=" + o);
-      }
-   }
-
-   private StackItem pop()
-   {
-      StackItem item = stack.pop();
-      if(trace)
-      {
-         if(item.cursor == null)
-         {
-            log.trace("poped " + ((ElementBinding)item.particle.getTerm()).getQName() + "=" + item.particle);
-         }
-         else
-         {
-            log.trace("poped " + item.cursor.getCurrentParticle().getTerm());
-         }
-      }
-      return item;
-   }
-
-   // Inner
-
-   private static class StackItem
-   {
-      final ModelGroupBinding.Cursor cursor;
-      ParticleBinding particle;
-      ParticleHandler handler;
-      TypeBinding parentType;
-      boolean ignoreCharacters;
-      Object o;
-      ValueList repeatableParticleValue;
-      StringBuffer textContent;
-      Boolean indentation;
-      boolean ignorableCharacters = true;
-      boolean ended;
-
-      public StackItem(ModelGroupBinding.Cursor cursor)
-      {
-         if (cursor == null)
-            throw new IllegalArgumentException("Null cursor");
-         // this is modelgroup particle
-         this.cursor = cursor;
-         this.particle = cursor.getParticle();
-      }
-
-      public StackItem(ParticleBinding particle)
-      {
-         if (particle == null)
-            throw new IllegalArgumentException("Null particle");
-         // this is element particle
-         this.cursor = null;
-         this.particle = particle;
-      }
-
-      void reset()
-      {
-         if(!ended)
-         {
-            throw new JBossXBRuntimeException(
-               "Attempt to reset a particle that has already been reset: " + particle.getTerm()
-            );
-         }
-
-         ended = false;
-         o = null;
-         if(textContent != null)
-         {
-            textContent.delete(0, textContent.length());
-         }
-         
-         indentation = null;
-         ignorableCharacters = true;
-      }
-   }
-
-   static class StackImpl
-   {
-      private List<StackItem> list = new ArrayList<StackItem>();
-
-      public void clear()
-      {
-         list.clear();
-      }
-
-      public void push(StackItem o)
-      {
-         list.add(o);
-      }
-
-      public StackItem pop()
-      {
-         return list.remove(list.size() - 1);
-      }
-
-      public ListIterator<StackItem> prevIterator()
-      {
-         return list.listIterator(list.size() - 1);
-      }
-
-      public StackItem peek()
-      {
-         return list.get(list.size() - 1);
-      }
-
-      public StackItem peek(int i)
-      {
-         return list.get(list.size() - 1 - i);
-      }
-
-      public boolean isEmpty()
-      {
-         return list.isEmpty();
-      }
-
-      public int size()
-      {
-         return list.size();
-      }
-   }
-   
-   private class UnmarshallingContextImpl implements UnmarshallingContext
-   {
-      Object parent;
-      ParticleBinding particle;
-      ParticleBinding parentParticle;
-      
-      public Object getParentValue()
-      {
-         return parent;
-      }
-      
-      public ParticleBinding getParticle()
-      {
-         return particle;
-      }
-      
-      public ParticleBinding getParentParticle()
-      {
-         return parentParticle;
-      }
-      
-      public String resolvePropertyName()
-      {
-         TermBinding term = particle.getTerm();
-         PropertyMetaData propertyMetaData = term.getPropertyMetaData();
-         String prop = propertyMetaData == null ? null : propertyMetaData.getName();
-         
-         if(prop != null)
-         {
-            return prop;
-         }
-         
-         if(term.isElement())
-         {
-            QName name = ((ElementBinding)term).getQName();
-            prop = Util.xmlNameToFieldName(name.getLocalPart(), term.getSchema().isIgnoreLowLine());
-         }
-         
-         return prop;
-      }
-
-      public Class<?> resolvePropertyType()
-      {
-         if(parent == null)
-         {
-            return null;
-         }
-         
-         String prop = resolvePropertyName();
-         if(prop != null)
-         {      
-            FieldInfo fieldInfo = FieldInfo.getFieldInfo(parent.getClass(), prop, false);
-            if (fieldInfo != null)
-            {
-               return fieldInfo.getType();
-            }
-         }
-         return null;
-      }
-      
-      // private
-      
-      void clear()
-      {
-         ctx.parent = null;
-         ctx.particle = null;
-         ctx.parentParticle = null;
-      }
-   }
-}

Copied: jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java (from rev 2917, jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,1560 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.xb.binding.sunday.unmarshalling;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.ListIterator;
+
+import javax.xml.namespace.QName;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.xb.binding.AttributesImpl;
+import org.jboss.xb.binding.Constants;
+import org.jboss.xb.binding.GenericValueContainer;
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.jboss.xb.binding.Util;
+import org.jboss.xb.binding.group.ValueList;
+import org.jboss.xb.binding.group.ValueListHandler;
+import org.jboss.xb.binding.group.ValueListInitializer;
+import org.jboss.xb.binding.group.ValueList.NonRequiredValue;
+import org.jboss.xb.binding.introspection.FieldInfo;
+import org.jboss.xb.binding.metadata.CharactersMetaData;
+import org.jboss.xb.binding.metadata.PropertyMetaData;
+import org.jboss.xb.binding.metadata.ValueMetaData;
+import org.jboss.xb.binding.parser.JBossXBParser;
+import org.jboss.xb.binding.sunday.xop.XOPIncludeHandler;
+import org.xml.sax.Attributes;
+
+/**
+ * ContentHandler that is used as a sandbox for JBXB-76
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SundayContentHandler
+   implements JBossXBParser.DtdAwareContentHandler
+{
+   private final static Logger log = Logger.getLogger(SundayContentHandler.class);
+
+   private final static Object NIL = new Object();
+
+   private final SchemaBinding schema;
+   private final SchemaBindingResolver schemaResolver;
+
+   private final StackImpl stack = new StackImpl();
+
+   private Object root;
+   private NamespaceRegistry nsRegistry = new NamespaceRegistry();
+
+   private ParticleHandler defParticleHandler = DefaultHandlers.ELEMENT_HANDLER;
+
+   private UnmarshallingContextImpl ctx = new UnmarshallingContextImpl();
+   // DTD information frm startDTD
+   private String dtdRootName;
+   private String dtdPublicId;
+   private String dtdSystemId;
+   private boolean sawDTD;
+
+   private final boolean trace = log.isTraceEnabled();
+
+   public SundayContentHandler(SchemaBinding schema)
+   {
+      this.schema = schema;
+      this.schemaResolver = null;
+   }
+
+   public SundayContentHandler(SchemaBindingResolver schemaResolver)
+   {
+      this.schemaResolver = schemaResolver;
+      this.schema = null;
+   }
+
+   
+   public void startDTD(String dtdRootName, String dtdPublicId, String dtdSystemId)
+   {
+      this.dtdRootName = dtdRootName;
+      this.dtdPublicId = dtdPublicId;
+      this.dtdSystemId = dtdSystemId;
+   }
+   public void endDTD()
+   {
+      this.sawDTD = true;
+   }
+
+   public void characters(char[] ch, int start, int length)
+   {
+      StackItem stackItem = stack.peek();
+      if(stackItem.cursor != null)
+      {
+         return;
+      }
+      
+      ElementBinding e = (ElementBinding) stackItem.particle.getTerm();
+/*      if(!stackItem.ended && e.getType().isTextContentAllowed())
+      {
+         int i = start;
+         while (i < start + length)
+         {
+            if(ch[i] == 0x0a)
+            {
+               stackItem.indentation = true;
+            }
+            else
+            {
+               if (ch[i] == ' ' || ch[i] == 0x0d)
+               {
+               }
+               else
+               {
+                  stackItem.indentation = false;
+                  break;
+               }
+            }
+            ++i;
+         }
+
+         if(!stackItem.indentation)
+         {
+            if (stackItem.textContent == null)
+            {
+               stackItem.textContent = new StringBuffer();
+            }
+            stackItem.textContent.append(ch, start, length);
+         }
+      }
+*/
+      // if current is ended the characters belong to its parent
+      if(stackItem.ended)
+      {
+         int i = 0;
+         do
+         {
+            stackItem = stack.peek(++i);
+         }
+         while(stackItem.cursor != null && i < stack.size());
+         
+         e = (ElementBinding) stackItem.particle.getTerm();
+      }
+
+      // collect characters only if they are allowed content
+      if(e.getType().isTextContentAllowed())
+      {
+         if(stackItem.indentation != Boolean.FALSE)
+         {
+            if(e.getType().isSimple())
+            {
+               // simple content is not analyzed
+               stackItem.indentation = Boolean.FALSE;
+               stackItem.ignorableCharacters = false;
+            }
+            else if(e.getSchema() != null && !e.getSchema().isIgnoreWhitespacesInMixedContent())
+            {
+               stackItem.indentation = Boolean.FALSE;
+               stackItem.ignorableCharacters = false;
+            }
+            else
+            {
+               // the indentation is currently defined as whitespaces with next line characters
+               // this should probably be externalized in the form of a filter or something
+               for (int i = start; i < start + length; ++i)
+               {
+                  if(ch[i] == 0x0a)
+                  {
+                     stackItem.indentation = Boolean.TRUE;
+                  }
+                  else if (!Character.isWhitespace(ch[i]))
+                  {
+                     stackItem.indentation = Boolean.FALSE;
+                     stackItem.ignorableCharacters = false;
+                     break;
+                  }
+               }
+            }
+         }
+         
+         if (stackItem.textContent == null)
+         {
+            stackItem.textContent = new StringBuffer();
+         }
+         stackItem.textContent.append(ch, start, length);
+      }
+   }
+
+   public void endElement(String namespaceURI, String localName, String qName)
+   {
+      ElementBinding elementBinding = null;
+      QName endName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName);
+      StackItem item;
+      while(true)
+      {
+         item = stack.peek();
+         if(item.cursor == null)
+         {
+            if(item.ended)
+            {
+               pop();
+               if(item.particle.isRepeatable())
+               {
+                  endRepeatableParticle(item.particle);
+               }
+            }
+            else
+            {
+               elementBinding = (ElementBinding)item.particle.getTerm();
+               item.ended = true;
+               break;
+            }
+         }
+         else
+         {
+            if(!item.ended) // could be ended if it's a choice
+            {
+               endParticle(item, endName, 1);
+            }
+
+            ParticleBinding currentParticle = item.cursor.getCurrentParticle();
+            TermBinding term = currentParticle.getTerm();
+            if(term.isWildcard() && currentParticle.isRepeatable())
+            {
+               endRepeatableParticle(currentParticle);
+            }
+
+            pop();
+            if(item.particle.isRepeatable())
+            {
+               endRepeatableParticle(item.particle);
+            }
+         }
+      }
+
+      if(elementBinding == null)
+      {
+         throw new JBossXBRuntimeException("Failed to endElement " + qName + ": binding not found");
+      }
+
+      if(!elementBinding.getQName().equals(endName))
+      {
+         throw new JBossXBRuntimeException("Failed to end element " +
+            new QName(namespaceURI, localName) +
+            ": element on the stack is " + elementBinding.getQName()
+         );
+      }
+
+      endElement();
+   }
+
+   public void startElement(String namespaceURI,
+                            String localName,
+                            String qName,
+                            Attributes atts,
+                            XSTypeDefinition xercesType)
+   {
+      QName startName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName);
+      ParticleBinding particle = null;
+      ParticleHandler handler = null;
+      TypeBinding parentType = null;
+      boolean repeated = false;
+      boolean repeatedParticle = false;
+      StackItem item = null;
+      ModelGroupBinding.Cursor cursor = null; // used only when particle is a wildcard
+      SchemaBinding schemaBinding = schema;
+
+      atts = preprocessAttributes(atts);
+      
+      if(stack.isEmpty())
+      {
+         if(schemaBinding != null)
+         {
+            particle = schemaBinding.getElementParticle(startName);
+         }
+         else if(schemaResolver != null)
+         {
+            String schemaLocation = atts == null ? null : Util.getSchemaLocation(atts, namespaceURI);
+            // Use the dtd info if it exists and there is no schemaLocation
+            if(sawDTD && (schemaLocation == null || schemaLocation.length() == 0))
+            {
+               schemaLocation = dtdSystemId;
+            }
+            // If there is still no schemaLocation, pass in the root local name
+            if(schemaLocation == null)
+               schemaLocation = localName;
+            schemaBinding = schemaResolver.resolve(namespaceURI, null, schemaLocation);
+            if(schemaBinding != null)
+            {
+               particle = schemaBinding.getElementParticle(startName);
+            }
+            else
+            {
+               throw new JBossXBRuntimeException("Failed to resolve schema nsURI=" + namespaceURI + " location=" + schemaLocation);
+            }
+         }
+         else
+         {
+            throw new JBossXBRuntimeException("Neither schema binding nor schema binding resolver is available!");
+         }
+      }
+      else
+      {
+         while(!stack.isEmpty())
+         {
+            item = stack.peek();
+            if(item.cursor == null)
+            {
+               TermBinding term = item.particle.getTerm();
+               ElementBinding element = (ElementBinding)term;
+               if(item.ended)
+               {
+                  if(element.getQName().equals(startName))
+                  {
+                     item.reset();
+                     particle = item.particle;
+                     parentType = item.parentType;
+                     repeated = true;
+
+                     if(!particle.isRepeatable())
+                     {
+                        endRepeatableParent(startName);
+                     }
+                  }
+                  else
+                  {
+                     pop();                     
+                     if(item.particle.isRepeatable())
+                     {
+                        endRepeatableParticle(item.particle);
+                     }
+                     continue;
+                  }
+               }
+               else
+               {
+                  parentType = element.getType();
+                  ParticleBinding typeParticle = parentType.getParticle();
+                  ModelGroupBinding modelGroup = typeParticle == null ? null : (ModelGroupBinding)typeParticle.getTerm();
+                  if(modelGroup == null)
+                  {
+                     if(startName.equals(Constants.QNAME_XOP_INCLUDE))
+                     {
+                        TypeBinding anyUriType = schema.getType(Constants.QNAME_ANYURI);
+                        if(anyUriType == null)
+                        {
+                           log.warn("Type " + Constants.QNAME_ANYURI + " not bound.");
+                        }
+
+                        TypeBinding xopIncludeType = new TypeBinding(new QName(Constants.NS_XOP_INCLUDE, "Include"));
+                        xopIncludeType.setSchemaBinding(schema);
+                        xopIncludeType.addAttribute(new QName("href"), anyUriType, DefaultHandlers.ATTRIBUTE_HANDLER);
+                        xopIncludeType.setHandler(new XOPIncludeHandler(parentType, schema.getXopUnmarshaller()));
+
+                        ElementBinding xopInclude = new ElementBinding(schema, Constants.QNAME_XOP_INCLUDE, xopIncludeType);
+
+                        particle = new ParticleBinding(xopInclude);
+                        
+                        ElementBinding parentElement = (ElementBinding) item.particle.getTerm();
+                        parentElement.setXopUnmarshaller(schema.getXopUnmarshaller());
+
+                        flushIgnorableCharacters();
+                        item.handler = DefaultHandlers.XOP_HANDLER;
+                        item.ignoreCharacters = true;
+                        item.o = item.handler.startParticle(stack.peek().o, startName, stack.peek().particle, null, nsRegistry);
+                        break;
+                     }
+
+                     QName typeName = parentType.getQName();
+                     throw new JBossXBRuntimeException((typeName == null ? "Anonymous" : typeName.toString()) +
+                        " type of element " +
+                        element.getQName() +
+                        " should be complex and contain " + startName + " as a child element."
+                     );
+                  }
+
+                  cursor = modelGroup.newCursor(typeParticle);
+                  List<ModelGroupBinding.Cursor> newCursors = cursor.startElement(startName, atts);
+                  if(newCursors.isEmpty())
+                  {
+                     throw new JBossXBRuntimeException(startName +
+                        " not found as a child of " +
+                        ((ElementBinding)term).getQName()
+                     );
+                  }
+                  else
+                  {
+                     flushIgnorableCharacters();
+
+                     Object o = item.o;
+                     // push all except the last one
+                     for(int i = newCursors.size() - 1; i >= 0; --i)
+                     {
+                        cursor = newCursors.get(i);
+
+                        ParticleBinding modelGroupParticle = cursor.getParticle();
+                        if(modelGroupParticle.isRepeatable())
+                        {
+                           startRepeatableParticle(startName, modelGroupParticle);
+                        }
+
+                        handler = getHandler(modelGroupParticle);
+                        o = handler.startParticle(o, startName, modelGroupParticle, atts, nsRegistry);
+                        push(cursor, o, handler, parentType);
+                     }
+                     particle = cursor.getCurrentParticle();
+                  }
+               }
+               break;
+            }
+            else
+            {
+               cursor = item.cursor;
+               if(cursor == null)
+               {
+                  throw new JBossXBRuntimeException("No cursor for " + startName);
+               }
+
+               // todo review
+               if(!item.ended && cursor.isPositioned() && cursor.getParticle().getTerm() instanceof ChoiceBinding)
+               {
+                  endParticle(item, startName, 1);
+                  if(!item.particle.isRepeatable()) // this is for repeatable choices that should stay on the stack
+                  {
+                     pop();
+                  }
+                  continue;
+               }
+
+               //int prevOccurence = cursor.getOccurence();
+               ParticleBinding prevParticle = cursor.isPositioned() ? cursor.getCurrentParticle() : null;
+               List<ModelGroupBinding.Cursor> newCursors = cursor.startElement(startName, atts);
+               if(newCursors.isEmpty())
+               {
+                  if(!item.ended) // this is for choices
+                  {
+                     endParticle(item, startName, 1);
+                  }
+                  pop();
+               }
+               else
+               {
+                  if(item.ended) // for repeatable choices
+                  {
+                     if(!item.particle.isRepeatable())
+                     {
+                        throw new JBossXBRuntimeException("The particle expected to be repeatable but it's not: " + item.particle.getTerm());
+                     }
+                     item.reset();
+                     
+                     handler = getHandler(item.particle);
+                     item.o = handler.startParticle(stack.peek(1).o, startName, item.particle, atts, nsRegistry);
+                  }
+                  
+                  ParticleBinding curParticle = cursor.getCurrentParticle();
+                  if(curParticle != prevParticle)
+                  {
+                     if(prevParticle != null && prevParticle.isRepeatable() && prevParticle.getTerm().isModelGroup())
+                     {
+                        endRepeatableParticle(prevParticle);
+                     }
+
+                     if(newCursors.size() > 1 && curParticle.isRepeatable())
+                     {
+                        startRepeatableParticle(startName, curParticle);
+                     }
+                  }
+                  else
+                  {
+                     repeatedParticle = true;
+                  }
+
+                  // push all except the last one
+                  parentType = item.parentType;
+                  Object o = item.o;
+                  for(int i = newCursors.size() - 2; i >= 0; --i)
+                  {
+                     cursor = newCursors.get(i);
+
+                     ParticleBinding modelGroupParticle = cursor.getParticle();
+                     handler = getHandler(modelGroupParticle);
+                     o = handler.startParticle(o, startName, modelGroupParticle, atts, nsRegistry);
+                     push(cursor, o, handler, parentType);
+                  }
+                  cursor = newCursors.get(0);
+                  particle = cursor.getCurrentParticle();
+                  break;
+               }
+            }
+         }
+      }
+
+      Object o = null;
+      if(particle != null)
+      {
+         Object parent = stack.isEmpty() ? null :
+            (repeated ? stack.peek(1).o : stack.peek().o);
+         if(particle.getTerm() instanceof WildcardBinding)
+         {
+            /*
+            WildcardBinding wildcard = (WildcardBinding)particle.getTerm();
+            ElementBinding element = wildcard.getElement(startName, atts);
+            */
+            ElementBinding element = cursor.getElement();
+            if(element == null)
+            {
+               throw new JBossXBRuntimeException("Failed to resolve element " +
+                  startName + " for wildcard."
+               );
+            }
+
+            if(!repeatedParticle && particle.isRepeatable())
+            {
+               startRepeatableParticle(startName, particle);
+            }
+            particle = new ParticleBinding(element/*, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded()*/);
+         }
+
+         ElementBinding element = (ElementBinding)particle.getTerm();
+
+         // todo xsi:type support should be implemented in a better way
+         String xsiType = atts.getValue("xsi:type");
+         if(xsiType != null)
+         {
+            if(trace)
+               log.trace(element.getQName() + " uses xsi:type " + xsiType);
+
+            if(item.nonXsiParticle == null)
+               item.nonXsiParticle = particle;
+            
+            String xsiTypePrefix;
+            String xsiTypeLocal;
+            int colon = xsiType.indexOf(':');
+            if(colon == -1)
+            {
+               xsiTypePrefix = "";
+               xsiTypeLocal = xsiType;
+            }
+            else
+            {
+               xsiTypePrefix = xsiType.substring(0, colon);
+               xsiTypeLocal = xsiType.substring(colon + 1);
+            }
+
+            String xsiTypeNs = nsRegistry.getNamespaceURI(xsiTypePrefix);
+            QName xsiTypeQName = new QName(xsiTypeNs, xsiTypeLocal);
+
+            TypeBinding xsiTypeBinding = schemaBinding.getType(xsiTypeQName);
+            if(xsiTypeBinding == null)
+            {
+               throw new JBossXBRuntimeException("Type binding not found for type " +
+                  xsiTypeQName +
+                  " specified with xsi:type for element " + startName
+               );
+            }
+
+            element = new ElementBinding(schemaBinding, startName, xsiTypeBinding);
+            particle =
+               new ParticleBinding(element,
+                  particle.getMinOccurs(),
+                  particle.getMaxOccurs(),
+                  particle.getMaxOccursUnbounded()
+               );
+         }
+
+         if(!repeated && particle.isRepeatable())
+         {
+            startRepeatableParticle(startName, particle);
+         }
+
+         TypeBinding type = element.getType();
+         if(type == null)
+         {
+            throw new JBossXBRuntimeException("No type for element " + element);
+         }
+
+         handler = type.getHandler();         
+         if(handler == null)
+         {
+            handler = defParticleHandler;
+         }
+
+         List<ElementInterceptor> localInterceptors = parentType == null ? Collections.EMPTY_LIST : parentType.getInterceptors(startName);         
+         List<ElementInterceptor> interceptors = element.getInterceptors();
+         if(interceptors.size() + localInterceptors.size() > 0)
+         {
+            if (repeated)
+            {
+               pop();
+            }
+
+            for (int i = 0; i < localInterceptors.size(); ++i)
+            {
+               ElementInterceptor interceptor = (ElementInterceptor) localInterceptors.get(i);
+               parent = interceptor.startElement(parent, startName, type);
+               push(particle, parent, handler, parentType);
+               interceptor.attributes(parent, startName, type, atts, nsRegistry);
+            }
+
+            for (int i = 0; i < interceptors.size(); ++i)
+            {
+               ElementInterceptor interceptor = (ElementInterceptor) interceptors.get(i);
+               parent = interceptor.startElement(parent, startName, type);
+               push(particle, parent, handler, parentType);
+               interceptor.attributes(parent, startName, type, atts, nsRegistry);
+            }
+
+            if (repeated)
+            {
+               // to have correct endRepeatableParticle calls
+               stack.push(item);
+            }
+         }
+
+         String nil = atts.getValue("xsi:nil");
+         if(nil == null || !("1".equals(nil) || "true".equals(nil)))
+         {
+            o = handler.startParticle(parent, startName, particle, atts, nsRegistry);
+         }
+         else
+         {
+            o = NIL;
+         }
+      }
+      else
+      {
+         ElementBinding parentBinding = null;
+         if(!stack.isEmpty())
+         {
+            ParticleBinding stackParticle = repeated ? stack.peek(1).particle : stack.peek().particle;
+            if(stackParticle != null)
+            {
+               parentBinding = (ElementBinding)stackParticle.getTerm();
+            }
+         }
+
+         if(parentBinding != null && parentBinding.getSchema() != null)
+         {
+            schemaBinding = parentBinding.getSchema();
+         }
+
+         String msg = "Element " +
+            startName +
+            " is not bound " +
+            (parentBinding == null ? "as a global element." : "in type " + parentBinding.getType().getQName());
+         if(schemaBinding != null && schemaBinding.isStrictSchema())
+         {
+            throw new JBossXBRuntimeException(msg);
+         }
+         else if(trace)
+         {
+            log.trace(msg);
+         }
+      }
+
+      if(repeated)
+      {
+         item.o = o;
+         // in case of collection of abstract types
+         item.particle = particle;
+      }
+      else
+      {
+         push(particle, o, handler, parentType);
+      }
+   }
+
+   private ParticleHandler getHandler(ParticleBinding modelGroupParticle)
+   {
+      ParticleHandler handler = ((ModelGroupBinding)modelGroupParticle.getTerm()).getHandler();
+      return handler == null ? defParticleHandler : handler;
+   }
+
+   private void endRepeatableParent(QName startName)
+   {
+      int parentPos = 1;
+      StackItem parentItem;
+      ParticleBinding parentParticle = null;
+      while(true)
+      {
+         parentItem = stack.peek(parentPos);
+         if(parentItem.cursor == null)
+         {
+            throw new JBossXBRuntimeException(
+               "Failed to start " + startName +
+               ": the element is not repeatable, repeatable parent expected to be a model group but got element " +
+               ((ElementBinding)parentItem.particle.getTerm()).getQName()
+            );
+         }
+
+         parentParticle = parentItem.particle;
+         if(parentParticle.isRepeatable())
+         {
+            break;
+         }
+
+         endParticle(parentItem, startName, ++parentPos);
+      }
+
+      if(!parentParticle.isRepeatable())
+      {
+         StringBuffer msg = new StringBuffer();
+
+         StackItem item = stack.peek();
+         ParticleBinding currentParticle = item.particle;
+         msg.append("Failed to start ").append(startName).append(": ")
+            .append(currentParticle.getTerm())
+            .append(" is not repeatable.")
+            .append(" Its parent ")
+            .append(parentParticle.getTerm())
+            .append(" expected to be repeatable!")
+            .append("\ncurrent stack: ");
+
+         for(int i = stack.size() - 1; i >= 0; --i)
+         {
+            item = stack.peek(i);
+            ParticleBinding particle = item.particle;
+            TermBinding term = particle.getTerm();
+            if(term.isModelGroup())
+            {
+               if(term instanceof SequenceBinding)
+               {
+                  msg.append("sequence");
+               }
+               else if(term instanceof ChoiceBinding)
+               {
+                  msg.append("choice");
+               }
+               else
+               {
+                  msg.append("all");
+               }
+            }
+            else if(term.isWildcard())
+            {
+               msg.append("wildcard");
+            }
+            else
+            {
+               msg.append(((ElementBinding)term).getQName());
+            }
+            msg.append("\\");
+         }
+
+         throw new JBossXBRuntimeException(msg.toString());
+      }
+
+      // todo startName is wrong here
+      endParticle(parentItem, startName, parentPos + 1);
+
+      parentItem = stack.peek(parentPos + 1);
+      while(parentPos > 0)
+      {
+         StackItem item = stack.peek(parentPos--);
+         ParticleHandler handler = getHandler(item.particle);
+         item.reset();
+         item.o = handler.startParticle(parentItem.o, startName, item.particle, null, nsRegistry);
+         parentItem = item;
+      }
+   }
+
+   private void startRepeatableParticle(QName startName, ParticleBinding particle)
+   {
+      if(trace)
+         log.trace(" start repeatable (" + stack.size() + "): " + particle.getTerm());
+      
+      TermBinding term = particle.getTerm();
+      if(term.isSkip())
+      {
+         return;
+      }
+      
+      StackItem item = stack.peek();
+      if(item.o != null &&
+            !(item.o instanceof GenericValueContainer) &&
+            (item.o instanceof Collection == false) &&
+            term.getAddMethodMetaData() == null &&
+            term.getMapEntryMetaData() == null &&
+            term.getPutMethodMetaData() == null)
+      {
+         ValueListHandler handler = ValueListHandler.FACTORY.lazy(item.o);
+         Class<?> cls = item.o.getClass();
+         item.repeatableParticleValue = new ValueListInitializer().newValueList(handler, cls);
+      }
+   }
+
+   private void endRepeatableParticle(ParticleBinding particle)
+   {
+      if(trace)
+         log.trace(" end repeatable (" + stack.size() + "): " + particle.getTerm());
+
+      StackItem item = stack.peek();
+      ValueList valueList = item.repeatableParticleValue;
+      if(valueList != null)
+      {
+         item.repeatableParticleValue = null;
+         if(valueList.size() == 0)
+         {
+            return;
+         }
+            
+         if(particle.getTerm().isWildcard())
+         {
+            ParticleHandler handler = null;
+/*
+            handler = ((WildcardBinding) particle.getTerm()).getWildcardHandler();
+            if (handler == null)
+            {
+               handler = defParticleHandler;
+            }
+ */
+            
+            // that's not good. some elements can be handled as "unresolved" and some as "resolved"
+            QName qName = valueList.getValue(0).qName;
+            Collection<Object> col = new ArrayList<Object>();
+            for(int i = 0; i < valueList.size(); ++i)
+            {
+               NonRequiredValue value = valueList.getValue(i);
+               col.add(value.value);
+
+               if(handler != value.handler)
+               {
+                  if(handler == null && i == 0)
+                  {
+                     handler = (ParticleHandler) value.handler;
+                  }
+                  else
+                  {
+                     throw new JBossXBRuntimeException("Handlers in the list are supposed to be the same.");
+                  }
+               }
+            }
+
+            StackItem parentItem = stack.peek(1);
+            handler.setParent(parentItem.o, col, qName, particle, parentItem.particle);
+         }
+         else
+         {
+            valueList.getHandler().newInstance(particle, valueList);
+         }
+      }
+   }
+
+   private void endParticle(StackItem item, QName qName, int parentStackPos)
+   {
+      if(item.ended)
+      {
+         throw new JBossXBRuntimeException(item.particle.getTerm() + " has already been ended.");
+      }
+
+      ParticleBinding modelGroupParticle = item.particle;
+      ParticleHandler handler = item.handler;//getHandler(modelGroupParticle);
+
+      Object o;
+      if(item.o instanceof ValueList && !modelGroupParticle.getTerm().isSkip())
+      {
+         if(trace)
+         {
+            log.trace("endParticle " + modelGroupParticle.getTerm() + " valueList");
+         }
+         ValueList valueList = (ValueList)item.o;
+         o = valueList.getHandler().newInstance(modelGroupParticle, valueList);
+      }
+      else
+      {
+         o = handler.endParticle(item.o, qName, modelGroupParticle);
+      }
+
+      item.ended = true;
+
+      // model group should always have parent particle
+      item = (StackItem)stack.peek(parentStackPos);
+      if(item.o != null)
+      {
+         ParticleBinding parentParticle = getParentParticle();//item.particle;
+         if(parentParticle == null)
+         {
+            parentParticle = item.particle;
+         }
+         setParent(handler,
+               item.repeatableParticleValue == null ? item.o : item.repeatableParticleValue,
+               o, qName, modelGroupParticle, parentParticle);
+      }
+   }
+
+   public void startPrefixMapping(String prefix, String uri)
+   {
+      nsRegistry.addPrefixMapping(prefix, uri);
+   }
+
+   public void endPrefixMapping(String prefix)
+   {
+      nsRegistry.removePrefixMapping(prefix);
+   }
+
+   public void processingInstruction(String target, String data)
+   {
+   }
+
+   public Object getRoot()
+   {
+      return root;
+   }
+
+   // Private
+
+   private Attributes preprocessAttributes(Attributes attrs)
+   {
+      SchemaBindingResolver resolver = schemaResolver == null ? schema.getSchemaResolver() : schemaResolver;
+      if(resolver == null || !(resolver instanceof DefaultSchemaResolver))
+         return attrs;
+      
+      int ind = attrs.getIndex(Constants.NS_JBXB, "schemabinding");
+      if (ind != -1)
+      {
+         DefaultSchemaResolver defaultResolver = (DefaultSchemaResolver)resolver;
+         String value = attrs.getValue(ind);
+         java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(value);
+         while(tokenizer.hasMoreTokens())
+         {
+            String uri = tokenizer.nextToken();
+            if(!tokenizer.hasMoreTokens())
+               throw new JBossXBRuntimeException("jbxb:schemabinding attribute value is invalid: ns uri '" + uri + "' is missing value in '" + value + "'");
+            String cls = tokenizer.nextToken();
+            try
+            {
+               defaultResolver.addClassBinding(uri, cls);
+            }
+            catch (Exception e)
+            {
+               throw new JBossXBRuntimeException("Failed to addClassBinding: uri='" + uri + "', class='" + cls + "'", e);
+            }
+         }
+         
+         AttributesImpl attrsImpl = new AttributesImpl(attrs.getLength() - 1);
+         for(int i = 0; i < attrs.getLength(); ++i)
+         {
+            if(i != ind)
+               attrsImpl.add(attrs.getURI(i), attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i), attrs.getValue(i));
+         }
+         attrs = attrsImpl;
+      }
+      return attrs;
+   }
+   
+   private void flushIgnorableCharacters()
+   {
+      StackItem stackItem = stack.peek();
+      if(stackItem.cursor != null || stackItem.textContent == null)
+      {
+         return;
+      }
+
+      if(stackItem.indentation == Boolean.TRUE || stackItem.ignorableCharacters)
+      {
+         if(log.isTraceEnabled())
+         {
+            log.trace("ignored characters: " + ((ElementBinding) stackItem.particle.getTerm()).getQName() + " '"
+               + stackItem.textContent + "'");
+         }
+         stackItem.textContent = null;
+         stackItem.indentation = null;
+      }
+   }
+   
+   private ParticleBinding getParentParticle()
+   {
+      ListIterator<StackItem> iter = stack.prevIterator();
+      while(iter.hasPrevious())
+      {
+         StackItem prev = iter.previous();
+         ParticleBinding peeked = prev.particle;
+
+         TermBinding term = peeked.getTerm();
+         if(!term.isSkip())
+         {
+            return peeked;
+         }
+      }
+      return null;
+   }
+   
+   private void endElement()
+   {
+      StackItem item = stack.peek();
+      Object o = item.o;
+      ParticleBinding particle = item.particle;
+      
+      ElementBinding element = (ElementBinding)particle.getTerm();
+      QName endName = element.getQName();
+      TypeBinding type = element.getType();
+      List<ElementInterceptor> interceptors = element.getInterceptors();
+      int interceptorsTotal = interceptors.size();
+
+      List<ElementInterceptor> localInterceptors = item.parentType == null ? Collections.EMPTY_LIST : item.parentType.getInterceptors(endName);
+      int localInterceptorsTotal = localInterceptors.size();
+
+      if(o != NIL)
+      {
+         //
+         // characters
+         //
+
+         flushIgnorableCharacters();
+
+         TypeBinding charType = type.getSimpleType();
+         if(charType == null)
+         {
+            charType = type;
+         }
+
+         CharactersHandler charHandler = item.ignoreCharacters ? null : charType.getCharactersHandler();
+
+         /**
+          * If there is text content then unmarshal it and set.
+          * If there is no text content and the type is simple and
+          * its characters handler is not null then unmarshal and set.
+          * If the type is complex and there is no text data then the unmarshalled value
+          * of the empty text content is assumed to be null
+          * (in case of simple types that's not always true and depends on nillable attribute).
+          */
+         String textContent = item.textContent == null ? "" : item.textContent.toString();
+         if(textContent.length() > 0 || charHandler != null && !type.isIgnoreEmptyString())
+         {
+            String dataContent;
+            SchemaBinding schema = element.getSchema();
+            if(textContent.length() == 0)
+            {
+               dataContent = null;
+            }
+            else
+            {
+               dataContent = textContent.toString();
+               if(schema != null && schema.isReplacePropertyRefs())
+               {
+                  dataContent = StringPropertyReplacer.replaceProperties(dataContent);
+               }
+               
+               if(element.isNormalizeSpace())
+                  dataContent = dataContent.trim();
+            }
+
+            Object unmarshalled;
+
+            if(charHandler == null)
+            {
+               if(!type.isSimple() &&
+                  schema != null &&
+                  schema.isStrictSchema()
+                  // todo this isSkip() doesn't look nice here
+                  && !element.isSkip())
+               {
+                  throw new JBossXBRuntimeException("Element " +
+                     endName +
+                     " with type binding " +
+                     type.getQName() +
+                     " does not include text content binding: " + dataContent
+                  );
+               }
+               unmarshalled = dataContent;
+            }
+            else
+            {
+               ValueMetaData valueMetaData = element.getValueMetaData();
+               if(valueMetaData == null)
+               {
+                  CharactersMetaData charactersMetaData = type.getCharactersMetaData();
+                  if(charactersMetaData != null)
+                  {
+                     valueMetaData = charactersMetaData.getValue();
+                  }
+               }
+
+               // todo valueMetaData is available from type
+               unmarshalled = dataContent == null ?
+                  charHandler.unmarshalEmpty(endName, charType, nsRegistry, valueMetaData) :
+                  charHandler.unmarshal(endName, charType, nsRegistry, valueMetaData, dataContent);
+            }
+
+            if(unmarshalled != null)
+            {
+               // if startElement returned null, we use characters as the object for this element
+               if(o == null)
+               {
+                  o = unmarshalled;
+               }
+               else if(charHandler != null)
+               {
+                  TermBeforeSetParentCallback beforeSetParent = charType.getBeforeSetParentCallback();
+                  if(beforeSetParent != null)
+                  {
+                     ctx.parent = o;
+                     ctx.particle = particle;
+                     ctx.parentParticle = getParentParticle();
+                     unmarshalled = beforeSetParent.beforeSetParent(unmarshalled, ctx);
+                     ctx.clear();
+                  }
+                  
+                  if(o instanceof ValueList)
+                  {
+                     ValueList valueList = (ValueList)o;
+                     if(type.isSimple())
+                     {
+                        valueList.getInitializer().addTermValue(endName,
+                           particle,
+                           charHandler,
+                           valueList,
+                           unmarshalled,
+                           null
+                        );
+                     }
+                     else
+                     {
+                        valueList.getInitializer().addTextValue(endName,
+                           particle,
+                           charHandler,
+                           valueList,
+                           unmarshalled
+                        );
+                     }
+                  }
+                  else
+                  {
+                     charHandler.setValue(endName, element, o, unmarshalled);
+                  }
+               }
+            }
+
+            for(int i = interceptorsTotal - 1; i >= 0; --i)
+            {
+               ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
+               interceptor.characters(((StackItem)stack.peek(interceptorsTotal + localInterceptorsTotal - i)).o,
+                  endName, type, nsRegistry, dataContent
+               );
+            }
+
+            for(int i = localInterceptorsTotal - 1; i >= 0; --i)
+            {
+               ElementInterceptor interceptor = (ElementInterceptor)localInterceptors.get(i);
+               interceptor.characters(((StackItem)stack.peek(localInterceptorsTotal - i)).o,
+                  endName, type, nsRegistry, dataContent
+               );
+            }
+         }
+      }
+      else
+      {
+         o = null;
+      }
+
+      //
+      // endElement
+      //
+
+      StackItem parentItem = stack.size() == 1 ? null : stack.peek(1);
+      Object parent = parentItem == null ? null : parentItem.o;
+      ParticleHandler handler = stack.peek().handler;
+      
+      if(o instanceof ValueList && !particle.getTerm().isSkip())
+      {
+         if(trace)
+         {
+            log.trace("endParticle " + endName + " valueList");
+         }
+         ValueList valueList = (ValueList)o;
+         o = valueList.getHandler().newInstance(particle, valueList);
+      }
+      else
+      {
+         o = handler.endParticle(o, endName, particle);
+      }
+
+      for(int i = interceptorsTotal - 1; i >= 0; --i)
+      {
+         ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
+         interceptor.endElement(((StackItem)stack.peek(interceptorsTotal - i)).o, endName, type);
+      }
+
+      //
+      // setParent
+      //
+
+      if(localInterceptorsTotal + interceptorsTotal == 0)
+      {
+         ParticleBinding parentParticle = getParentParticle();
+         boolean hasWildcard = false;
+         ParticleHandler wildcardHandler = null;
+         if (parentParticle != null && parentParticle.getTerm().isElement())
+         {
+            WildcardBinding wildcard = ((ElementBinding) parentParticle.getTerm()).getType().getWildcard();
+            if (wildcard != null)
+            {
+               hasWildcard = true;
+               if(parentItem.cursor.isWildcardContent())
+               {
+                  wildcardHandler = wildcard.getWildcardHandler();
+               }
+            }
+         }
+
+         if(parent != null)
+         {
+            /*if(o == null)
+            {
+               throw new JBossXBRuntimeException(endName + " is null!");
+            } */
+            if(wildcardHandler != null)
+            {
+               setParent(wildcardHandler,
+                     parentItem.repeatableParticleValue == null ? parent : parentItem.repeatableParticleValue,
+                     o, endName, particle, parentParticle);
+            }
+            else
+            {
+               setParent(handler,
+                     parentItem.repeatableParticleValue == null ? parent : parentItem.repeatableParticleValue,
+                     o, endName, particle, parentParticle);
+            }
+         }
+         else if(parentParticle != null && hasWildcard && stack.size() > 1)
+         {
+            // the parent has anyType, so it gets the value of its child
+            ListIterator<StackItem> iter = stack.prevIterator();
+            while(iter.hasPrevious())
+            {
+               StackItem peeked = iter.previous();
+               peeked.o = o;
+               if(peeked.cursor == null)
+               {
+                  break;
+               }
+            }
+
+            if(trace)
+            {
+               log.trace("Value of " + endName + " " + o + " is promoted as the value of its parent element.");
+            }
+         }
+      }
+      else
+      {
+         StackItem popped = pop();
+
+         for(int i = interceptorsTotal - 1; i >= 0; --i)
+         {
+            ElementInterceptor interceptor = (ElementInterceptor)interceptors.get(i);
+            parent = pop().o;
+            interceptor.add(parent, o, endName);
+            o = parent;
+         }
+
+         for(int i = localInterceptorsTotal - 1; i >= 0; --i)
+         {
+            ElementInterceptor interceptor = (ElementInterceptor)localInterceptors.get(i);
+            parent = pop().o;
+            interceptor.add(parent, o, endName);
+            o = parent;
+         }
+
+         // need to have correst endRepeatableParticle events
+         stack.push(popped);
+      }
+
+      if(stack.size() == 1)
+      {
+         o = type.getValueAdapter().cast(o, Object.class);
+         root = o;
+         stack.clear();
+         if(sawDTD)
+         {
+            // Probably should be integrated into schema binding?
+            try
+            {
+               // setDTD(String root, String publicId, String systemId)
+               Class[] sig = {String.class, String.class, String.class};
+               Method setDTD = o.getClass().getMethod("setDTD", sig);
+               Object[] args = {dtdRootName, dtdPublicId, dtdSystemId};
+               setDTD.invoke(o, args);
+            }
+            catch(Exception e)
+            {
+               log.debug("No setDTD found on root: " + o);
+            }
+         }
+      }
+   }
+
+   private void setParent(ParticleHandler handler,
+                          Object parent,
+                          Object o,
+                          QName endName,
+                          ParticleBinding particle,
+                          ParticleBinding parentParticle)
+   {
+      TermBeforeSetParentCallback beforeSetParent = particle.getTerm().getBeforeSetParentCallback();
+      if(beforeSetParent != null)
+      {
+         ctx.parent = parent;
+         ctx.particle = particle;
+         ctx.parentParticle = parentParticle;
+         o = beforeSetParent.beforeSetParent(o, ctx);
+         ctx.clear();
+      }
+      
+      if(parent instanceof ValueList /*&& !particle.getTerm().isSkip()*/)
+      {
+         if(parent == o)
+         {            
+            return;
+         }
+         ValueList valueList = (ValueList)parent;
+         valueList.getInitializer().addTermValue(endName, particle, handler, valueList, o, parentParticle);
+      }
+      else
+      {
+         handler.setParent(parent, o, endName, particle, parentParticle);
+      }
+   }
+
+   private void push(ParticleBinding particle, Object o, ParticleHandler handler, TypeBinding parentType)
+   {
+      StackItem item = new StackItem(particle);
+      item.o = o;
+      item.handler = handler;
+      item.parentType = parentType;      
+      stack.push(item);
+      if(trace)
+      {
+         Object binding = null;
+         if(particle != null)
+         {
+            binding = particle.getTerm();
+         }
+         log.trace("pushed " + ((ElementBinding)particle.getTerm()).getQName() + "=" + o + ", binding=" + binding);
+      }
+   }
+
+   private void push(ModelGroupBinding.Cursor cursor, Object o, ParticleHandler handler, TypeBinding parentType)
+   {
+      StackItem item = new StackItem(cursor);
+      item.o = o;
+      item.handler = handler;
+      item.parentType = parentType;
+      stack.push(item);
+      if(trace)
+      {
+         log.trace("pushed cursor " + cursor + ", o=" + o);
+      }
+   }
+
+   private StackItem pop()
+   {
+      StackItem item = stack.pop();
+      if(trace)
+      {
+         if(item.cursor == null)
+         {
+            log.trace("poped " + ((ElementBinding)item.particle.getTerm()).getQName() + "=" + item.particle);
+         }
+         else
+         {
+            log.trace("poped " + item.cursor.getCurrentParticle().getTerm());
+         }
+      }
+      return item;
+   }
+
+   // Inner
+
+   private static class StackItem
+   {
+      final ModelGroupBinding.Cursor cursor;
+      ParticleBinding particle;
+      ParticleBinding nonXsiParticle;
+      ParticleHandler handler;
+      TypeBinding parentType;
+      boolean ignoreCharacters;
+      Object o;
+      ValueList repeatableParticleValue;
+      StringBuffer textContent;
+      Boolean indentation;
+      boolean ignorableCharacters = true;
+      boolean ended;
+
+      public StackItem(ModelGroupBinding.Cursor cursor)
+      {
+         if (cursor == null)
+            throw new IllegalArgumentException("Null cursor");
+         // this is modelgroup particle
+         this.cursor = cursor;
+         this.particle = cursor.getParticle();
+      }
+
+      public StackItem(ParticleBinding particle)
+      {
+         if (particle == null)
+            throw new IllegalArgumentException("Null particle");
+         // this is element particle
+         this.cursor = null;
+         this.particle = particle;
+      }
+
+      void reset()
+      {
+         if(!ended)
+         {
+            throw new JBossXBRuntimeException(
+               "Attempt to reset a particle that has already been reset: " + particle.getTerm()
+            );
+         }
+
+         ended = false;
+         o = null;
+         if(textContent != null)
+         {
+            textContent.delete(0, textContent.length());
+         }
+         
+         indentation = null;
+         ignorableCharacters = true;
+         
+         if(nonXsiParticle != null)
+            particle = nonXsiParticle;
+      }
+   }
+
+   static class StackImpl
+   {
+      private List<StackItem> list = new ArrayList<StackItem>();
+
+      public void clear()
+      {
+         list.clear();
+      }
+
+      public void push(StackItem o)
+      {
+         list.add(o);
+      }
+
+      public StackItem pop()
+      {
+         return list.remove(list.size() - 1);
+      }
+
+      public ListIterator<StackItem> prevIterator()
+      {
+         return list.listIterator(list.size() - 1);
+      }
+
+      public StackItem peek()
+      {
+         return list.get(list.size() - 1);
+      }
+
+      public StackItem peek(int i)
+      {
+         return list.get(list.size() - 1 - i);
+      }
+
+      public boolean isEmpty()
+      {
+         return list.isEmpty();
+      }
+
+      public int size()
+      {
+         return list.size();
+      }
+   }
+   
+   private class UnmarshallingContextImpl implements UnmarshallingContext
+   {
+      Object parent;
+      ParticleBinding particle;
+      ParticleBinding parentParticle;
+      
+      public Object getParentValue()
+      {
+         return parent;
+      }
+      
+      public ParticleBinding getParticle()
+      {
+         return particle;
+      }
+      
+      public ParticleBinding getParentParticle()
+      {
+         return parentParticle;
+      }
+      
+      public String resolvePropertyName()
+      {
+         TermBinding term = particle.getTerm();
+         PropertyMetaData propertyMetaData = term.getPropertyMetaData();
+         String prop = propertyMetaData == null ? null : propertyMetaData.getName();
+         
+         if(prop != null)
+         {
+            return prop;
+         }
+         
+         if(term.isElement())
+         {
+            QName name = ((ElementBinding)term).getQName();
+            prop = Util.xmlNameToFieldName(name.getLocalPart(), term.getSchema().isIgnoreLowLine());
+         }
+         
+         return prop;
+      }
+
+      public Class<?> resolvePropertyType()
+      {
+         if(parent == null)
+         {
+            return null;
+         }
+         
+         String prop = resolvePropertyName();
+         if(prop != null)
+         {      
+            FieldInfo fieldInfo = FieldInfo.getFieldInfo(parent.getClass(), prop, false);
+            if (fieldInfo != null)
+            {
+               return fieldInfo.getType();
+            }
+         }
+         return null;
+      }
+      
+      // private
+      
+      void clear()
+      {
+         ctx.parent = null;
+         ctx.particle = null;
+         ctx.parentParticle = null;
+      }
+   }
+}

Copied: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.java (from rev 2917, jbossxb/trunk/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.java)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.java	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.test.xml.loginconfig.Users;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+
+/**
+ * A LoginConfigUnitTestCase.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class LoginConfigUnitTestCase extends AbstractJBossXBTest
+{
+   public LoginConfigUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testLoginConfig() throws Exception
+   {
+      InputStream xsdIs = openStream("xml/loginconfig/user-roles_1_0.xsd");
+      InputStream xmlIs = openStream("xml/loginconfig/user-roles.xml");
+      SchemaBinding schema = XsdBinder.bind(xsdIs, null);
+      schema.setStrictSchema(true);
+      schema.setIgnoreUnresolvedFieldOrClass(false);
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      Users users = (Users) unmarshaller.unmarshal(xmlIs, schema);
+      assertNotNull(users);
+      assertEquals(6, users.size());
+   }
+   
+   private InputStream openStream(String path) throws IOException
+   {
+      java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path);
+      if (url == null)
+         fail("URL not found: " + path);
+      return url.openStream();
+   }
+}

Deleted: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,257 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.test.xml;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.test.xml.repeatableterms.AbstractProduct;
-import org.jboss.test.xml.repeatableterms.Product;
-import org.jboss.test.xml.repeatableterms.ProductArray;
-
-import junit.framework.TestSuite;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision: $</tt>
- */
-public class RepeatableTermsUnitTestCase
-   extends AbstractJBossXBTest
-{  
-   public RepeatableTermsUnitTestCase(String name)
-   {
-      super(name);
-   }
-   
-   public static final TestSuite suite()
-   {
-      return new TestSuite(RepeatableTermsUnitTestCase.class);
-   }
-
-   protected void configureLogging()
-   {
-      //enableTrace("org.jboss.xb.binding.sunday");
-      //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding");
-      //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding");
-   }
-
-   public void testUnmarshal1() throws Exception
-   {
-      Object o = unmarshal();
-
-      assertNotNull(o);
-      assertTrue(o instanceof Top);
-      Top top = (Top)o;
-
-      assertNotNull(top.item);
-      assertEquals(3, top.item.length);
-      assertEquals(new String[]{"item1", "item2", "item3"}, top.item);
-
-      assertNotNull(top.sequence);
-      //assertEquals(5, top.sequence.length);
-      assertEquals(
-         new Sequence[]
-         {
-            new Sequence("sequenceChoice1_1", null),
-            new Sequence(null, "sequenceChoice2_1"),
-            new Sequence("sequenceChoice1_2", null),
-            new Sequence("sequenceChoice1_3", null),
-            new Sequence(null, "sequenceChoice2_2")
-         },
-         top.sequence
-      );
-
-      assertNotNull(top.choice);
-      assertEquals(3, top.choice.length);
-      assertEquals(
-         new Choice[]
-         {
-            new Choice(new String[]{"choiceChoice1_1", "choiceChoice1_2"}, null),
-            new Choice(null, new String[]{"choiceChoice2_1", "choiceChoice2_2"}),
-            new Choice(new String[]{"choiceChoice1_3", "choiceChoice1_4"}, null),
-         },
-         top.choice
-      );
-   }
-
-   public void testUnmarshal2() throws Exception
-   {
-      Object o = unmarshal();
-      assertNotNull(o);
-      assertTrue(o instanceof Top);
-      Top top = (Top)o;
-
-      assertNull(top.item);
-      assertNull(top.choice);
-      assertNull(top.sequence);
-      
-      assertEquals("item1", top.item1);
-      assertEquals("item2", top.item2);
-   }
-
-   public void testPolymorphicArray() throws Exception
-   {
-      Object o = unmarshal();
-      assertNotNull(o);
-      assertTrue(o instanceof ProductArray);
-      ProductArray arr = (ProductArray) o;
-      List<AbstractProduct> products = arr.getProduct();
-      assertNotNull(products);
-      assertEquals(3, products.size());
-      
-      int i = 0;
-      while(i < products.size())
-      {
-         Product product = (Product) products.get(i++);
-         assertNotNull(product);
-         assertEquals("product" + i, product.getName());
-         assertEquals(i, product.getPrice());
-      }
-   }
-   
-   // Inner
-
-   public static final class Top
-   {
-      public String[] item;
-      public Sequence[] sequence;
-      public Choice[] choice;
-
-      public String item1;
-      public String item2;
-      
-      public String toString()
-      {
-         return "[top item=" + (item == null ? null : Arrays.asList(item)) +
-            " sequence=" + (sequence == null ? null : Arrays.asList(sequence)) +
-            " choice=" + (choice == null ? null : Arrays.asList(choice)) +
-            " item1=" + item1 + " item2=" + item2 + "]";
-      }
-   }
-
-   public static final class Sequence
-   {
-      public String sequenceChoice1;
-      public String sequenceChoice2;
-
-      public Sequence()
-      {
-      }
-
-      public Sequence(String sequenceChoice1, String sequenceChoice2)
-      {
-         this.sequenceChoice1 = sequenceChoice1;
-         this.sequenceChoice2 = sequenceChoice2;
-      }
-
-      public String toString()
-      {
-         return "[" + sequenceChoice1 + " " + sequenceChoice2 + "]";
-      }
-
-      public boolean equals(Object o)
-      {
-         if(this == o)
-         {
-            return true;
-         }
-         if(!(o instanceof Sequence))
-         {
-            return false;
-         }
-
-         final Sequence sequence = (Sequence)o;
-
-         if(sequenceChoice1 != null ? !sequenceChoice1.equals(sequence.sequenceChoice1) : sequence.sequenceChoice1 != null)
-         {
-            return false;
-         }
-         if(sequenceChoice2 != null ? !sequenceChoice2.equals(sequence.sequenceChoice2) : sequence.sequenceChoice2 != null)
-         {
-            return false;
-         }
-
-         return true;
-      }
-
-      public int hashCode()
-      {
-         int result;
-         result = (sequenceChoice1 != null ? sequenceChoice1.hashCode() : 0);
-         result = 29 * result + (sequenceChoice2 != null ? sequenceChoice2.hashCode() : 0);
-         return result;
-      }
-   }
-
-   public static final class Choice
-   {
-      public String[] choiceChoice1;
-      public String[] choiceChoice2;
-
-      public Choice()
-      {
-      }
-
-      public Choice(String[] choiceChoice1, String[] choiceChoice2)
-      {
-         this.choiceChoice1 = choiceChoice1;
-         this.choiceChoice2 = choiceChoice2;
-      }
-
-      public String toString()
-      {
-         return "[" +
-            (choiceChoice1 == null ? null : Arrays.asList(choiceChoice1)) +
-            " " + (choiceChoice2 == null ? null : Arrays.asList(choiceChoice2)) + "]";
-      }
-
-      public boolean equals(Object o)
-      {
-         if(this == o)
-         {
-            return true;
-         }
-         if(!(o instanceof Choice))
-         {
-            return false;
-         }
-
-         final Choice choice = (Choice)o;
-
-         if(!Arrays.equals(choiceChoice1, choice.choiceChoice1))
-         {
-            return false;
-         }
-         if(!Arrays.equals(choiceChoice2, choice.choiceChoice2))
-         {
-            return false;
-         }
-
-         return true;
-      }
-
-      public int hashCode()
-      {
-         return 0;
-      }
-   }
-}

Copied: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java (from rev 2917, jbossxb/trunk/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,285 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.xml;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.test.xml.repeatableterms.AbstractProduct;
+import org.jboss.test.xml.repeatableterms.Product;
+import org.jboss.test.xml.repeatableterms.ProductArray;
+
+import junit.framework.TestSuite;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: $</tt>
+ */
+public class RepeatableTermsUnitTestCase
+   extends AbstractJBossXBTest
+{  
+   public RepeatableTermsUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public static final TestSuite suite()
+   {
+      return new TestSuite(RepeatableTermsUnitTestCase.class);
+   }
+
+   protected void configureLogging()
+   {
+      //enableTrace("org.jboss.xb.binding.sunday");
+      //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding");
+      //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding");
+   }
+
+   public void testUnmarshal1() throws Exception
+   {
+      Object o = unmarshal();
+
+      assertNotNull(o);
+      assertTrue(o instanceof Top);
+      Top top = (Top)o;
+
+      assertNotNull(top.item);
+      assertEquals(3, top.item.length);
+      assertEquals(new String[]{"item1", "item2", "item3"}, top.item);
+
+      assertNotNull(top.sequence);
+      //assertEquals(5, top.sequence.length);
+      assertEquals(
+         new Sequence[]
+         {
+            new Sequence("sequenceChoice1_1", null),
+            new Sequence(null, "sequenceChoice2_1"),
+            new Sequence("sequenceChoice1_2", null),
+            new Sequence("sequenceChoice1_3", null),
+            new Sequence(null, "sequenceChoice2_2")
+         },
+         top.sequence
+      );
+
+      assertNotNull(top.choice);
+      assertEquals(3, top.choice.length);
+      assertEquals(
+         new Choice[]
+         {
+            new Choice(new String[]{"choiceChoice1_1", "choiceChoice1_2"}, null),
+            new Choice(null, new String[]{"choiceChoice2_1", "choiceChoice2_2"}),
+            new Choice(new String[]{"choiceChoice1_3", "choiceChoice1_4"}, null),
+         },
+         top.choice
+      );
+   }
+
+   public void testUnmarshal2() throws Exception
+   {
+      Object o = unmarshal();
+      assertNotNull(o);
+      assertTrue(o instanceof Top);
+      Top top = (Top)o;
+
+      assertNull(top.item);
+      assertNull(top.choice);
+      assertNull(top.sequence);
+      
+      assertEquals("item1", top.item1);
+      assertEquals("item2", top.item2);
+   }
+
+   public void testPolymorphicArray() throws Exception
+   {
+      Object o = unmarshal();
+      assertNotNull(o);
+      assertTrue(o instanceof ProductArray);
+      ProductArray arr = (ProductArray) o;
+      List<AbstractProduct> products = arr.getProduct();
+      assertNotNull(products);
+      assertEquals(3, products.size());
+      
+      int i = 0;
+      while(i < products.size())
+      {
+         Product product = (Product) products.get(i++);
+         assertNotNull(product);
+         assertEquals("product" + i, product.getName());
+         assertEquals(i, product.getPrice());
+      }
+   }
+
+   public void testPolymorphicArray2() throws Exception
+   {
+      Object o = unmarshal();
+      assertNotNull(o);
+      assertTrue(o instanceof ProductArray);
+      ProductArray arr = (ProductArray) o;
+      List<AbstractProduct> products = arr.getProduct();
+      assertNotNull(products);
+      assertEquals(3, products.size());
+      
+      int i = 0;
+      AbstractProduct product = products.get(i++);
+      assertNotNull(product);
+      assertEquals("product" + i, product.getName());
+      assertFalse(product instanceof Product);
+
+      product = products.get(i++);
+      assertNotNull(product);
+      assertEquals("product" + i, product.getName());
+      assertTrue(product instanceof Product);
+      assertEquals(i, ((Product)product).getPrice());
+      
+      product = products.get(i++);
+      assertNotNull(product);
+      assertEquals("product" + i, product.getName());
+      assertFalse(product instanceof Product);
+   }
+
+   // Inner
+
+   public static final class Top
+   {
+      public String[] item;
+      public Sequence[] sequence;
+      public Choice[] choice;
+
+      public String item1;
+      public String item2;
+      
+      public String toString()
+      {
+         return "[top item=" + (item == null ? null : Arrays.asList(item)) +
+            " sequence=" + (sequence == null ? null : Arrays.asList(sequence)) +
+            " choice=" + (choice == null ? null : Arrays.asList(choice)) +
+            " item1=" + item1 + " item2=" + item2 + "]";
+      }
+   }
+
+   public static final class Sequence
+   {
+      public String sequenceChoice1;
+      public String sequenceChoice2;
+
+      public Sequence()
+      {
+      }
+
+      public Sequence(String sequenceChoice1, String sequenceChoice2)
+      {
+         this.sequenceChoice1 = sequenceChoice1;
+         this.sequenceChoice2 = sequenceChoice2;
+      }
+
+      public String toString()
+      {
+         return "[" + sequenceChoice1 + " " + sequenceChoice2 + "]";
+      }
+
+      public boolean equals(Object o)
+      {
+         if(this == o)
+         {
+            return true;
+         }
+         if(!(o instanceof Sequence))
+         {
+            return false;
+         }
+
+         final Sequence sequence = (Sequence)o;
+
+         if(sequenceChoice1 != null ? !sequenceChoice1.equals(sequence.sequenceChoice1) : sequence.sequenceChoice1 != null)
+         {
+            return false;
+         }
+         if(sequenceChoice2 != null ? !sequenceChoice2.equals(sequence.sequenceChoice2) : sequence.sequenceChoice2 != null)
+         {
+            return false;
+         }
+
+         return true;
+      }
+
+      public int hashCode()
+      {
+         int result;
+         result = (sequenceChoice1 != null ? sequenceChoice1.hashCode() : 0);
+         result = 29 * result + (sequenceChoice2 != null ? sequenceChoice2.hashCode() : 0);
+         return result;
+      }
+   }
+
+   public static final class Choice
+   {
+      public String[] choiceChoice1;
+      public String[] choiceChoice2;
+
+      public Choice()
+      {
+      }
+
+      public Choice(String[] choiceChoice1, String[] choiceChoice2)
+      {
+         this.choiceChoice1 = choiceChoice1;
+         this.choiceChoice2 = choiceChoice2;
+      }
+
+      public String toString()
+      {
+         return "[" +
+            (choiceChoice1 == null ? null : Arrays.asList(choiceChoice1)) +
+            " " + (choiceChoice2 == null ? null : Arrays.asList(choiceChoice2)) + "]";
+      }
+
+      public boolean equals(Object o)
+      {
+         if(this == o)
+         {
+            return true;
+         }
+         if(!(o instanceof Choice))
+         {
+            return false;
+         }
+
+         final Choice choice = (Choice)o;
+
+         if(!Arrays.equals(choiceChoice1, choice.choiceChoice1))
+         {
+            return false;
+         }
+         if(!Arrays.equals(choiceChoice2, choice.choiceChoice2))
+         {
+            return false;
+         }
+
+         return true;
+      }
+
+      public int hashCode()
+      {
+         return 0;
+      }
+   }
+}

Copied: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/loginconfig (from rev 2917, jbossxb/trunk/src/test/java/org/jboss/test/xml/loginconfig)

Deleted: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.xml.repeatableterms;
-
-/**
- * A BasicProduct.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractProduct
-{
-   private String name;
-   
-   public String getName()
-   {
-      return name;
-   }
-   
-   public void setName(String name)
-   {
-      this.name = name;
-   }
-}

Copied: jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java (from rev 2917, jbossxb/trunk/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.java	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xml.repeatableterms;
+
+/**
+ * A BasicProduct.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractProduct
+{
+   private String name;
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Copied: jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xml (from rev 2917, jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xml)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xml	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xml	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<product-array xmlns='http://www.jboss.org/test/xml/repeatableterms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+  <product>
+    <name>product1</name>
+  </product>
+  <product xsi:type='Product'>
+    <name>product2</name>
+    <price>2</price>
+  </product>
+  <product>
+    <name>product3</name>
+  </product>
+</product-array>

Copied: jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsd (from rev 2917, jbossxb/trunk/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsd)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsd	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsd	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+   targetNamespace="http://www.jboss.org/test/xml/repeatableterms"
+   xmlns="http://www.jboss.org/test/xml/repeatableterms"
+   xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
+   elementFormDefault="qualified"
+   attributeFormDefault="unqualified"
+   version="1.0">
+
+   <xsd:element name="product-array">
+      <xsd:annotation>
+         <xsd:appinfo>
+            <jbxb:class impl="org.jboss.test.xml.repeatableterms.ProductArray"/>
+         </xsd:appinfo>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element name="product" type="AbstractProduct" maxOccurs="unbounded"/>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:complexType name='AbstractProduct'>
+     <xsd:annotation>
+       <xsd:appinfo>
+          <jbxb:class impl="org.jboss.test.xml.repeatableterms.AbstractProduct"/>
+       </xsd:appinfo>
+     </xsd:annotation>
+     <xsd:sequence>
+        <xsd:element name='name' nillable='true' type='xsd:string'/>
+     </xsd:sequence>
+   </xsd:complexType>
+   <xsd:complexType name='Product'>
+    <xsd:annotation>
+       <xsd:appinfo>
+          <jbxb:class impl="org.jboss.test.xml.repeatableterms.Product"/>
+       </xsd:appinfo>
+    </xsd:annotation>
+    <xsd:complexContent>
+     <xsd:extension base='AbstractProduct'>
+      <xsd:sequence>
+       <xsd:element name='price' type='xsd:int'/>
+      </xsd:sequence>
+     </xsd:extension>
+    </xsd:complexContent>
+   </xsd:complexType>
+</xsd:schema>

Copied: jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles.xml (from rev 2917, jbossxb/trunk/src/test/resources/xml/loginconfig/user-roles.xml)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles.xml	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles.xml	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,32 @@
+<ur:users
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="urn:jboss:user-roles user-roles_1_0.xsd"
+   xmlns:ur="urn:jboss:user-roles">
+   <ur:user name="jduke" password="theduke">
+      <ur:role name="Role1"/>
+      <ur:role name="Role2"/>
+      <ur:role name="Echo"/>
+      <ur:role name="callerJduke" group="CallerPrincipal"/>
+   </ur:user>
+   <ur:user name="scott" password="echoman">
+      <ur:role name="Echo"/>
+      <ur:role name="ProjectUser"/>
+      <ur:role name="callerScott" group="CallerPrincipal"/>
+   </ur:user>
+   <ur:user name="stark" password="javaman">
+      <ur:role name="Java"/>
+      <ur:role name="Coder"/>
+      <ur:role name="callerStark" group="CallerPrincipal"/>
+   </ur:user>
+   <ur:user name="jdukeman" password="anotherduke">
+      <ur:role name="Role2"/>
+      <ur:role name="Role3"/>
+      <ur:role name="callerJdukeman" group="CallerPrincipal"/>
+   </ur:user>
+      <ur:user name="invoker" password="invoker">
+      <ur:role name="HttpInvoker"/>
+   </ur:user>
+   <ur:user name="admin" password="admin">
+      <ur:role name="JBossAdmin"/>
+   </ur:user>
+</ur:users>

Deleted: jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/xml/loginconfig/user-roles_1_0.xsd	2008-09-09 13:19:00 UTC (rev 2913)
+++ jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd	2008-09-11 00:29:49 UTC (rev 2919)
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: user-roles_1_0.xsd 34316 2005-07-31 23:13:44Z starksm $ -->
-
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-   elementFormDefault="qualified"
-   targetNamespace="urn:jboss:user-roles"
-   xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
-   xmlns:ur="urn:jboss:user-roles">
-
-   <xsd:element name="users">
-      <xsd:annotation>
-         <xsd:appinfo>
-            <jbxb:class impl="org.jboss.security.auth.spi.Users"/>
-         </xsd:appinfo>
-      </xsd:annotation>
-      <xsd:complexType>
-         <xsd:sequence>
-            <xsd:element minOccurs="1" maxOccurs="unbounded" ref="ur:user"/>
-         </xsd:sequence>
-      </xsd:complexType>
-   </xsd:element>
-   <xsd:element name="user">
-      <xsd:annotation>
-         <xsd:appinfo>
-            <jbxb:class impl="org.jboss.security.auth.spi.Users$User"/>
-            <jbxb:addMethod name="addUser" valueType="child"/>
-         </xsd:appinfo>
-      </xsd:annotation>
-      <xsd:complexType>
-         <xsd:sequence>
-            <xsd:element minOccurs="0" maxOccurs="unbounded" ref="ur:role"/>
-         </xsd:sequence>
-         <xsd:attribute name="name" use="required" type="xsd:NCName"/>
-         <xsd:attribute name="password" use="required" type="xsd:NCName"/>
-      </xsd:complexType>
-   </xsd:element>
-   <xsd:element name="role">
-      <xsd:annotation>
-         <xsd:appinfo>
-            <jbxb:mapEntry/>
-            <jbxb:putMethod name="addRole"
-               keyType="java.lang.String" valueType="java.lang.String" />
-         </xsd:appinfo>
-      </xsd:annotation>
-
-      <xsd:complexType>
-         <xsd:attribute name="group" use="optional" type="xsd:NCName" default="Roles">
-            <xsd:annotation>
-               <xsd:appinfo>
-                  <jbxb:mapEntryValue/>
-               </xsd:appinfo>
-            </xsd:annotation>
-         </xsd:attribute>
-         <xsd:attribute name="name" use="required" type="xsd:NCName">
-            <xsd:annotation>
-               <xsd:appinfo>
-                  <jbxb:mapEntryKey/>
-               </xsd:appinfo>
-            </xsd:annotation>
-         </xsd:attribute> 
-      </xsd:complexType>
-   </xsd:element>
-</xsd:schema>

Copied: jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd (from rev 2917, jbossxb/trunk/src/test/resources/xml/loginconfig/user-roles_1_0.xsd)
===================================================================
--- jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd	                        (rev 0)
+++ jbossxb/tags/2.0.0.CR14/src/test/resources/xml/loginconfig/user-roles_1_0.xsd	2008-09-11 00:29:49 UTC (rev 2919)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id: user-roles_1_0.xsd 34316 2005-07-31 23:13:44Z starksm $ -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+   elementFormDefault="qualified"
+   targetNamespace="urn:jboss:user-roles"
+   xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
+   xmlns:ur="urn:jboss:user-roles">
+
+   <xsd:element name="users">
+      <xsd:annotation>
+         <xsd:appinfo>
+            <jbxb:class impl="org.jboss.test.xml.loginconfig.Users"/>
+         </xsd:appinfo>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element minOccurs="1" maxOccurs="unbounded" ref="ur:user"/>
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:element name="user">
+      <xsd:annotation>
+         <xsd:appinfo>
+            <jbxb:class impl="org.jboss.test.xml.loginconfig.Users$User"/>
+            <jbxb:addMethod name="addUser" valueType="child"/>
+         </xsd:appinfo>
+      </xsd:annotation>
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element minOccurs="0" maxOccurs="unbounded" ref="ur:role"/>
+         </xsd:sequence>
+         <xsd:attribute name="name" use="required" type="xsd:NCName"/>
+         <xsd:attribute name="password" use="required" type="xsd:NCName"/>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:element name="role">
+      <xsd:annotation>
+         <xsd:appinfo>
+            <jbxb:mapEntry/>
+            <jbxb:putMethod name="addRole"
+               keyType="java.lang.String" valueType="java.lang.String" />
+         </xsd:appinfo>
+      </xsd:annotation>
+
+      <xsd:complexType>
+         <xsd:attribute name="group" use="optional" type="xsd:NCName" default="Roles">
+            <xsd:annotation>
+               <xsd:appinfo>
+                  <jbxb:mapEntryValue/>
+               </xsd:appinfo>
+            </xsd:annotation>
+         </xsd:attribute>
+         <xsd:attribute name="name" use="required" type="xsd:NCName">
+            <xsd:annotation>
+               <xsd:appinfo>
+                  <jbxb:mapEntryKey/>
+               </xsd:appinfo>
+            </xsd:annotation>
+         </xsd:attribute> 
+      </xsd:complexType>
+   </xsd:element>
+</xsd:schema>




More information about the jboss-svn-commits mailing list