xml-xmlbeans-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/drt/drtcases MarshalTests.java
Date Fri, 05 Dec 2003 23:48:22 GMT
zieg        2003/12/05 15:48:22

  Modified:    v2       build.xml
               v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BuiltinBindingLoader.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        BindingContextFactoryImpl.java
                        BindingContextImpl.java CharacterVisitor.java
                        MarshallerImpl.java RuntimeBindingTypeTable.java
                        RuntimeGlobalProperty.java RuntimeTypeFactory.java
                        UnmarshalContextImpl.java UnmarshallerImpl.java
               v2/test/cases/marshal doc.xml example_config.xml
               v2/test/src/drt/drtcases MarshalTests.java
  Added:       v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        DecimalTypeConverter.java IntegerTypeConverter.java
  Log:
  Add support for all numeric and string builtins
  Add a test for "as-if" type (still needs more testing)
  
  Revision  Changes    Path
  1.23      +4 -2      xml-xmlbeans/v2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/build.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- build.xml	4 Dec 2003 21:14:55 -0000	1.22
  +++ build.xml	5 Dec 2003 23:48:21 -0000	1.23
  @@ -1107,11 +1107,12 @@
       </target>
   
       <!-- temporary build utils ... zieg =============
  +
       <target name='binding-test' depends='declare-tasks, jam.classes'>
           <mkdir dir='build/private/classes/marshal'/>
           <java2schema
               srcdir='test/cases/marshal'
  -            includes='test/cases/marshal/com/mytest/*.java'
  +            includes='com/mytest/*.java'
               destdir='build/private/classes/marshal'>
           </java2schema>
       </target>
  @@ -1132,6 +1133,7 @@
               </classpath>
           </taskdef>
       </target>
  -   -->
  +
  +    -->
   
   </project>
  
  
  
  1.7       +4 -0      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BuiltinBindingLoader.java
  
  Index: BuiltinBindingLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BuiltinBindingLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BuiltinBindingLoader.java	5 Dec 2003 02:45:54 -0000	1.6
  +++ BuiltinBindingLoader.java	5 Dec 2003 23:48:21 -0000	1.7
  @@ -183,6 +183,10 @@
           addPojoJava("short", Short.class.getName());
           addPojoJava("byte", Byte.class.getName());
           addPojoJava("boolean", Boolean.class.getName());
  +        addPojoJava("unsignedInt", Long.class.getName());
  +        addPojoJava("unsignedShort", Integer.class.getName());
  +        addPojoJava("unsignedByte", Short.class.getName());
  +
           //TODO: deal with char and java.lang.Character
   
       }
  
  
  
  1.3       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BindingContextFactoryImpl.java
  
  Index: BindingContextFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BindingContextFactoryImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BindingContextFactoryImpl.java	15 Nov 2003 00:51:17 -0000	1.2
  +++ BindingContextFactoryImpl.java	5 Dec 2003 23:48:22 -0000	1.3
  @@ -77,7 +77,7 @@
   /**
    * creates BindingContext objects from various inputs.
    */
  -public class BindingContextFactoryImpl
  +public final class BindingContextFactoryImpl
       extends BindingContextFactory
   {
       public BindingContext createBindingContext()
  
  
  
  1.2       +1 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BindingContextImpl.java
  
  Index: BindingContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BindingContextImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BindingContextImpl.java	14 Nov 2003 00:40:29 -0000	1.1
  +++ BindingContextImpl.java	5 Dec 2003 23:48:22 -0000	1.2
  @@ -73,10 +73,9 @@
    * Main entry point into marshalling framework.
    * Use the BindingContextFactory to create one
    */
  -class BindingContextImpl
  +final class BindingContextImpl
       implements BindingContext
   {
  -
       private final BindingLoader bindingLoader;
       private final RuntimeBindingTypeTable typeTable;
   
  
  
  
  1.6       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CharacterVisitor.java
  
  Index: CharacterVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CharacterVisitor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CharacterVisitor.java	18 Nov 2003 23:52:30 -0000	1.5
  +++ CharacterVisitor.java	5 Dec 2003 23:48:22 -0000	1.6
  @@ -59,7 +59,7 @@
   import javax.xml.namespace.QName;
   import java.util.Collection;
   
  -class CharacterVisitor
  +final class CharacterVisitor
       extends XmlTypeVisitor
   {
       CharacterVisitor(RuntimeBindingProperty property,
  
  
  
  1.6       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java
  
  Index: MarshallerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MarshallerImpl.java	4 Dec 2003 21:14:56 -0000	1.5
  +++ MarshallerImpl.java	5 Dec 2003 23:48:22 -0000	1.6
  @@ -77,7 +77,7 @@
   /**
    * Entry point for marshalling java objects to xml.
    */
  -class MarshallerImpl
  +final class MarshallerImpl
       implements Marshaller
   {
       private final BindingLoader bindingLoader;
  
  
  
  1.8       +58 -40    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingTypeTable.java
  
  Index: RuntimeBindingTypeTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingTypeTable.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RuntimeBindingTypeTable.java	5 Dec 2003 02:45:54 -0000	1.7
  +++ RuntimeBindingTypeTable.java	5 Dec 2003 23:48:22 -0000	1.8
  @@ -175,46 +175,64 @@
   
       private void addBuiltins()
       {
  -        addXsdBuiltin("float", float.class.getName(),
  -                      new FloatTypeConverter());
  -        addXsdBuiltin("float", Float.class.getName(),
  -                      new FloatTypeConverter());
  -
  -        addXsdBuiltin("double", double.class.getName(),
  -                      new DoubleTypeConverter());
  -        addXsdBuiltin("double", Double.class.getName(),
  -                      new DoubleTypeConverter());
  -
  -        addXsdBuiltin("long", long.class.getName(),
  -                      new LongTypeConverter());
  -        addXsdBuiltin("long", Long.class.getName(),
  -                      new LongTypeConverter());
  -
  -        addXsdBuiltin("int", int.class.getName(),
  -                      new IntTypeConverter());
  -        addXsdBuiltin("int", Integer.class.getName(),
  -                      new IntTypeConverter());
  -
  -        addXsdBuiltin("short", short.class.getName(),
  -                      new ShortTypeConverter());
  -        addXsdBuiltin("short", Short.class.getName(),
  -                      new ShortTypeConverter());
  -
  -        addXsdBuiltin("byte", byte.class.getName(),
  -                      new ByteTypeConverter());
  -        addXsdBuiltin("byte", Byte.class.getName(),
  -                      new ByteTypeConverter());
  -
  -        addXsdBuiltin("boolean", boolean.class.getName(),
  -                      new BooleanTypeConverter());
  -        addXsdBuiltin("boolean", Boolean.class.getName(),
  -                      new BooleanTypeConverter());
  -
  -        addXsdBuiltin("string", String.class.getName(),
  -                      new StringTypeConverter());
  -
  -        addXsdBuiltin("token", String.class.getName(),
  -                      new StringTypeConverter());
  +        final FloatTypeConverter float_conv = new FloatTypeConverter();
  +        addXsdBuiltin("float", float.class.getName(), float_conv);
  +        addXsdBuiltin("float", Float.class.getName(), float_conv);
  +
  +        final DoubleTypeConverter double_conv = new DoubleTypeConverter();
  +        addXsdBuiltin("double", double.class.getName(), double_conv);
  +        addXsdBuiltin("double", Double.class.getName(), double_conv);
  +
  +        final IntegerTypeConverter integer_conv = new IntegerTypeConverter();
  +        final String bigint = java.math.BigInteger.class.getName();
  +        addXsdBuiltin("integer", bigint, integer_conv);
  +        addXsdBuiltin("nonPositiveInteger", bigint, integer_conv);
  +        addXsdBuiltin("negativeInteger", bigint, integer_conv);
  +        addXsdBuiltin("nonNegativeInteger", bigint, integer_conv);
  +        addXsdBuiltin("positiveInteger", bigint, integer_conv);
  +        addXsdBuiltin("unsignedLong", bigint, integer_conv);
  +
  +        addXsdBuiltin("decimal", java.math.BigDecimal.class.getName(),
  +                      new DecimalTypeConverter());
  +
  +        final LongTypeConverter long_conv = new LongTypeConverter();
  +        addXsdBuiltin("long", long.class.getName(), long_conv);
  +        addXsdBuiltin("long", Long.class.getName(), long_conv);
  +        addXsdBuiltin("unsignedInt", long.class.getName(), long_conv);
  +        addXsdBuiltin("unsignedInt", Long.class.getName(), long_conv);
  +
  +        final IntTypeConverter int_conv = new IntTypeConverter();
  +        addXsdBuiltin("int", int.class.getName(), int_conv);
  +        addXsdBuiltin("int", Integer.class.getName(), int_conv);
  +        addXsdBuiltin("unsignedShort", int.class.getName(), int_conv);
  +        addXsdBuiltin("unsignedShort", Integer.class.getName(), int_conv);
  +
  +        final ShortTypeConverter short_conv = new ShortTypeConverter();
  +        addXsdBuiltin("short", short.class.getName(), short_conv);
  +        addXsdBuiltin("short", Short.class.getName(), short_conv);
  +        addXsdBuiltin("unsignedByte", short.class.getName(), short_conv);
  +        addXsdBuiltin("unsignedByte", Short.class.getName(), short_conv);
  +
  +        final ByteTypeConverter byte_conv = new ByteTypeConverter();
  +        addXsdBuiltin("byte", byte.class.getName(), byte_conv);
  +        addXsdBuiltin("byte", Byte.class.getName(), byte_conv);
  +
  +        final BooleanTypeConverter boolean_conv = new BooleanTypeConverter();
  +        addXsdBuiltin("boolean", boolean.class.getName(), boolean_conv);
  +        addXsdBuiltin("boolean", Boolean.class.getName(), boolean_conv);
  +
  +        final StringTypeConverter string_conv = new StringTypeConverter();
  +        final String str = String.class.getName();
  +        addXsdBuiltin("string", str, string_conv);
  +        addXsdBuiltin("normalizedString", str, string_conv);
  +        addXsdBuiltin("token", str, string_conv);
  +        addXsdBuiltin("language", str, string_conv);
  +        addXsdBuiltin("Name", str, string_conv);
  +        addXsdBuiltin("NCName", str, string_conv);
  +        addXsdBuiltin("NMTOKEN", str, string_conv);
  +        addXsdBuiltin("ID", str, string_conv);
  +        addXsdBuiltin("IDREF", str, string_conv);
  +        addXsdBuiltin("ENTITY", str, string_conv);
       }
   
   
  
  
  
  1.6       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java
  
  Index: RuntimeGlobalProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RuntimeGlobalProperty.java	18 Nov 2003 23:52:30 -0000	1.5
  +++ RuntimeGlobalProperty.java	5 Dec 2003 23:48:22 -0000	1.6
  @@ -61,7 +61,7 @@
   
   import javax.xml.namespace.QName;
   
  -class RuntimeGlobalProperty
  +final class RuntimeGlobalProperty
       implements RuntimeBindingProperty
   {
       private final BindingType type;
  
  
  
  1.4       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeTypeFactory.java
  
  Index: RuntimeTypeFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeTypeFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RuntimeTypeFactory.java	14 Nov 2003 00:40:29 -0000	1.3
  +++ RuntimeTypeFactory.java	5 Dec 2003 23:48:22 -0000	1.4
  @@ -69,7 +69,7 @@
    * currently NOT thread safe (by design)
    */
   
  -class RuntimeTypeFactory
  +final class RuntimeTypeFactory
   {
       private final Map typeMap = new HashMap();
   
  
  
  
  1.5       +2 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalContextImpl.java
  
  Index: UnmarshalContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalContextImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnmarshalContextImpl.java	5 Dec 2003 02:45:54 -0000	1.4
  +++ UnmarshalContextImpl.java	5 Dec 2003 23:48:22 -0000	1.5
  @@ -171,7 +171,8 @@
           TypeUnmarshaller um =
               typeTable.getTypeUnmarshaller(binding_type);
           if (um == null) {
  -            String msg = "unable to locate unmarshaller for " + binding_type;
  +            String msg = "unable to locate unmarshaller for " +
  +                binding_type.getName();
               throw new XmlRuntimeException(msg);
           }
           return um;
  
  
  
  1.8       +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshallerImpl.java
  
  Index: UnmarshallerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshallerImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- UnmarshallerImpl.java	5 Dec 2003 02:45:54 -0000	1.7
  +++ UnmarshallerImpl.java	5 Dec 2003 23:48:22 -0000	1.8
  @@ -74,7 +74,7 @@
   /**
    * A Unmarshaller knows how to convert xml to java objects.
    */
  -class UnmarshallerImpl
  +final class UnmarshallerImpl
       implements Unmarshaller
   {
       private final BindingLoader bindingLoader;
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DecimalTypeConverter.java
  
  Index: DecimalTypeConverter.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2000-2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  
  package org.apache.xmlbeans.impl.marshal;
  
  import org.apache.xmlbeans.impl.common.XsTypeConverter;
  
  import java.math.BigDecimal;
  
  final class DecimalTypeConverter
      extends BaseSimpleTypeConverter
  {
      public Object unmarshal(UnmarshalContextImpl context)
      {
          BigDecimal val = context.getBigDecimalValue();
          assert context.isEndElement();
          context.next();
          return val;
      }
  
      public Object unmarshalAttribute(UnmarshalContextImpl context)
      {
          return context.getAttributeBigDecimalValue();
      }
  
      //non simple types can throw a runtime exception
      public CharSequence print(Object value, MarshalContextImpl context)
      {
          BigDecimal val = (BigDecimal)value;
          return XsTypeConverter.printDecimal(val);
      }
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntegerTypeConverter.java
  
  Index: IntegerTypeConverter.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2000-2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  
  package org.apache.xmlbeans.impl.marshal;
  
  import org.apache.xmlbeans.impl.common.XsTypeConverter;
  
  import java.math.BigInteger;
  
  final class IntegerTypeConverter
      extends BaseSimpleTypeConverter
  {
      public Object unmarshal(UnmarshalContextImpl context)
      {
          BigInteger val = context.getBigIntegerValue();
          assert context.isEndElement();
          context.next();
          return val;
      }
  
      public Object unmarshalAttribute(UnmarshalContextImpl context)
      {
          return context.getAttributeBigIntegerValue();
      }
  
      //non simple types can throw a runtime exception
      public CharSequence print(Object value, MarshalContextImpl context)
      {
          BigInteger val = (BigInteger)value;
          return XsTypeConverter.printInteger(val);
      }
  }
  
  
  
  1.5       +3 -8      xml-xmlbeans/v2/test/cases/marshal/doc.xml
  
  Index: doc.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/doc.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- doc.xml	14 Nov 2003 00:40:30 -0000	1.4
  +++ doc.xml	5 Dec 2003 23:48:22 -0000	1.5
  @@ -3,20 +3,15 @@
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:My="java:com.mytest" xsi:type="My:MyClass">
   
  -    <My:Myelt ignore="someval" My:Attrib="4444.123456789"  >
  +    <My:Myelt ignore="someval" My:Attrib="4444.123456789">
           <My:MyFloat>65.34</My:MyFloat>
           <My:MyClass>
               <My:Myatt xsi:type="xsd:token">inner-str</My:Myatt>
           </My:MyClass>
       </My:Myelt>
   
  -    <!--    not working-->
  -<!--        <My:Myatt xsi:nil="0" xsi:type="My:custom-string" >some string</My:Myatt>-->
  -
  -
  -    <My:Myatt xsi:type="xsd:token">strval</My:Myatt>
  -
  -
  +    <!--    test as-if for simple types-->
  +    <My:Myatt xsi:nil="0" xsi:type="My:custom-string">some string</My:Myatt>
   
   </My:load>
   
  
  
  
  1.10      +21 -4     xml-xmlbeans/v2/test/cases/marshal/example_config.xml
  
  Index: example_config.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/example_config.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- example_config.xml	2 Dec 2003 23:41:32 -0000	1.9
  +++ example_config.xml	5 Dec 2003 23:48:22 -0000	1.10
  @@ -1,7 +1,16 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<bin:binding-config xmlns:java="java:com.mytest" xmlns:bin="http://xml.apache.org/xmlbeans/binding-config">
  +<bin:binding-config xmlns:java="java:com.mytest"
  +    xmlns:bin="http://xml.apache.org/xmlbeans/binding-config"
  +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <bin:bindings>
  -    <bin:binding-type xsi:type="bin:by-name-bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  +
  +    <bin:binding-type xsi:type="bin:simple-type" >
  +        <bin:xmlcomponent>t=custom-string@java:com.mytest</bin:xmlcomponent>
  +        <bin:javatype>java.lang.String</bin:javatype>
  +        <bin:as-xml>t=string@http://www.w3.org/2001/XMLSchema</bin:as-xml>
  +    </bin:binding-type>
  +
  +    <bin:binding-type xsi:type="bin:by-name-bean" >
         <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.YourClass</bin:javatype>
         <bin:qname-property>
  @@ -63,7 +72,7 @@
           <bin:multiple>true</bin:multiple>
         </bin:qname-property>
       </bin:binding-type>
  -    <bin:binding-type xsi:type="bin:by-name-bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  +    <bin:binding-type xsi:type="bin:by-name-bean">
         <bin:xmlcomponent>t=MyClass@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.MyClass</bin:javatype>
         <bin:qname-property>
  @@ -82,12 +91,13 @@
           <bin:nillable>true</bin:nillable>
         </bin:qname-property>
       </bin:binding-type>
  -    <bin:binding-type xsi:type="bin:simple-document-binding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  +    <bin:binding-type xsi:type="bin:simple-document-binding">
         <bin:xmlcomponent>e=load@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.MyClass</bin:javatype>
         <bin:type-of-element>t=MyClass@java:com.mytest</bin:type-of-element>
       </bin:binding-type>
     </bin:bindings>
  +
     <bin:xml-to-pojo>
       <bin:mapping>
         <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
  @@ -101,7 +111,14 @@
         <bin:xmlcomponent>e=load@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.MyClass</bin:javatype>
       </bin:mapping>
  +
  +    <bin:mapping>
  +      <bin:xmlcomponent>t=custom-string@java:com.mytest</bin:xmlcomponent>
  +      <bin:javatype>java.lang.String</bin:javatype>
  +    </bin:mapping>
  +
     </bin:xml-to-pojo>
  +
     <bin:xml-to-xmlobj/>
     <bin:java-to-xml>
       <bin:mapping>
  
  
  
  1.16      +7 -1      xml-xmlbeans/v2/test/src/drt/drtcases/MarshalTests.java
  
  Index: MarshalTests.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/MarshalTests.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MarshalTests.java	2 Dec 2003 23:41:32 -0000	1.15
  +++ MarshalTests.java	5 Dec 2003 23:48:22 -0000	1.16
  @@ -34,6 +34,8 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.Random;
  +import java.math.BigInteger;
  +import java.math.BigDecimal;
   
   
   public class MarshalTests extends TestCase
  @@ -69,6 +71,8 @@
           testSimpleTypeUnmarshal(new Short((short)5543), "short");
           testSimpleTypeUnmarshal(new Integer(55434535), "int");
           testSimpleTypeUnmarshal(new Long(554345354445555555L), "long");
  +        testSimpleTypeUnmarshal(new BigInteger("55434535443332323245555555"), "integer");
  +        testSimpleTypeUnmarshal(new BigDecimal("43434343342.233434342"), "decimal");
           testSimpleTypeUnmarshal(new Float(54.5423f), "float");
           testSimpleTypeUnmarshal(new Double(23432.43234), "double");
           testSimpleTypeUnmarshal("random string", "string");
  @@ -83,6 +87,8 @@
           testSimpleTypeMarshal(new Short((short)5543), "short");
           testSimpleTypeMarshal(new Integer(55434535), "int");
           testSimpleTypeMarshal(new Long(554345354445555555L), "long");
  +        testSimpleTypeMarshal(new BigInteger("55434535443332323245555555"), "integer");
  +        testSimpleTypeMarshal(new BigDecimal("43434343342.233434342"), "decimal");
           testSimpleTypeMarshal(new Float(5555.5555f), "float");
           testSimpleTypeMarshal(new Double(1231.444), "double");
           testSimpleTypeMarshal("some text here", "string");
  @@ -107,7 +113,7 @@
   
           Assert.assertEquals(expected, obj);
   
  -        System.out.println("OK for " + expected);
  +//        System.out.println("OK for " + expected);
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message