You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by 4p...@sneakemail.com on 2007/03/08 13:39:01 UTC

array default value problem in schema

Hello everyone,

I've got a problem with default values specified in a schema that are 
arrays.
Xerces 2.7.0 fails to load the Schema grammar below at the 
'defaultIntArray3Element' element with the message:

"Value '4' with length '1' is not equal to length facet of '3'"

Well, err, the specified default value is "4 3 2", which is an array of 
length 3.

So is the bug in my schema or in Xerces C? I also tried to replace the 
restriction of the 'length' faced by restricting 'minLength' and 
'maxLength' to 3, with the same result

Cheers,

Uwe


<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
    xmlns="http://foo/test34"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://foo/test34"
    >
    <!--
    Test34 tests default value handling
    -->
   
    <xs:simpleType name="intArray">
        <xs:list itemType="xs:int"/>
    </xs:simpleType>
   
    <xs:simpleType name="intArray3">
        <xs:restriction base="intArray">
            <xs:length value="3"/>
        </xs:restriction>
    </xs:simpleType>
   
    <xs:complexType name="Test34">
        <xs:sequence>
            <xs:element name="defaultIntArray3Element" type="intArray3" 
default="4 3 2"/>
        </xs:sequence>
        <attribute name="defaultIntArray3" type="intArray3" default="3 2 
1"/>
    </xs:complexType>
   

    <!-- root element -->
    <xs:element name="test34" type="Test34"/>
</xs:schema>

Re: array default value problem in schema

Posted by Alberto Massari <am...@datadirect.com>.
Hi Uwe,

At 12.28 09/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>Oh boy. Sorry about the duplicate!
>
>Is there a date already when Xerces 3 will be released (or a version 
>that contains all the fixes; patching 2.7.0 with bits and pieces of 
>3.0 makes me feel a bit uncomfortable...)?

Xerces 2.7 has its own branch in SVN, and it's fully patched: 
https://svn.apache.org/repos/asf/xerces/c/branches/xerces-2.7

Alberto


>Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing 
>list| schrieb:
>>Thanks.
>>However, Boris and David are right; this is bug 1546 that has been 
>>fixed a year ago. This is the patch you can apply to your copy of Xerces:
>>
>>Index: 
>>C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
>>
>>===================================================================
>>--- 
>>C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
>>(revision 369441)
>>+++ 
>>C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
>>(revision 369442)
>>@@ -432,7 +432,7 @@
>>              }
>>
>>              XMLString::catString(retBufPtr, itemCanRep);
>>-            retBufPtr = retBufPtr + itemLen + 1;
>>+            retBufPtr = retBufPtr + itemLen;
>>              *(retBufPtr++) = chSpace;
>>              *(retBufPtr) = chNull;
>>              toUse->deallocate(itemCanRep);
>>
>>Alberto
>>
>>At 22.57 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>>>Just did.
>>>
>>>Cheers,
>>>
>>>Uwe
>>>
>>>
>>>Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing 
>>>list| schrieb:
>>>>Hi Uwe,
>>>>can you open a bug in Jira?
>>>>
>>>>Thanks,
>>>>Alberto
>>>>
>>>>At 13.39 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>>>>>Hello everyone,
>>>>>
>>>>>I've got a problem with default values specified in a schema 
>>>>>that are arrays.
>>>>>Xerces 2.7.0 fails to load the Schema grammar below at the 
>>>>>'defaultIntArray3Element' element with the message:
>>>>>
>>>>>"Value '4' with length '1' is not equal to length facet of '3'"
>>>>>
>>>>>Well, err, the specified default value is "4 3 2", which is an 
>>>>>array of length 3.
>>>>>
>>>>>So is the bug in my schema or in Xerces C? I also tried to 
>>>>>replace the restriction of the 'length' faced by restricting 
>>>>>'minLength' and 'maxLength' to 3, with the same result
>>>>>
>>>>>Cheers,
>>>>>
>>>>>Uwe
>>>>>
>>>>>
>>>>><?xml version="1.0" encoding="utf-8" ?>
>>>>><xs:schema
>>>>>    xmlns="http://foo/test34"
>>>>>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>>>    targetNamespace="http://foo/test34"
>>>>>    >
>>>>>    <!--
>>>>>    Test34 tests default value handling
>>>>>    -->
>>>>>
>>>>>    <xs:simpleType name="intArray">
>>>>>        <xs:list itemType="xs:int"/>
>>>>>    </xs:simpleType>
>>>>>
>>>>>    <xs:simpleType name="intArray3">
>>>>>        <xs:restriction base="intArray">
>>>>>            <xs:length value="3"/>
>>>>>        </xs:restriction>
>>>>>    </xs:simpleType>
>>>>>
>>>>>    <xs:complexType name="Test34">
>>>>>        <xs:sequence>
>>>>>            <xs:element name="defaultIntArray3Element" 
>>>>> type="intArray3" default="4 3 2"/>
>>>>>        </xs:sequence>
>>>>>        <attribute name="defaultIntArray3" type="intArray3" 
>>>>> default="3 2 1"/>
>>>>>    </xs:complexType>
>>>>>
>>>>>
>>>>>    <!-- root element -->
>>>>>    <xs:element name="test34" type="Test34"/>
>>>>></xs:schema>


