[jboss-svn-commits] JBoss Common SVN: r2180 - in jbossxb/trunk/src: main/java/org/jboss/xb/binding/sunday/unmarshalling test/java/org/jboss/test/xml test/resources/org/jboss/test/xml

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 28 08:40:31 EST 2006


Author: adrian at jboss.org
Date: 2006-11-28 08:40:26 -0500 (Tue, 28 Nov 2006)
New Revision: 2180

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.java
   jbossxb/trunk/src/test/resources/org/jboss/test/xml/NestedWildcard.xsd
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java
Log:
[JBXB-90] - Wildcard bindings not detected in complicated/nested model groups.

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java	2006-11-24 14:45:41 UTC (rev 2179)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java	2006-11-28 13:40:26 UTC (rev 2180)
@@ -614,7 +614,9 @@
             }
             else if(term.isModelGroup())
             {
-               return getWildcard(term);
+               WildcardBinding wc = getWildcard(term);
+               if (wc != null)
+                  return wc;
             }
          }
       }

Added: jbossxb/trunk/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.java	2006-11-24 14:45:41 UTC (rev 2179)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.java	2006-11-28 13:40:26 UTC (rev 2180)
@@ -0,0 +1,78 @@
+/*
+  * 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 javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestSuite;
+
+import org.jboss.util.Strings;
+import org.jboss.util.xml.DOMWriter;
+import org.jboss.xb.binding.metadata.ClassMetaData;
+import org.jboss.xb.binding.metadata.ValueMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.Attributes;
+
+/**
+ * NestedWildcardUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class NestedWildcardUnitTestCase extends AbstractJBossXBTest
+{  
+   private static final String NS = "http://www.jboss.org/test/xml/nestedWildcard";
+   
+   public static final TestSuite suite()
+   {
+      return new TestSuite(NestedWildcardUnitTestCase.class);
+   }
+   
+   public NestedWildcardUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testNestedWildcard() throws Exception
+   {
+      SchemaBinding schema = bind("NestedWildcard.xsd");
+      TypeBinding type = schema.getType(new QName(NS, "nested-wildcard"));
+      WildcardBinding wc = type.getWildcard();
+      assertNotNull(wc);
+   }
+}

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xml/NestedWildcard.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xml/NestedWildcard.xsd	2006-11-24 14:45:41 UTC (rev 2179)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xml/NestedWildcard.xsd	2006-11-28 13:40:26 UTC (rev 2180)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://www.jboss.org/test/xml/nestedWildcard"
+            xmlns="http://www.jboss.org/test/xml/nestedWildcard"
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified"
+            version="1.0">
+
+   <xsd:complexType name="nested-wildcard" mixed="true">
+      <xsd:sequence>
+         <xsd:element name="e1" type="xsd:string"/>
+         <xsd:choice minOccurs="0">
+            <xsd:sequence>        
+               <xsd:element name="e2" type="xsd:string" minOccurs="0"/>
+               <xsd:element name="e3" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+            </xsd:sequence>
+            <xsd:element name="e4" type="xsd:string"/>
+            <xsd:any namespace="##other" processContents="strict"/>
+         </xsd:choice>
+      </xsd:sequence>
+   </xsd:complexType>
+   
+</xsd:schema>




More information about the jboss-svn-commits mailing list