Author: bimargulies
Date: Sun Nov 16 09:21:23 2008
New Revision: 718061

URL: http://svn.apache.org/viewvc?rev=718061&view=rev
Log:
WSCOMMONS-353

Added:
    
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
   (with props)
Modified:
    
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
    
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/AnyTest.java

Modified: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?rev=718061&r1=718060&r2=718061&view=diff
==============================================================================
--- 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
 (original)
+++ 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
 Sun Nov 16 09:21:23 2008
@@ -943,6 +943,12 @@
         XmlSchemaObjectCollection attrColl = complexTypeObj.attributes;
         if (attrColl.getCount() > 0)
             setupAttr(doc, attrColl, schema, serializedComplexType);
+        
+        XmlSchemaAnyAttribute anyAttribute = complexTypeObj.getAnyAttribute();
+        if(anyAttribute != null) {
+               serializedComplexType.appendChild(serializeAnyAttribute(doc, 
anyAttribute, schema));
+        }
+        
 
             //process extension
         processExtensibilityComponents(complexTypeObj,serializedComplexType);

Modified: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/AnyTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/AnyTest.java?rev=718061&r1=718060&r2=718061&view=diff
==============================================================================
--- 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/AnyTest.java
 (original)
+++ 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/AnyTest.java
 Sun Nov 16 09:21:23 2008
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.ws.commons.schema.*;
+import org.xml.sax.InputSource;
 
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
@@ -87,6 +88,33 @@
         verifyAccuracy(ELEMENT_QNAME, schemaCol,5L,10L);
 
     }
+    
+    public void testAnyAttribute() throws Exception {
+        InputStream is = new 
FileInputStream(Resources.asURI("anyAttribute.xsd"));
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        schemaCol.read(new StreamSource(is), null);
+        
+        XmlSchema[] schemas = schemaCol.getXmlSchemas();
+        XmlSchema schema = null;
+        for(int x = 0; x < schemas.length; x ++) {
+               
if("http://soapinterop.org/types".equals(schemas[x].getTargetNamespace())) {
+                       schema = schemas[x];
+               }
+        }
+        
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        schema.write(baos);
+        baos.close();
+        byte[] bytes = baos.toByteArray();
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        schemaCol = new XmlSchemaCollection();
+        schemaCol.read(new InputSource(bais), null);
+        XmlSchemaType type = schemaCol.getTypeByQName(new 
QName("http://soapinterop.org/types";,
+                "OccuringStructWithAnyAttribute"));
+        XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
+        XmlSchemaAnyAttribute aa = complexType.getAnyAttribute();
+        assertNotNull(aa);
+    }
 
     
     public void testAnyZeroOccurs() throws Exception {

Added: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
URL: 
http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd?rev=718061&view=auto
==============================================================================
--- 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
 (added)
+++ 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
 Sun Nov 16 09:21:23 2008
@@ -0,0 +1,28 @@
+<!--
+               ~ Licensed to the Apache Software Foundation (ASF) under one ~ 
or more
+               contributor license agreements. See the NOTICE file ~ 
distributed with
+               this work for additional information ~ regarding copyright 
ownership.
+               The ASF licenses this file ~ to you under the Apache License, 
Version
+               2.0 (the ~ "License"); you may not use this file except in 
compliance
+               ~ with the License. You may obtain a copy of the License at ~ ~
+               http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required 
by
+               applicable law or agreed to in writing, ~ software distributed 
under
+               the License is distributed on an ~ "AS IS" BASIS, WITHOUT 
WARRANTIES
+               OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
+               License for the ~ specific language governing permissions and
+               limitations ~ under the License.
+       -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+       xmlns:tns="http://soapinterop.org/types"; 
targetNamespace="http://soapinterop.org/types";
+       attributeFormDefault="qualified">
+       <complexType name="OccuringStructWithAnyAttribute">
+               <sequence minOccurs="1" maxOccurs="5">
+                       <element name="varString" type="xsd:string" />
+                       <element name="varInt" type="xsd:int" />
+               </sequence>
+               <attribute name="AtString" type="xsd:string" />
+               <attribute name="AtInt" type="xsd:int" />
+               <anyAttribute processContents="skip" />
+       </complexType>
+</schema>
+  
\ No newline at end of file

Propchange: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/test-resources/anyAttribute.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to