Re: array default value problem in schema

Posted by 4p...@sneakemail.com.
Oh boy. Sorry about the duplicate!

Is there a date already when Xerces 3 will be released (or a version 
that contains all the fixes; patching 2.7.0 with bits and pieces of 3.0 
makes me feel a bit uncomfortable...)?

Cheers,

Uwe

Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing list| 
schrieb:
> Thanks.
> However, Boris and David are right; this is bug 1546 that has been 
> fixed a year ago. This is the patch you can apply to your copy of Xerces:
>
> Index: 
> C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
>
> ===================================================================
> --- 
> C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
> (revision 369441)
> +++ 
> C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
> (revision 369442)
> @@ -432,7 +432,7 @@
>              }
>
>              XMLString::catString(retBufPtr, itemCanRep);
> -            retBufPtr = retBufPtr + itemLen + 1;
> +            retBufPtr = retBufPtr + itemLen;
>              *(retBufPtr++) = chSpace;
>              *(retBufPtr) = chNull;
>              toUse->deallocate(itemCanRep);
>
> Alberto
>
> At 22.57 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>> Just did.
>>
>> Cheers,
>>
>> Uwe
>>
>>
>> Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing 
>> list| schrieb:
>>> Hi Uwe,
>>> can you open a bug in Jira?
>>>
>>> Thanks,
>>> Alberto
>>>
>>> At 13.39 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>>>> Hello everyone,
>>>>
>>>> I've got a problem with default values specified in a schema that 
>>>> are arrays.
>>>> Xerces 2.7.0 fails to load the Schema grammar below at the 
>>>> 'defaultIntArray3Element' element with the message:
>>>>
>>>> "Value '4' with length '1' is not equal to length facet of '3'"
>>>>
>>>> Well, err, the specified default value is "4 3 2", which is an 
>>>> array of length 3.
>>>>
>>>> So is the bug in my schema or in Xerces C? I also tried to replace 
>>>> the restriction of the 'length' faced by restricting 'minLength' 
>>>> and 'maxLength' to 3, with the same result
>>>>
>>>> Cheers,
>>>>
>>>> Uwe
>>>>
>>>>
>>>> <?xml version="1.0" encoding="utf-8" ?>
>>>> <xs:schema
>>>>    xmlns="http://foo/test34"
>>>>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>>    targetNamespace="http://foo/test34"
>>>>    >
>>>>    <!--
>>>>    Test34 tests default value handling
>>>>    -->
>>>>
>>>>    <xs:simpleType name="intArray">
>>>>        <xs:list itemType="xs:int"/>
>>>>    </xs:simpleType>
>>>>
>>>>    <xs:simpleType name="intArray3">
>>>>        <xs:restriction base="intArray">
>>>>            <xs:length value="3"/>
>>>>        </xs:restriction>
>>>>    </xs:simpleType>
>>>>
>>>>    <xs:complexType name="Test34">
>>>>        <xs:sequence>
>>>>            <xs:element name="defaultIntArray3Element" 
>>>> type="intArray3" default="4 3 2"/>
>>>>        </xs:sequence>
>>>>        <attribute name="defaultIntArray3" type="intArray3" 
>>>> default="3 2 1"/>
>>>>    </xs:complexType>
>>>>
>>>>
>>>>    <!-- root element -->
>>>>    <xs:element name="test34" type="Test34"/>
>>>> </xs:schema>
>


