[jboss-svn-commits] JBoss Common SVN: r2999 - in jbossxb/trunk/src: test/java/org/jboss/test/xml and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 2 05:14:31 EST 2009


Author: alex.loubyansky at jboss.com
Date: 2009-03-02 05:14:31 -0500 (Mon, 02 Mar 2009)
New Revision: 2999

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/
   jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/
   jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.java
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.xsd
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testBar.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo2Bar.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo3Bar.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFooBar.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.xsd
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testBar.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testFooBar.xml
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllBinding.java
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ChoiceBinding.java
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ModelGroupBinding.java
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/MultiClassSchemaResolver.java
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SequenceBinding.java
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java
Log:
JBXB-182

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllBinding.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllBinding.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllBinding.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -84,7 +84,6 @@
       return new Cursor(particle)
       {
          private ParticleBinding curParticle;
-         private int occurence;
 
          public ParticleBinding getCurrentParticle()
          {
@@ -115,11 +114,6 @@
             }
          }
 
-         public int getOccurence()
-         {
-            return occurence;
-         }
-
          public boolean isWildcardContent()
          {
             return false;

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ChoiceBinding.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ChoiceBinding.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ChoiceBinding.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -78,7 +78,6 @@
       {
          private int pos = -1;
          private ElementBinding element;
-         private int occurence;
          private boolean wildcardContent;
 
          public ParticleBinding getCurrentParticle()
@@ -123,11 +122,6 @@
             }
          }
 
-         public int getOccurence()
-         {
-            return occurence;
-         }
-
          public boolean isWildcardContent()
          {
             return wildcardContent;
@@ -202,9 +196,8 @@
                      }
 
                      int groupStackSize = groupStack.size();
