xmlbeans-commits 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 Tue, 06 Apr 2004 00:53:10 GMT
zieg        2004/04/05 17:53:09

  Modified:    v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        AnyUriToStringTypeConverter.java
                        AttributeUnmarshaller.java
                        Base64BinaryTypeConverter.java
                        BooleanTypeConverter.java ByNameTypeVisitor.java
                        ByteTypeConverter.java DateTimeTypeConverter.java
                        DecimalTypeConverter.java DoubleTypeConverter.java
                        FloatTypeConverter.java HexBinaryTypeConverter.java
                        IntTypeConverter.java IntegerTypeConverter.java
                        JaxrpcEnumUnmarshaller.java LongTypeConverter.java
                        MarshalResult.java NullUnmarshaller.java
                        ObjectAnyTypeConverter.java QNameTypeConverter.java
                        RuntimeBindingProperty.java
                        RuntimeBindingTypeTable.java
                        RuntimeTypeFactory.java ShortTypeConverter.java
                        SimpleTypeVisitor.java StringTypeConverter.java
                        TypeUnmarshaller.java UnmarshalResult.java
                        WrappedArrayUnmarshaller.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal/util
                        ArrayUtils.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections
                        StringList.java
               v2/src/typeimpl/org/apache/xmlbeans/impl/util
                        XsTypeConverter.java
               v2/test/cases/marshal example_config.xml
               v2/test/cases/marshal/com/mytest YourClass.java
               v2/test/src/drt/drtcases MarshalTests.java
  Added:       v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        AnySimpleTypeConverter.java
                        AnyUriToUriTypeConverter.java
                        ListArrayConverter.java
                        ListArrayRuntimeBindingType.java
                        StringListArrayConverter.java
  Log:
  add support for simple list types (xs:list) and list based builtin types
  
  Revision  Changes    Path
  1.6       +7 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnyUriToStringTypeConverter.java
  
  Index: AnyUriToStringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnyUriToStringTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AnyUriToStringTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.5
  +++ AnyUriToStringTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.6
  @@ -35,6 +35,13 @@
           return context.getAttributeAnyUriValue();
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        return lexical_value.toString();
  +    }
  +
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
       {
  
  
  
  1.4       +9 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AttributeUnmarshaller.java
  
  Index: AttributeUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AttributeUnmarshaller.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttributeUnmarshaller.java	25 Mar 2004 03:19:28 -0000	1.3
  +++ AttributeUnmarshaller.java	6 Apr 2004 00:53:08 -0000	1.4
  @@ -18,6 +18,7 @@
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   
  +//TODO: rename this class
   abstract class AttributeUnmarshaller
       implements TypeUnmarshaller
   {
  @@ -49,6 +50,14 @@
       }
   
       public Object unmarshalAttribute(UnmarshalResult context)
  +    {
  +        throw new UnsupportedOperationException("not an attribute: " +
  +                                                type.getSchemaTypeName());
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
       {
           throw new UnsupportedOperationException("not an attribute: " +
                                                   type.getSchemaTypeName());
  
  
  
  1.6       +18 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/Base64BinaryTypeConverter.java
  
  Index: Base64BinaryTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/Base64BinaryTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Base64BinaryTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.5
  +++ Base64BinaryTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.6
  @@ -16,8 +16,11 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlException;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
  +import org.apache.xmlbeans.impl.util.Base64;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
  +import java.io.ByteArrayInputStream;
   import java.io.IOException;
   import java.io.InputStream;
   
  @@ -47,6 +50,21 @@
               throw new XmlException(e);
           }
       }
  +
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        byte[] buf = Base64.decode(lexical_value.toString().getBytes());
  +        if (buf != null)
  +            return new ByteArrayInputStream(buf);
  +        else
  +            throw new InvalidLexicalValueException("invalid base64Binary value",
  +                                                   result.getLocation());
  +
  +    }
  +
   
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
  
  
  
  1.8       +10 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BooleanTypeConverter.java
  
  Index: BooleanTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BooleanTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BooleanTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ BooleanTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -35,6 +35,16 @@
           return Boolean.valueOf(b);
       }
   
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        final boolean b = XsTypeConverter.lexBoolean(lexical_value);
  +        return Boolean.valueOf(b);
  +    }
  +
  +
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
       {
  
  
  
  1.22      +2 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameTypeVisitor.java
  
  Index: ByNameTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameTypeVisitor.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ByNameTypeVisitor.java	9 Mar 2004 23:50:53 -0000	1.21
  +++ ByNameTypeVisitor.java	6 Apr 2004 00:53:08 -0000	1.22
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.marshal.util.ArrayUtils;
   
   import javax.xml.namespace.QName;
   import java.util.ArrayList;
  @@ -110,7 +111,7 @@
               final Object parent = getParentObject();
               final Object prop_obj = property.isSet(parent, marshalResult) ?
                   property.getValue(parent, marshalResult) : null;
  -            final Iterator itr = MarshalResult.getCollectionIterator(prop_obj);
  +            final Iterator itr = ArrayUtils.getCollectionIterator(prop_obj);
               currMultipleIterator = itr;
               if (itr.hasNext()) {
                   currMultipleItem = itr.next();
  
  
  
  1.8       +14 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByteTypeConverter.java
  
  Index: ByteTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByteTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ByteTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ ByteTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class ByteTypeConverter
       extends BaseSimpleTypeConverter
  @@ -33,6 +34,19 @@
       {
           byte val = context.getAttributeByteValue();
           return new Byte(val);
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final byte b = XsTypeConverter.lexByte(lexical_value);
  +            return new Byte(b);
  +        }
  +        catch (NumberFormatException e) {
  +            throw new InvalidLexicalValueException(e, result.getLocation());
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.7       +9 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DateTimeTypeConverter.java
  
  Index: DateTimeTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DateTimeTypeConverter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DateTimeTypeConverter.java	3 Mar 2004 18:53:28 -0000	1.6
  +++ DateTimeTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.7
  @@ -37,6 +37,15 @@
           return context.getAttributeCalendarValue();
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        final XmlCalendar xml_cal =
  +            XsTypeConverter.lexDateTime(lexical_value);
  +        return xml_cal;
  +    }
  +
       public CharSequence print(Object value, MarshalResult result)
       {
           Calendar c = (Calendar)value;
  
  
  
  1.8       +14 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DecimalTypeConverter.java
  
  Index: DecimalTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DecimalTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DecimalTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ DecimalTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -16,6 +16,7 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlException;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import java.math.BigDecimal;
  @@ -33,6 +34,19 @@
       public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeBigDecimalValue();
  +    }
  +
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            return XsTypeConverter.lexDecimal(lexical_value);
  +        }
  +        catch (NumberFormatException ne) {
  +            throw new InvalidLexicalValueException(ne, result.getLocation());
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.8       +14 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DoubleTypeConverter.java
  
  Index: DoubleTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DoubleTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DoubleTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ DoubleTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class DoubleTypeConverter
       extends BaseSimpleTypeConverter
  @@ -31,6 +32,19 @@
       {
           double val = context.getAttributeDoubleValue();
           return new Double(val);
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final double f = XsTypeConverter.lexDouble(lexical_value);
  +            return new Double(f);
  +        }
  +        catch (NumberFormatException ne) {
  +            throw new InvalidLexicalValueException(ne, result.getLocation());
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.8       +14 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/FloatTypeConverter.java
  
  Index: FloatTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/FloatTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FloatTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ FloatTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class FloatTypeConverter
       extends BaseSimpleTypeConverter
  @@ -26,6 +27,19 @@
       {
           float val = context.getAttributeFloatValue();
           return new Float(val);
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final float f = XsTypeConverter.lexFloat(lexical_value);
  +            return new Float(f);
  +        }
  +        catch (NumberFormatException ne) {
  +            throw new InvalidLexicalValueException(ne, result.getLocation());
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.6       +16 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/HexBinaryTypeConverter.java
  
  Index: HexBinaryTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/HexBinaryTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HexBinaryTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.5
  +++ HexBinaryTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.6
  @@ -17,9 +17,12 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.util.HexBin;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   import java.io.IOException;
   import java.io.InputStream;
  +import java.io.ByteArrayInputStream;
   
   final class HexBinaryTypeConverter
       extends BaseSimpleTypeConverter
  @@ -44,6 +47,19 @@
           catch (IOException e) {
               throw new XmlException(e);
           }
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        byte[] buf = HexBin.decode(lexical_value.toString().getBytes());
  +        if (buf != null)
  +            return new ByteArrayInputStream(buf);
  +        else
  +            throw new InvalidLexicalValueException("invalid hexBinary value",
  +                                                   result.getLocation());
  +
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.8       +16 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntTypeConverter.java
  
  Index: IntTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- IntTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ IntTypeConverter.java	6 Apr 2004 00:53:08 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class IntTypeConverter
       extends BaseSimpleTypeConverter
  @@ -32,6 +33,21 @@
           int val = context.getAttributeIntValue();
           return new Integer(val);
       }
  +
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final int f = XsTypeConverter.lexInt(lexical_value);
  +            return new Integer(f);
  +        }
  +        catch (NumberFormatException ne) {
  +            throw new InvalidLexicalValueException(ne, result.getLocation());
  +        }
  +    }
  +
   
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
  
  
  
  1.8       +13 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntegerTypeConverter.java
  
  Index: IntegerTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntegerTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- IntegerTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ IntegerTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   import java.math.BigInteger;
   
  @@ -32,6 +33,18 @@
       public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeBigIntegerValue();
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            return XsTypeConverter.lexInteger(lexical_value);
  +        }
  +        catch (NumberFormatException ne) {
  +            throw new InvalidLexicalValueException(ne, result.getLocation());
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.3       +9 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/JaxrpcEnumUnmarshaller.java
  
  Index: JaxrpcEnumUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/JaxrpcEnumUnmarshaller.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JaxrpcEnumUnmarshaller.java	25 Mar 2004 03:19:28 -0000	1.2
  +++ JaxrpcEnumUnmarshaller.java	6 Apr 2004 00:53:09 -0000	1.3
  @@ -93,6 +93,15 @@
           return runtimeType.fromValue(itemValue);
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        final TypeUnmarshaller item_um = runtimeType.getItemUnmarshaller();
  +        final Object itemValue = item_um.unmarshalAttribute(lexical_value, result);
  +        return runtimeType.fromValue(itemValue);
  +    }
  +
       public void unmarshalAttribute(Object object, UnmarshalResult result)
           throws XmlException
       {
  
  
  
  1.8       +16 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/LongTypeConverter.java
  
  Index: LongTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/LongTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LongTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ LongTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class LongTypeConverter
       extends BaseSimpleTypeConverter
  @@ -32,6 +33,21 @@
           long val = context.getAttributeLongValue();
           return new Long(val);
       }
  +
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final long b = XsTypeConverter.lexLong(lexical_value);
  +            return new Long(b);
  +        }
  +        catch (NumberFormatException e) {
  +            throw new InvalidLexicalValueException(e, result.getLocation());
  +        }
  +    }
  +
   
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
  
  
  
  1.22      +7 -19     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java
  
  Index: MarshalResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- MarshalResult.java	25 Mar 2004 22:00:29 -0000	1.21
  +++ MarshalResult.java	6 Apr 2004 00:53:09 -0000	1.22
  @@ -151,7 +151,8 @@
           do {
               prefix = NSPREFIX + (++prefixCnt);
               testuri = namespaceContext.getNamespaceURI(prefix);
  -        } while (testuri != null);
  +        }
  +        while (testuri != null);
           assert prefix != null;
           namespaceContext.bindNamespace(prefix, uri);
           return prefix;
  @@ -527,22 +528,6 @@
           throw new IllegalStateException();
       }
   
  -    static Iterator getCollectionIterator(Object value)
  -    {
  -        //TODO & FIXME: refactor this into seperate classes
  -        if (value == null) {
  -            return EmptyIterator.getInstance();
  -        } else if (value instanceof Collection) {
  -            return ((Collection)value).iterator();
  -        } else if (value instanceof Object[]) {
  -            return new ArrayIterator((Object[])value);
  -        } else if (value.getClass().isArray()) {
  -            return new ReflectiveArrayIterator(value);
  -        } else {
  -            throw new AssertionError("bad type: " + value.getClass());
  -        }
  -    }
  -
       private void initAttributes()
       {
           if (!initedAttributes) {
  @@ -605,7 +590,7 @@
   
           BindingType btype = expected_type.getBindingType();
           //TODO: improve this method by going up the type hierarchy
  -        //also avoid duplicate work with going on in this next call.
  +        //also avoid duplicate work going on in this next call.
           return result.createRuntimeBindingType(btype, property_value);
       }
   
  @@ -716,8 +701,11 @@
           }
   
           public void visit(ListArrayType listArrayType)
  +            throws XmlException
           {
  -            // todo: implement
  +            xmlTypeVisitor = new SimpleTypeVisitor(runtimeBindingProperty,
  +                                                   parentObject,
  +                                                   marshalResult);
           }
   
       }
  
  
  
  1.9       +8 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NullUnmarshaller.java
  
  Index: NullUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NullUnmarshaller.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NullUnmarshaller.java	25 Mar 2004 03:19:28 -0000	1.8
  +++ NullUnmarshaller.java	6 Apr 2004 00:53:09 -0000	1.9
  @@ -46,7 +46,14 @@
   
       public Object unmarshalAttribute(UnmarshalResult context)
       {
  -        throw new UnsupportedOperationException();
  +        throw new UnsupportedOperationException("not supported: this=" + this);
  +    }
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        throw new UnsupportedOperationException("not supported: this=" + this);
       }
   
       public void unmarshalAttribute(Object object, UnmarshalResult result)
  
  
  
  1.3       +7 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ObjectAnyTypeConverter.java
  
  Index: ObjectAnyTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ObjectAnyTypeConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ObjectAnyTypeConverter.java	25 Mar 2004 03:19:28 -0000	1.2
  +++ ObjectAnyTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.3
  @@ -85,6 +85,13 @@
           throw new AssertionError("unused");
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        throw new AssertionError("unused");
  +    }
  +
       public void unmarshalAttribute(Object object, UnmarshalResult result)
           throws XmlException
       {
  
  
  
  1.7       +8 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/QNameTypeConverter.java
  
  Index: QNameTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/QNameTypeConverter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- QNameTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.6
  +++ QNameTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.7
  @@ -35,6 +35,14 @@
           return context.getAttributeQNameValue();
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        return XsTypeConverter.lexQName(lexical_value,
  +                                        result.getNamespaceContext());
  +    }
  +
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
       {
  
  
  
  1.18      +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java
  
  Index: RuntimeBindingProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- RuntimeBindingProperty.java	25 Mar 2004 03:19:28 -0000	1.17
  +++ RuntimeBindingProperty.java	6 Apr 2004 00:53:09 -0000	1.18
  @@ -89,7 +89,7 @@
       abstract QName getName();
   
       //non simple type props can throw an exception
  -    abstract CharSequence getLexical(Object parent, MarshalResult result)
  +    abstract CharSequence getLexical(Object value, MarshalResult result)
           throws XmlException;
   
       abstract Object getValue(Object parentObject, MarshalResult result)
  
  
  
  1.24      +29 -3     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- RuntimeBindingTypeTable.java	25 Mar 2004 22:00:29 -0000	1.23
  +++ RuntimeBindingTypeTable.java	6 Apr 2004 00:53:09 -0000	1.24
  @@ -102,7 +102,9 @@
           return type_um;
       }
   
  -    private TypeUnmarshaller createTypeUnmarshallerInternal(BindingType type, BindingLoader loader) throws XmlException
  +    private TypeUnmarshaller createTypeUnmarshallerInternal(BindingType type,
  +                                                            BindingLoader loader)
  +        throws XmlException
       {
           TypeVisitor type_visitor =
               new TypeVisitor(this, loader, runtimeTypeFactory);
  @@ -110,7 +112,8 @@
           return type_visitor.getUnmarshaller();
       }
   
  -    RuntimeTypeFactory getRuntimeTypeFactory() {
  +    RuntimeTypeFactory getRuntimeTypeFactory()
  +    {
           return runtimeTypeFactory;
       }
   
  @@ -234,8 +237,13 @@
           addXsdBuiltin("boolean", boolean.class, boolean_conv);
           addXsdBuiltin("boolean", Boolean.class, boolean_conv);
   
  +        addXsdBuiltin("anyURI",
  +                      java.net.URI.class,
  +                      new AnyUriToUriTypeConverter());
  +
           final StringTypeConverter string_conv = new StringTypeConverter();
           final Class str = String.class;
  +        addXsdBuiltin("anySimpleType", str, new AnySimpleTypeConverter());
           addXsdBuiltin("string", str, string_conv);
           addXsdBuiltin("normalizedString", str, string_conv);
           addXsdBuiltin("token", str, string_conv);
  @@ -251,6 +259,14 @@
                         str,
                         new AnyUriToStringTypeConverter());
   
  +        final Class str_array = (new String[0]).getClass();
  +        addXsdBuiltin("ENTITIES", str_array,
  +                      new StringListArrayConverter());
  +        addXsdBuiltin("IDREFS", str_array,
  +                      new StringListArrayConverter());
  +        addXsdBuiltin("NMTOKENS", str_array,
  +                      new StringListArrayConverter());
  +
           addXsdBuiltin("dateTime",
                         Calendar.class,
                         new DateTimeTypeConverter());
  @@ -269,6 +285,7 @@
           addXsdBuiltin("hexBinary",
                         byte_array_jname,
                         new HexBinaryTypeConverter());
  +
       }
   
       private static TypeUnmarshaller createSimpleTypeUnmarshaller(SimpleBindingType stype,
  @@ -416,6 +433,11 @@
               final JaxrpcEnumRuntimeBindingType rtt =
                   runtimeTypeFactory.createRuntimeType(enum_type, this, loader);
               m = new JaxrpcEnumMarsahller(rtt);
  +        } else if (binding_type instanceof ListArrayType) {
  +            ListArrayType la_type = (ListArrayType)binding_type;
  +            final ListArrayRuntimeBindingType rtt =
  +                runtimeTypeFactory.createRuntimeType(la_type, this, loader);
  +            m = new ListArrayConverter(rtt);
           }
   
           if (m != null)
  @@ -512,7 +534,11 @@
           public void visit(ListArrayType listArrayType)
               throws XmlException
           {
  -            // todo: implement
  +            ListArrayRuntimeBindingType rtt =
  +                runtimeTypeFactory.createRuntimeType(listArrayType,
  +                                                     runtimeBindingTypeTable,
  +                                                     loader);
  +            typeUnmarshaller = new ListArrayConverter(rtt);
           }
   
           public TypeUnmarshaller getUnmarshaller()
  
  
  
  1.15      +11 -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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RuntimeTypeFactory.java	25 Mar 2004 22:00:29 -0000	1.14
  +++ RuntimeTypeFactory.java	6 Apr 2004 00:53:09 -0000	1.15
  @@ -90,6 +90,16 @@
           return (WrappedArrayRuntimeBindingType)rtt;
       }
   
  +    public ListArrayRuntimeBindingType createRuntimeType(ListArrayType type,
  +                                                         RuntimeBindingTypeTable type_table,
  +                                                         BindingLoader binding_loader)
  +        throws XmlException
  +    {
  +        final RuntimeBindingType rtt =
  +            createRuntimeTypeInternal(type, type_table, binding_loader);
  +        return (ListArrayRuntimeBindingType)rtt;
  +    }
  +
       public BuiltinRuntimeBindingType createRuntimeType(BuiltinBindingType type,
                                                          RuntimeBindingTypeTable type_table,
                                                          BindingLoader binding_loader)
  @@ -214,7 +224,7 @@
           public void visit(ListArrayType listArrayType)
               throws XmlException
           {
  -            // todo: Implement
  +            runtimeBindingType = new ListArrayRuntimeBindingType(listArrayType);
           }
   
       }
  
  
  
  1.8       +16 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ShortTypeConverter.java
  
  Index: ShortTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ShortTypeConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ShortTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.7
  +++ ShortTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   final class ShortTypeConverter
       extends BaseSimpleTypeConverter
  @@ -32,6 +33,21 @@
           short val = context.getAttributeShortValue();
           return new Short(val);
       }
  +
  +
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        try {
  +            final short b = XsTypeConverter.lexShort(lexical_value);
  +            return new Short(b);
  +        }
  +        catch (NumberFormatException e) {
  +            throw new InvalidLexicalValueException(e, result.getLocation());
  +        }
  +    }
  +
   
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
  
  
  
  1.15      +2 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SimpleTypeVisitor.java
  
  Index: SimpleTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SimpleTypeVisitor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SimpleTypeVisitor.java	9 Mar 2004 23:50:53 -0000	1.14
  +++ SimpleTypeVisitor.java	6 Apr 2004 00:53:09 -0000	1.15
  @@ -26,7 +26,8 @@
       private QName attributeName;
       private String xsiTypeAttVal;
   
  -    public SimpleTypeVisitor(RuntimeBindingProperty property, Object obj,
  +    public SimpleTypeVisitor(RuntimeBindingProperty property,
  +                             Object obj,
                                MarshalResult result)
           throws XmlException
       {
  
  
  
  1.9       +7 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/StringTypeConverter.java
  
  Index: StringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/StringTypeConverter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StringTypeConverter.java	12 Feb 2004 20:06:16 -0000	1.8
  +++ StringTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.9
  @@ -31,6 +31,13 @@
           return context.getAttributeStringValue();
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        return XsTypeConverter.lexString(lexical_value);
  +    }
  +
       //non simple types can throw a runtime exception
       public CharSequence print(Object value, MarshalResult result)
       {
  
  
  
  1.11      +16 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/TypeUnmarshaller.java
  
  Index: TypeUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/TypeUnmarshaller.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TypeUnmarshaller.java	25 Mar 2004 03:19:28 -0000	1.10
  +++ TypeUnmarshaller.java	6 Apr 2004 00:53:09 -0000	1.11
  @@ -69,6 +69,22 @@
           throws XmlException;
   
       /**
  +     * unmarshal the lexical value of an instance of xsd:anySimpleType.
  +     * This could be called on an attribute value or on element content.
  +     *
  +     * @param lexical_value  value to be unmarshalled
  +     * @param result
  +     * @return Object representing java value of lexical
  +     *
  +     * @exception UnsupportedOperationException if the
  +     *            <tt>unmarshalSimpleType</tt> operation is not supported
  +     *            by this TypeUnmarshaller.
  +     */
  +    Object unmarshalAttribute(CharSequence lexical_value,
  +                              UnmarshalResult result)
  +        throws XmlException;
  +
  +    /**
        * unmarshal the lexical value of an instance of xsd:anySimpleType into an
        * existing object.  This could be called on an attribute value
        * or on element content.
  
  
  
  1.15      +28 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalResult.java
  
  Index: UnmarshalResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalResult.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- UnmarshalResult.java	29 Mar 2004 07:02:48 -0000	1.14
  +++ UnmarshalResult.java	6 Apr 2004 00:53:09 -0000	1.15
  @@ -34,6 +34,7 @@
   import org.apache.xmlbeans.impl.validator.ValidatingXMLStreamReader;
   
   import javax.xml.namespace.QName;
  +import javax.xml.namespace.NamespaceContext;
   import javax.xml.stream.Location;
   import javax.xml.stream.XMLStreamException;
   import javax.xml.stream.XMLStreamReader;
  @@ -152,6 +153,10 @@
                                       "<unknown>");
       }
   
  +    Collection getErrors()
  +    {
  +        return errors;
  +    }
   
       Object unmarshalDocument(XMLStreamReader reader)
           throws XmlException
  @@ -323,6 +328,12 @@
   
       // ======================= xml access methods =======================
   
  +
  +    Location getLocation()
  +    {
  +        return baseReader.getLocation();
  +    }
  +
       String getStringValue() throws XmlException
       {
           try {
  @@ -524,6 +535,18 @@
           }
       }
   
  +    String getAttributeStringValue(int whitespace_style)
  +        throws XmlException
  +    {
  +        try {
  +            return baseReader.getAttributeStringValue(currentAttributeIndex,
  +                                                      whitespace_style);
  +        }
  +        catch (XMLStreamException e) {
  +            throw new XmlException(e);
  +        }
  +    }
  +
       boolean getAttributeBooleanValue() throws XmlException
       {
           try {
  @@ -934,6 +957,11 @@
               return NullUnmarshaller.getInstance();
   
           return base;
  +    }
  +
  +    NamespaceContext getNamespaceContext()
  +    {
  +        return baseReader.getNamespaceContext();
       }
   
   }
  
  
  
  1.4       +8 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/WrappedArrayUnmarshaller.java
  
  Index: WrappedArrayUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/WrappedArrayUnmarshaller.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WrappedArrayUnmarshaller.java	25 Mar 2004 03:19:28 -0000	1.3
  +++ WrappedArrayUnmarshaller.java	6 Apr 2004 00:53:09 -0000	1.4
  @@ -131,6 +131,14 @@
           throw new AssertionError("not used");
       }
   
  +    public Object unmarshalAttribute(CharSequence lexical_value,
  +                                     UnmarshalResult result)
  +        throws XmlException
  +    {
  +        throw new AssertionError("not used");
  +    }
  +
  +    
       public void unmarshalAttribute(Object object, UnmarshalResult result)
           throws XmlException
       {
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnySimpleTypeConverter.java
  
  Index: AnySimpleTypeConverter.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed 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.
   */
  
  package org.apache.xmlbeans.impl.marshal;
  
  import org.apache.xmlbeans.XmlException;
  import org.apache.xmlbeans.impl.util.XsTypeConverter;
  
  final class AnySimpleTypeConverter
      extends BaseSimpleTypeConverter
  {
      protected Object getObject(UnmarshalResult context)
          throws XmlException
      {
          return context.getStringValue();
      }
  
      public Object unmarshalAttribute(UnmarshalResult context)
          throws XmlException
      {
          return context.getAttributeStringValue();
      }
  
      public Object unmarshalAttribute(CharSequence lexical_value,
                                       UnmarshalResult result)
          throws XmlException
      {
          return XsTypeConverter.lexString(lexical_value, result.getErrors());
      }
  
      //non simple types can throw a runtime exception
      public CharSequence print(Object value, MarshalResult result)
      {
          String val = (String)value;
          return XsTypeConverter.printString(val);
      }
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnyUriToUriTypeConverter.java
  
  Index: AnyUriToUriTypeConverter.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed 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.
   */
  
  package org.apache.xmlbeans.impl.marshal;
  
  import org.apache.xmlbeans.XmlException;
  import org.apache.xmlbeans.impl.util.XsTypeConverter;
  import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
  
  import java.net.URI;
  import java.net.URISyntaxException;
  
  
  final class AnyUriToUriTypeConverter
      extends BaseSimpleTypeConverter
  {
  
      protected Object getObject(UnmarshalResult context)
          throws XmlException
      {
          final String uri_val = context.getAnyUriValue();
          return stringToUri(uri_val, context);
      }
  
      public Object unmarshalAttribute(UnmarshalResult context)
          throws XmlException
      {
          final String uri_val = context.getAttributeAnyUriValue();
          return stringToUri(uri_val, context);
      }
  
      public Object unmarshalAttribute(CharSequence lexical_value,
                                       UnmarshalResult result)
          throws XmlException
      {
          return stringToUri(lexical_value.toString(), result);
      }
  
      //non simple types can throw a runtime exception
      public CharSequence print(Object value, MarshalResult result)
      {
          URI val = (URI)value;
          return XsTypeConverter.printString(val.toString());
      }
  
      private static Object stringToUri(final String uri_val,
                                        UnmarshalResult context)
      {
          try {
              return new URI(uri_val);
          }
          catch (URISyntaxException e) {
              throw new InvalidLexicalValueException(e, context.getLocation());
          }
      }
  
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ListArrayConverter.java
  
  Index: ListArrayConverter.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.XmlException;
  import org.apache.xmlbeans.impl.marshal.util.ArrayUtils;
  import org.apache.xmlbeans.impl.marshal.util.collections.Accumulator;
  import org.apache.xmlbeans.impl.marshal.util.collections.AccumulatorFactory;
  import org.apache.xmlbeans.impl.values.XmlListImpl;
  
  import java.util.Iterator;
  
  //TODO: optimize list processing to use CharSequence and avoid extra String objects
  
  
  final class ListArrayConverter
      extends BaseSimpleTypeConverter
  {
      private final ListArrayRuntimeBindingType listType;
  
      private static final char SPACE = ' ';
  
  
      ListArrayConverter(ListArrayRuntimeBindingType rtt)
      {
          listType = rtt;
      }
  
  
      protected Object getObject(UnmarshalResult context)
          throws XmlException
      {
          final String str = context.getStringValue();
  
          return getObjectFromListContent(str, context);
      }
  
  
      public Object unmarshalAttribute(UnmarshalResult result)
          throws XmlException
      {
          final String str = result.getAttributeStringValue();
          return getObjectFromListContent(str, result);
      }
  
      public Object unmarshalAttribute(CharSequence lexical_value,
                                       UnmarshalResult result)
          throws XmlException
      {
          return getObjectFromListContent(lexical_value.toString(), result
          );
      }
  
      //non simple types can throw a runtime exception
      public CharSequence print(Object value, MarshalResult result)
          throws XmlException
      {
          final Iterator itr = ArrayUtils.getCollectionIterator(value);
          if (!itr.hasNext()) return "";
  
  
          final RuntimeBindingProperty item_prop = listType.getItemProperty();
          StringBuffer buf = new StringBuffer();
  
          final Object first = itr.next();
          if (first != null) {
              final CharSequence lex = item_prop.getLexical(first, result);
              buf.append(lex);
          }
  
          while (itr.hasNext()) {
              final Object item = itr.next();
              if (item == null) continue;
              final CharSequence lex = item_prop.getLexical(item, result);
              buf.append(SPACE);
              buf.append(lex);
          }
          return buf;
      }
  
      protected Object getObjectFromListContent(final String str,
                                                UnmarshalResult context)
          throws XmlException
      {
          final RuntimeBindingProperty item_prop = listType.getItemProperty();
  
          final Class list_java_type = listType.getJavaType();
          final Class item_java_type = item_prop.getRuntimeBindingType().getJavaType();
  
          final TypeUnmarshaller item_um = item_prop.getTypeUnmarshaller(context);
  
          return unmarshalListString(str, list_java_type, item_java_type,
                                     item_um, context);
  
      }
  
      protected static Object unmarshalListString(final CharSequence str,
                                                  final Class list_java_type,
                                                  final Class item_java_type,
                                                  final TypeUnmarshaller item_um,
                                                  final UnmarshalResult context)
          throws XmlException
      {
          final Accumulator accum =
              AccumulatorFactory.createAccumulator(list_java_type,
                                                   item_java_type);
  
          return unmarshalListString(accum, str, item_um, context);
      }
  
      protected static Object unmarshalListString(final Accumulator accum,
                                                  final CharSequence str,
                                                  final TypeUnmarshaller item_um,
                                                  final UnmarshalResult context)
          throws XmlException
      {
          final String lex = str.toString();//TODO: avoid this call
          final String[] strings = XmlListImpl.split_list(lex);
          for (int i = 0, alen = strings.length; i < alen; i++) {
              final String s = strings[i];
              final Object val = item_um.unmarshalAttribute(s, context);
              accum.append(val);
          }
          return accum.getFinalArray();
      }
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ListArrayRuntimeBindingType.java
  
  Index: ListArrayRuntimeBindingType.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.XmlException;
  import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  import org.apache.xmlbeans.impl.binding.bts.BindingType;
  import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  import org.apache.xmlbeans.impl.binding.bts.ListArrayType;
  import org.apache.xmlbeans.impl.marshal.util.collections.Accumulator;
  
  import javax.xml.namespace.QName;
  import java.lang.reflect.Array;
  
  final class ListArrayRuntimeBindingType
      extends RuntimeBindingType
  {
      private final ListArrayType listArrayType;
  
      private LAProperty itemProperty;
  
      ListArrayRuntimeBindingType(ListArrayType binding_type)
          throws XmlException
      {
          super(binding_type);
          listArrayType = binding_type;
      }
  
      void initialize(RuntimeBindingTypeTable typeTable,
                      BindingLoader bindingLoader,
                      RuntimeTypeFactory rttFactory)
          throws XmlException
      {
          final BindingTypeName item_type_name = listArrayType.getItemType();
          assert item_type_name != null;
  
          final BindingType item_type = bindingLoader.getBindingType(item_type_name);
          if (item_type == null) {
              final String msg = "unable to lookup " + item_type_name +
                  " from type " + listArrayType;
              throw new XmlException(msg);
          }
  
          final RuntimeBindingType item_rtt =
              rttFactory.createRuntimeType(item_type, typeTable, bindingLoader);
  
          itemProperty = new LAProperty(this, item_rtt, typeTable, bindingLoader);
      }
  
  
      RuntimeBindingProperty getItemProperty() {
          assert itemProperty != null;
          return itemProperty;
      }
  
      private static final class LAProperty
          extends RuntimeBindingProperty
      {
          private final RuntimeBindingType itemType;
          private final TypeMarshaller marshaller; // used only for simple types
          private final TypeUnmarshaller unmarshaller;
  
          LAProperty(RuntimeBindingType containing_type,
                     RuntimeBindingType item_type,
                     RuntimeBindingTypeTable type_table,
                     BindingLoader loader)
              throws XmlException
          {
              super(containing_type);
  
              itemType = item_type;
  
              final BindingType binding_type = item_type.getBindingType();
              marshaller =
                  type_table.lookupMarshaller(binding_type, loader);
              unmarshaller =
                  type_table.lookupUnmarshaller(binding_type, loader);
  
          }
  
          Class getItemClass()
          {
              return itemType.getJavaType();
          }
  
          RuntimeBindingType getRuntimeBindingType()
          {
              return itemType;
          }
  
          RuntimeBindingType getActualRuntimeType(Object property_value,
                                                  MarshalResult result)
              throws XmlException
          {
              return MarshalResult.findActualRuntimeType(property_value,
                                                         itemType,
                                                         result);
          }
  
          QName getName()
          {
              throw new UnsupportedOperationException("no name");
          }
  
          public TypeUnmarshaller getTypeUnmarshaller(UnmarshalResult context)
              throws XmlException
          {
              return context.determineTypeUnmarshaller(unmarshaller);
          }
  
          public void fill(Object inter, Object prop_obj)
              throws XmlException
          {
              Accumulator acc = (Accumulator)inter;
              acc.append(prop_obj);
          }
  
          //non simple type props can throw some runtime exception.
          CharSequence getLexical(Object value, MarshalResult result)
              throws XmlException
          {
              assert value != null;
              assert  result != null;
              assert marshaller != null;
  
              return marshaller.print(value, result);
          }
  
          Object getValue(Object parentObject, MarshalResult result)
              throws XmlException
          {
              return Array.get(parentObject, result.getCurrIndex());
          }
  
          boolean isSet(Object parentObject, MarshalResult result)
              throws XmlException
          {
              throw new AssertionError("UNIMP: TODO: FIXME");
              //if (itemType.isJavaPrimitive()) return true;
  
              //TODO: consider isSet for array elements?
  
              //return getValue(parentObject, result) != null;
          }
  
          boolean isMultiple()
          {
              return true;
          }
  
          boolean isNillable()
          {
              return false;
          }
  
          String getLexicalDefault()
          {
              return null;
          }
  
      }
  }
  
  
  
  1.1                  xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/StringListArrayConverter.java
  
  Index: StringListArrayConverter.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed 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.
   */
  
  package org.apache.xmlbeans.impl.marshal;
  
  import org.apache.xmlbeans.XmlException;
  import org.apache.xmlbeans.impl.marshal.util.collections.StringList;
  
  final class StringListArrayConverter
      extends BaseSimpleTypeConverter
  {
      private static final Class STR_ARRAY_TYPE = (new String[0]).getClass();
  
      private static final char SPACE = ' ';
  
      //could get more clever here but probably not worth the trouble.
      private static final TypeUnmarshaller STR_UNMARSHALLER =
          new StringTypeConverter();
  
  
      protected Object getObject(UnmarshalResult context) throws XmlException
      {
          //TODO: process based on CharSequence...
          final String str = context.getStringValue();
  
          return ListArrayConverter.unmarshalListString(new StringList(),
                                                        str,
                                                        STR_UNMARSHALLER,
                                                        context);
      }
  
      public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
      {
          final String str = context.getAttributeStringValue();
  
          return ListArrayConverter.unmarshalListString(new StringList(),
                                                        str,
                                                        STR_UNMARSHALLER,
                                                        context);
  
      }
  
      public Object unmarshalAttribute(CharSequence lexical_value,
                                       UnmarshalResult result)
          throws XmlException
      {
  
          return ListArrayConverter.unmarshalListString(new StringList(),
                                                        lexical_value.toString(),
                                                        STR_UNMARSHALLER,
                                                        result);
      }
  
      public CharSequence print(Object value, MarshalResult result)
      {
          String[] val = (String[])value;
          final int alen = val.length;
  
          if (alen == 0) return "";
  
          StringBuffer buf = new StringBuffer();
          buf.append(val[0]);
  
          for (int i = 1; i < alen; i++) {
              buf.append(SPACE);
              buf.append(val[i]);
          }
  
          return buf;
      }
  }
  
  
  
  1.5       +22 -0     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/ArrayUtils.java
  
  Index: ArrayUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/ArrayUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArrayUtils.java	25 Mar 2004 03:19:28 -0000	1.4
  +++ ArrayUtils.java	6 Apr 2004 00:53:09 -0000	1.5
  @@ -15,7 +15,13 @@
   
   package org.apache.xmlbeans.impl.marshal.util;
   
  +import org.apache.xmlbeans.impl.marshal.util.collections.EmptyIterator;
  +import org.apache.xmlbeans.impl.marshal.util.collections.ArrayIterator;
  +import org.apache.xmlbeans.impl.marshal.util.collections.ReflectiveArrayIterator;
  +
   import java.lang.reflect.Array;
  +import java.util.Iterator;
  +import java.util.Collection;
   
   public final class ArrayUtils
   {
  @@ -89,6 +95,22 @@
   
           System.out.println("ok");
   
  +    }
  +
  +    public static Iterator getCollectionIterator(Object value)
  +    {
  +        //TODO & FIXME: refactor this into seperate classes
  +        if (value == null) {
  +            return EmptyIterator.getInstance();
  +        } else if (value instanceof Collection) {
  +            return ((Collection)value).iterator();
  +        } else if (value instanceof Object[]) {
  +            return new ArrayIterator((Object[])value);
  +        } else if (value.getClass().isArray()) {
  +            return new ReflectiveArrayIterator(value);
  +        } else {
  +            throw new AssertionError("bad type: " + value.getClass());
  +        }
       }
   
   }
  
  
  
  1.5       +0 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StringList.java
  
  Index: StringList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StringList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StringList.java	2 Mar 2004 04:23:25 -0000	1.4
  +++ StringList.java	6 Apr 2004 00:53:09 -0000	1.5
  @@ -61,7 +61,6 @@
       {
           String[] new_a = new String[size];
           System.arraycopy(store, 0, new_a, 0, size);
  -        //if (DEBUG) Debug.say("getMinSizedArray size="+size);
           return new_a;
       }
   
  
  
  
  1.6       +8 -1      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/util/XsTypeConverter.java
  
  Index: XsTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/util/XsTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XsTypeConverter.java	21 Mar 2004 01:58:27 -0000	1.5
  +++ XsTypeConverter.java	6 Apr 2004 00:53:09 -0000	1.6
  @@ -348,7 +348,7 @@
   
           //reaching here means an invalid boolean lexical
           String msg = "invalid boolean: " + v;
  -        throw new IllegalArgumentException(msg);
  +        throw new InvalidLexicalValueException(msg);
       }
   
       public static boolean lexBoolean(CharSequence value, Collection errors)
  @@ -378,6 +378,12 @@
           return v;
       }
   
  +
  +    public static String lexString(CharSequence lexical_value)
  +    {
  +        return lexical_value.toString();
  +    }
  +
       public static String printString(String value)
       {
           return value;
  @@ -661,4 +667,5 @@
   
           return sign*result;
       }
  +
   }
  
  
  
  1.27      +46 -0     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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- example_config.xml	25 Mar 2004 03:19:28 -0000	1.26
  +++ example_config.xml	6 Apr 2004 00:53:09 -0000	1.27
  @@ -264,10 +264,55 @@
               </bin:qname-property>
   
   
  +            <bin:qname-property>
  +                <bin:xmlcomponent>t=SimpleStringList@java:com.mytest</bin:xmlcomponent>
  +                <bin:javatype>java.lang.String[]</bin:javatype>
  +                <bin:getter>
  +                    <bin:method-name>getSimpleStringArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                    <bin:method-name>setSimpleStringArray</bin:method-name>
  +                    <bin:param-type>java.lang.String[]</bin:param-type>
  +                </bin:setter>
  +                <bin:qname>java:simpleStringArray</bin:qname>
  +            </bin:qname-property>
  +
  +            <bin:qname-property>
  +                <bin:xmlcomponent>t=SimpleLongList@java:com.mytest</bin:xmlcomponent>
  +                <bin:javatype>long[]</bin:javatype>
  +                <bin:getter>
  +                    <bin:method-name>getSimpleLongArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                    <bin:method-name>setSimpleLongArray</bin:method-name>
  +                    <bin:param-type>long[]</bin:param-type>
  +                </bin:setter>
  +                <bin:qname>java:simpleLongArray</bin:qname>
  +            </bin:qname-property>
  +
  +
   
           </bin:binding-type>
   
   
  +        <bin:binding-type xsi:type="bin:list-array">
  +            <bin:xmlcomponent>t=SimpleStringList@java:com.mytest</bin:xmlcomponent>
  +            <bin:javatype>java.lang.String[]</bin:javatype>
  +            <bin:item-type>
  +                <bin:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
  +                <bin:javatype>java.lang.String</bin:javatype>
  +            </bin:item-type>
  +        </bin:binding-type>
  +
  +        <bin:binding-type xsi:type="bin:list-array">
  +            <bin:xmlcomponent>t=SimpleLongList@java:com.mytest</bin:xmlcomponent>
  +            <bin:javatype>long[]</bin:javatype>
  +            <bin:item-type>
  +                <bin:xmlcomponent>t=long@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
  +                <bin:javatype>long</bin:javatype>
  +            </bin:item-type>
  +        </bin:binding-type>
  +
           <bin:binding-type xsi:type="bin:simple-content-bean">
               <bin:xmlcomponent>t=SimpleContentExample@java:com.mytest</bin:xmlcomponent>
               <bin:javatype>com.mytest.SimpleContentExample</bin:javatype>
  @@ -364,6 +409,7 @@
               </bin:item-type>
               <bin:item-nillable>true</bin:item-nillable>
           </bin:binding-type>
  +
   
           <bin:binding-type xsi:type="bin:wrapped-array">
               <bin:xmlcomponent>t=ArrayOfArrayOfString@java:com.mytest</bin:xmlcomponent>
  
  
  
  1.17      +30 -0     xml-xmlbeans/v2/test/cases/marshal/com/mytest/YourClass.java
  
  Index: YourClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/com/mytest/YourClass.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- YourClass.java	29 Mar 2004 07:02:48 -0000	1.16
  +++ YourClass.java	6 Apr 2004 00:53:09 -0000	1.17
  @@ -57,6 +57,12 @@
       private IntEnum intEnum;
       private IntegerEnum integerEnum;
   
  +    private String[] simpleStringArray = {"ONE:" + RND.nextInt(),
  +                                          "TWO:" + RND.nextInt()};
  +
  +    private long[] simpleLongArray = {RND.nextLong(),
  +                                      RND.nextLong()};
  +
   
       //hack alert
       static final Random RND = new Random();
  @@ -307,6 +313,26 @@
           this.integerEnum = integerEnum;
       }
   
  +    public String[] getSimpleStringArray()
  +    {
  +        return simpleStringArray;
  +    }
  +
  +    public void setSimpleStringArray(String[] simpleStringArray)
  +    {
  +        this.simpleStringArray = simpleStringArray;
  +    }
  +
  +    public long[] getSimpleLongArray()
  +    {
  +        return simpleLongArray;
  +    }
  +
  +    public void setSimpleLongArray(long[] simpleLongArray)
  +    {
  +        this.simpleLongArray = simpleLongArray;
  +    }
  +
       public boolean equals(Object o)
       {
           if (this == o) return true;
  @@ -324,6 +350,8 @@
           if (myClass != null ? !myClass.equals(yourClass.myClass) : yourClass.myClass != null) return false;
           if (!Arrays.equals(myClassArray, yourClass.myClassArray)) return false;
           if (!Arrays.equals(stringArray, yourClass.stringArray)) return false;
  +        if (!Arrays.equals(simpleStringArray, yourClass.simpleStringArray)) return false;
  +        if (!Arrays.equals(simpleLongArray, yourClass.simpleLongArray)) return false;
           if (!Arrays.equals(wrappedArrayOne, yourClass.wrappedArrayOne)) return false;
   //        if (strs != null ? !strs.equals(yourClass.strs) : yourClass.strs != null) return false;
   
  @@ -373,6 +401,8 @@
               ", longArray=" + ArrayUtils.arrayToString(longArray) +
               ", booleanArray=" + ArrayUtils.arrayToString(booleanArray) +
               ", stringArray=" + ArrayUtils.arrayToString(stringArray) +
  +            ", simpleStringArray=" + ArrayUtils.arrayToString(simpleStringArray) +
  +            ", simpleLongArray=" + ArrayUtils.arrayToString(simpleLongArray) +
               ", wrappedArrayOne=" + ArrayUtils.arrayToString(wrappedArrayOne) +
               ", myClassArray=" + ArrayUtils.arrayToString(myClassArray) +
               "}";
  
  
  
  1.49      +10 -0     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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- MarshalTests.java	29 Mar 2004 07:02:48 -0000	1.48
  +++ MarshalTests.java	6 Apr 2004 00:53:09 -0000	1.49
  @@ -135,6 +135,7 @@
           testSimpleTypeUnmarshal(new Double(23432.43234), "double");
           testSimpleTypeUnmarshal(new Double(23432.43234), "double");
   
  +        testStringTypeUnmarshal("anySimpleType");
           testStringTypeUnmarshal("string");
           testStringTypeUnmarshal("normalizedString");
           testStringTypeUnmarshal("token");
  @@ -155,6 +156,12 @@
           final byte[] bytes = new byte[]{1, 2, 3, 4, 5, 6};
           testSimpleTypeUnmarshal(bytes, "AQIDBAUG", "base64Binary");
           testSimpleTypeUnmarshal(bytes, "010203040506", "hexBinary");
  +
  +        final String[] strs = new String[]{"foo", "bar"};
  +        testSimpleTypeUnmarshal(strs, "foo bar", "ENTITIES");
  +        testSimpleTypeUnmarshal(strs, "foo bar", "IDREFS");
  +        testSimpleTypeUnmarshal(strs, "foo bar", "NMTOKENS");
  +
       }
   
       private void testStringTypeUnmarshal(String xsd_type)
  @@ -176,6 +183,8 @@
           testSimpleTypeMarshal(new BigDecimal("43434343342.233434342"), "decimal");
           testSimpleTypeMarshal(new Float(5555.5555f), "float");
           testSimpleTypeMarshal(new Double(1231.444), "double");
  +        testSimpleTypeMarshal(new URI("http://www.apache.org/"), "anyURI");
  +
           testSimpleTypeMarshal("some text here", "string");
           testSimpleTypeMarshal("aToken", "token");
           testSimpleTypeMarshal("       ", "string");
  @@ -186,6 +195,7 @@
           final byte[] bytes = new byte[]{1, 2, 3, 4, 5, 6};
           testSimpleTypeMarshal(bytes, "base64Binary");
           testSimpleTypeMarshal(bytes, "hexBinary");
  +
   
       }
   
  
  
  

---------------------------------------------------------------------
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