Re: array default value problem in schema

Posted by Alberto Massari <am...@datadirect.com>.
Thanks.
However, Boris and David are right; this is bug 1546 that has been 
fixed a year ago. This is the patch you can apply to your copy of Xerces:

Index: 
C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
===================================================================
--- 
C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
(revision 369441)
+++ 
C:/Xerces/Xerces-C-2.7/src/xercesc/validators/datatype/ListDatatypeValidator.cpp 
(revision 369442)
@@ -432,7 +432,7 @@
              }

              XMLString::catString(retBufPtr, itemCanRep);
-            retBufPtr = retBufPtr + itemLen + 1;
+            retBufPtr = retBufPtr + itemLen;
              *(retBufPtr++) = chSpace;
              *(retBufPtr) = chNull;
              toUse->deallocate(itemCanRep);

Alberto

At 22.57 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>Just did.
>
>Cheers,
>
>Uwe
>
>
>Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing 
>list| schrieb:
>>Hi Uwe,
>>can you open a bug in Jira?
>>
>>Thanks,
>>Alberto
>>
>>At 13.39 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>>>Hello everyone,
>>>
>>>I've got a problem with default values specified in a schema that 
>>>are arrays.
>>>Xerces 2.7.0 fails to load the Schema grammar below at the 
>>>'defaultIntArray3Element' element with the message:
>>>
>>>"Value '4' with length '1' is not equal to length facet of '3'"
>>>
>>>Well, err, the specified default value is "4 3 2", which is an 
>>>array of length 3.
>>>
>>>So is the bug in my schema or in Xerces C? I also tried to replace 
>>>the restriction of the 'length' faced by restricting 'minLength' 
>>>and 'maxLength' to 3, with the same result
>>>
>>>Cheers,
>>>
>>>Uwe
>>>
>>>
>>><?xml version="1.0" encoding="utf-8" ?>
>>><xs:schema
>>>    xmlns="http://foo/test34"
>>>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>    targetNamespace="http://foo/test34"
>>>    >
>>>    <!--
>>>    Test34 tests default value handling
>>>    -->
>>>
>>>    <xs:simpleType name="intArray">
>>>        <xs:list itemType="xs:int"/>
>>>    </xs:simpleType>
>>>
>>>    <xs:simpleType name="intArray3">
>>>        <xs:restriction base="intArray">
>>>            <xs:length value="3"/>
>>>        </xs:restriction>
>>>    </xs:simpleType>
>>>
>>>    <xs:complexType name="Test34">
>>>        <xs:sequence>
>>>            <xs:element name="defaultIntArray3Element" 
>>> type="intArray3" default="4 3 2"/>
>>>        </xs:sequence>
>>>        <attribute name="defaultIntArray3" type="intArray3" 
>>> default="3 2 1"/>
>>>    </xs:complexType>
>>>
>>>
>>>    <!-- root element -->
>>>    <xs:element name="test34" type="Test34"/>
>>></xs:schema>


Re: array default value problem in schema

Posted by 4p...@sneakemail.com.
Just did.

Cheers,