-                     groupStack = modelGroup.newCursor(particle).startElement(
-                        qName, atts, passedGroups, groupStack, particle.isRequired(occurence)
-                     );
+                     boolean isRequired = occurence == 0 ? false : particle.isRequired(occurence);
+                     groupStack = modelGroup.newCursor(particle).startElement(qName, atts, passedGroups, groupStack, isRequired);
 
                      if(groupStackSize != groupStack.size())
                      {

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ModelGroupBinding.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ModelGroupBinding.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ModelGroupBinding.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -192,6 +192,7 @@
    {
       protected final ParticleBinding particle;
       protected final boolean trace = log.isTraceEnabled();
+      protected int occurence;
 
       protected Cursor(ParticleBinding particle)
       {
@@ -226,8 +227,25 @@
 
       public abstract void endElement(QName qName);
 
-      public abstract int getOccurence();
+      public int getOccurence()
+      {
+         return occurence;
+      }
 
+      public boolean repeatElement(QName qName)
+      {
+         ParticleBinding particle = getCurrentParticle();
+         if(particle.getMaxOccursUnbounded() ||
+            occurence < particle.getMinOccurs() ||
+            occurence < particle.getMaxOccurs())
+         {
+            ++occurence;
+            return true;
+         }
+         else
+            return false;
+      }
+      
       public abstract boolean isWildcardContent();
       
       // Protected

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/MultiClassSchemaResolver.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/MultiClassSchemaResolver.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/MultiClassSchemaResolver.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -443,6 +443,7 @@
 
       if( trace )
          log.trace("getInputSource, nsURI="+nsURI+", baseURI="+baseURI+", schemaLocation="+schemaLocation);
+      System.out.println("getInputSource, nsURI="+nsURI+", baseURI="+baseURI+", schemaLocation="+schemaLocation);
 
       // First try what is requested
       try

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SequenceBinding.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SequenceBinding.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SequenceBinding.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -87,7 +87,6 @@
       {
          private int pos = -1;
          private ElementBinding element;
-         private int occurence;
          private boolean wildcardContent;
 
          public ParticleBinding getCurrentParticle()
@@ -95,7 +94,7 @@
             if(pos < 0)
             {
                throw new JBossXBRuntimeException(
-                  "The cursor has not been positioned yet! startElement should be called."
+                  "The cursor has not been positioned yet for " + SequenceBinding.this.toString()
                );
             }
             return (ParticleBinding)sequence.get(pos);
@@ -106,7 +105,7 @@
             if(pos < 0)
             {
                throw new JBossXBRuntimeException(
-                  "The cursor has not been positioned yet! startElement should be called."
+                     "The cursor has not been positioned yet for " + SequenceBinding.this.toString()
                );
             }
             return element;
@@ -131,12 +130,7 @@
                log.trace("endElement " + qName + " in " + getModelGroup());
             }
          }
-
-         public int getOccurence()
-         {
-            return occurence;
-         }
-
+         
          public boolean isWildcardContent()
          {
             return wildcardContent;

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	2009-02-27 10:46:00 UTC (rev 2998)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -331,13 +331,30 @@
                {
                   if(element.getQName().equals(startName))
                   {
-                     item.reset();
-                     particle = item.particle;
-                     parentType = item.parentType;
-                     repeated = true;
+                     if(item.particle.isRepeatable())
+                     {
+                        StackItem parentItem = stack.peek(1);
+                        if(parentItem.cursor.repeatElement(startName))
+                        {
+                           item.reset();
+                           particle = item.particle;
+                           parentType = item.parentType;
+                           repeated = true;
+                        }
+                        else
+                        {
+                           pop();
+                           endRepeatableParticle(item.particle);
+                           continue;
+                        }
+                     }
+                     else
+                     {
+                        item.reset();
+                        particle = item.particle;
+                        parentType = item.parentType;
+                        repeated = true;
 
-                     if(!particle.isRepeatable())
-                     {
                         endRepeatableParent(startName);
                      }
                   }
@@ -345,9 +362,7 @@
                   {
                      pop();                     
                      if(item.particle.isRepeatable())
-                     {
                         endRepeatableParticle(item.particle);
-                     }
                      continue;
                   }
                }
@@ -1395,13 +1410,9 @@
       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;
    }

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,181 @@
+/*
+ * 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.choiceresolution.test;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.test.xml.AbstractJBossXBTest;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.metadata.ClassMetaData;
+import org.jboss.xb.binding.metadata.PropertyMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+
+/**
+ * A ChoiceResolutionUnitTestCase.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class Foo2BarSequenceOrBarUnitTestCase extends AbstractJBossXBTest
+{
+   public Foo2BarSequenceOrBarUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testBar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");
+      SchemaBinding schema = getSchemaBinding();
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      Object o = unmarshaller.unmarshal(xml, schema);
+      assertNotNull(o);
+      Root root = (Root) o;
+      assertNull(root.foo);
+      assertNull(root.barMaxOccurs2);
+      assertEquals("bar", root.bar);
+   }
+
+   public void testFooBar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");
+      SchemaBinding schema = getSchemaBinding();
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      Object o = unmarshaller.unmarshal(xml, schema);
+      assertNotNull(o);
+      Root root = (Root) o;
+      assertEquals("foo", root.foo);
+      assertNotNull(root.barMaxOccurs2);
+      assertEquals(1, root.barMaxOccurs2.size());
+      assertEquals("bar", root.barMaxOccurs2.get(0));
+      assertNull(root.bar);
+   }
+
+   public void testFoo2Bar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");
+      SchemaBinding schema = getSchemaBinding();
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      Object o = unmarshaller.unmarshal(xml, schema);
+      assertNotNull(o);
+      Root root = (Root) o;
+      assertEquals("foo", root.foo);
+      assertNotNull(root.barMaxOccurs2);
+      assertEquals(2, root.barMaxOccurs2.size());
+      assertEquals("bar1", root.barMaxOccurs2.get(0));
+      assertEquals("bar2", root.barMaxOccurs2.get(1));
+      assertNull(root.bar);
+   }
+
+   public void testFoo3Bar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");      
+      SchemaBinding schema = getSchemaBinding();
+      
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      Object o = unmarshaller.unmarshal(xml, schema);
+      assertNotNull(o);
+      Root root = (Root) o;
+      assertEquals("foo", root.foo);
+      assertNotNull(root.barMaxOccurs2);
+      assertEquals(2, root.barMaxOccurs2.size());
+      assertEquals("bar1", root.barMaxOccurs2.get(0));
+      assertEquals("bar2", root.barMaxOccurs2.get(1));
+      assertEquals("bar3", root.bar);
+   }
+
+   private SchemaBinding getSchemaBinding()
+   {
+      String xsd = findXML(getRootName() + ".xsd");
+      SchemaBinding schema = XsdBinder.bind(xsd);
+      schema.setStrictSchema(true);
+      schema.setIgnoreUnresolvedFieldOrClass(false);
+      
+      ElementBinding e = schema.getElement(new QName("file:///tmp/test.xsd", "message"));
+      assertNotNull(e);
+      TypeBinding type = e.getType();
+
+      ClassMetaData cmd = new ClassMetaData();
+      cmd.setImpl(Root.class.getName());
+      type.setClassMetaData(cmd);
+      
+      TermBinding t = type.getParticle().getTerm();
+      assertTrue(t instanceof ChoiceBinding);
+      Collection<ParticleBinding> particles = ((ChoiceBinding)t).getParticles();
+      assertEquals(2, particles.size());
+      Iterator<ParticleBinding> i = particles.iterator();
+      ParticleBinding p = i.next();
+      assertEquals(1, p.getMinOccurs());
+      assertEquals(1, p.getMaxOccurs());
+      assertFalse(p.getMaxOccursUnbounded());
+      t = p.getTerm();
+      assertTrue(t instanceof SequenceBinding);
+      
+      p = i.next();
+      assertEquals(1, p.getMinOccurs());
+      assertEquals(1, p.getMaxOccurs());
+      assertFalse(p.getMaxOccursUnbounded());
+      assertTrue(p.getTerm().isElement());
+      assertEquals(new QName("file:///tmp/test.xsd", "bar"), ((ElementBinding)p.getTerm()).getQName());
+            
+      particles = ((SequenceBinding)t).getParticles();
+      assertEquals(2, particles.size());
+      i = particles.iterator();
+      p = i.next();
+      assertEquals(1, p.getMinOccurs());
+      assertEquals(1, p.getMaxOccurs());
+      assertFalse(p.getMaxOccursUnbounded());
+      assertTrue(p.getTerm().isElement());
+      assertEquals(new QName("file:///tmp/test.xsd", "foo"), ((ElementBinding)p.getTerm()).getQName());
+
+      p = i.next();
+      assertEquals(1, p.getMinOccurs());
+      assertEquals(2, p.getMaxOccurs());
+      assertFalse(p.getMaxOccursUnbounded());
+      assertTrue(p.getTerm().isElement());
+      e = (ElementBinding) p.getTerm();
+      assertEquals(new QName("file:///tmp/test.xsd", "bar"), e.getQName());
+      PropertyMetaData pmd = new PropertyMetaData();
+      pmd.setName("barMaxOccurs2");
+      e.setPropertyMetaData(pmd);
+      return schema;
+   }
+   
+   public static class Root
+   {
+      public String foo;
+      public List<String> barMaxOccurs2;
+      public String bar;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.java	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,60 @@
+/*
+ * 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.choiceresolution.test;
+
+import org.jboss.test.xml.AbstractJBossXBTest;
+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 ChoiceResolutionUnitTestCase.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class FooBarSequenceOrBarUnitTestCase extends AbstractJBossXBTest
+{
+   public FooBarSequenceOrBarUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testBar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");
+      String xsd = findXML(getRootName() + ".xsd");
+      SchemaBinding schema = XsdBinder.bind(xsd);
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      unmarshaller.unmarshal(xml, schema);
+   }
+
+   public void testFooBar() throws Exception
+   {
+      String xml = findXML(getRootName() + '_' + getName() + ".xml");
+      String xsd = findXML(getRootName() + ".xsd");
+      SchemaBinding schema = XsdBinder.bind(xsd);
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      unmarshaller.unmarshal(xml, schema);
+   }
+}

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.xsd	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.xsd	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,19 @@
+<?xml version = "1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            elementFormDefault="qualified"
+            targetNamespace="file:///tmp/test.xsd"
+            xmlns="file:///tmp/test.xsd">
+
+<xsd:element name="message">
+  <xsd:complexType>
+    <xsd:choice maxOccurs="2">
+       <xsd:sequence>
+          <xsd:element name="foo" type="xsd:string"/>
+          <xsd:element name="bar" type="xsd:string" maxOccurs="2"/>
+       </xsd:sequence>
+       <xsd:element name="bar" type="xsd:string" maxOccurs="1"/>
+     </xsd:choice>
+  </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testBar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testBar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testBar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <bar>bar</bar>
+</message>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo2Bar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo2Bar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo2Bar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <foo>foo</foo>
+   <bar>bar1</bar>
+   <bar>bar2</bar>
+</message>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo3Bar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo3Bar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo3Bar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <foo>foo</foo>
+   <bar>bar1</bar>
+   <bar>bar2</bar>
+   <bar>bar3</bar>
+</message>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFooBar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFooBar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFooBar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <foo>foo</foo>
+   <bar>bar</bar>
+</message>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.xsd	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.xsd	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,19 @@
+<?xml version = "1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            elementFormDefault="qualified"
+            targetNamespace="file:///tmp/test.xsd"
+            xmlns="file:///tmp/test.xsd">
+
+<xsd:element name="message">
+  <xsd:complexType>
+  <xsd:choice>
+    <xsd:sequence>
+       <xsd:element name="foo" type="xsd:string"/>
+       <xsd:element name="bar" type="xsd:string"/>
+    </xsd:sequence>
+    <xsd:element name="bar" type="xsd:string"/>
+  </xsd:choice>
+  </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testBar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testBar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testBar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<!-- <foo>goodbye</foo> -->
+   <bar>HelloWorld</bar>
+</message>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testFooBar.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testFooBar.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testFooBar.xml	2009-03-02 10:14:31 UTC (rev 2999)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message xmlns="file:///tmp/test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <foo>goodbye</foo>
+   <bar>HelloWorld</bar>
+</message>




More information about the jboss-svn-commits mailing list