Uwe


Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing list| 
schrieb:
> Hi Uwe,
> can you open a bug in Jira?
>
> Thanks,
> Alberto
>
> At 13.39 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>> Hello everyone,
>>
>> I've got a problem with default values specified in a schema that are 
>> arrays.
>> Xerces 2.7.0 fails to load the Schema grammar below at the 
>> 'defaultIntArray3Element' element with the message:
>>
>> "Value '4' with length '1' is not equal to length facet of '3'"
>>
>> Well, err, the specified default value is "4 3 2", which is an array 
>> of length 3.
>>
>> So is the bug in my schema or in Xerces C? I also tried to replace 
>> the restriction of the 'length' faced by restricting 'minLength' and 
>> 'maxLength' to 3, with the same result
>>
>> Cheers,
>>
>> Uwe
>>
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <xs:schema
>>    xmlns="http://foo/test34"
>>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>    targetNamespace="http://foo/test34"
>>    >
>>    <!--
>>    Test34 tests default value handling
>>    -->
>>
>>    <xs:simpleType name="intArray">
>>        <xs:list itemType="xs:int"/>
>>    </xs:simpleType>
>>
>>    <xs:simpleType name="intArray3">
>>        <xs:restriction base="intArray">
>>            <xs:length value="3"/>
>>        </xs:restriction>
>>    </xs:simpleType>
>>
>>    <xs:complexType name="Test34">
>>        <xs:sequence>
>>            <xs:element name="defaultIntArray3Element" 
>> type="intArray3" default="4 3 2"/>
>>        </xs:sequence>
>>        <attribute name="defaultIntArray3" type="intArray3" default="3 
>> 2 1"/>
>>    </xs:complexType>
>>
>>
>>    <!-- root element -->
>>    <xs:element name="test34" type="Test34"/>
>> </xs:schema>
>


Re: array default value problem in schema

Posted by Alberto Massari <am...@datadirect.com>.
Hi Uwe,
can you open a bug in Jira?

Thanks,
Alberto

At 13.39 08/03/2007 +0100, 4pzbrog02@sneakemail.com wrote:
>Hello everyone,
>
>I've got a problem with default values specified in a schema that are arrays.
>Xerces 2.7.0 fails to load the Schema grammar below at the 
>'defaultIntArray3Element' element with the message:
>
>"Value '4' with length '1' is not equal to length facet of '3'"
>
>Well, err, the specified default value is "4 3 2", which is an array 
>of length 3.
>
>So is the bug in my schema or in Xerces C? I also tried to replace 
>the restriction of the 'length' faced by restricting 'minLength' and 
>'maxLength' to 3, with the same result
>
>Cheers,
>
>Uwe
>
>
><?xml version="1.0" encoding="utf-8" ?>
><xs:schema
>    xmlns="http://foo/test34"
>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>    targetNamespace="http://foo/test34"
>    >
>    <!--
>    Test34 tests default value handling
>    -->
>
>    <xs:simpleType name="intArray">
>        <xs:list itemType="xs:int"/>
>    </xs:simpleType>
>
>    <xs:simpleType name="intArray3">
>        <xs:restriction base="intArray">
>            <xs:length value="3"/>
>        </xs:restriction>
>    </xs:simpleType>
>
>    <xs:complexType name="Test34">
>        <xs:sequence>
>            <xs:element name="defaultIntArray3Element" 
> type="intArray3" default="4 3 2"/>
>        </xs:sequence>
>        <attribute name="defaultIntArray3" type="intArray3" default="3 2 1"/>
>    </xs:complexType>
>
>
>    <!-- root element -->
>    <xs:element name="test34" type="Test34"/>
></xs:schema>


Re: array default value problem in schema

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
4pzbrog02@sneakemail.com writes:

> "Value '4' with length '1' is not equal to length facet of '3'"

I am pretty sure this is bug 1546 that's been fixed:

http://issues.apache.org/jira/browse/XERCESC-1546


I have a patch for Xerces-C++ 2.7.0 around - let me know if you
want it.


hth,
-boris


-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding