You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mukul Gandhi <mu...@apache.org> on 2018/07/04 05:31:49 UTC

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 validation errors

Hi Yitzhak,
   I studied one of the XPath expressions in the <assert> of your XSD. This
is below,

if (abs((ContractValueShortTerm + ContractValueLongTerm) - ContractValue)
le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
true() else false()

In this XPath, one of the evaluations you're doing is, abs(..) le
subsequence(..).

The fn:abs(..) return type is numeric?

and fn:subsequence(..) return type is item()*

As per the XPath 2.0 spec, the semantics of the operator "le" says (ref,
https://www.w3.org/TR/xpath20/#id-value-comparisons),

The value comparison operators are eq, ne, lt, le, gt, and ge. Value
comparisons are used for comparing single values.
3. If the atomized operand is a sequence of length greater than one, a type
error is raised [err:XPTY0004].

I suspect, since subsequence is returning a sequence of cardinality/size
greater than one, the Xerces's <assert> XPath processor is rightly emitting
an error XPTY0004.

On Tue, Jul 3, 2018 at 11:48 PM, Yitzhak Khabinsky <
Yitzhak.Khabinsky@millicom.com> wrote:

> Hello,
>
>
>
> Just started to use today recently released Xerces-J 2.12.0 for XSD 1.1
> validations.
>
> Unfortunately, my very first test failed right away with multiple errors.
>
>
>
> My test case XML/XSD is passing XSD 1.1 validation using Saxon 9.8.0.12
> without any problem.
>
> Please advise.
>
>
>
> Running custom validation engine Xerces-J Validator XSD 1.1...
>
>
>
>
>
> d:\Temp\CDW\HOME>"c:\Program Files\Java\jre1.8.0_172\bin\java.exe"
> -Xms512m -Xmx1024m -Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\
> xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.
> xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\
> xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\
> xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar
> jaxp.SourceValidator -xsd11 -i "file:///d:/Temp/CDW/IFRS/
> IFRS15_CBC_Out/TanzaniaZantel/id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml"
>
>
>
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus,
> 'TERMINATION')) then true() (: Ignore the rest :)     else if
> (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1
> + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth +
> IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth +
> IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 +
> IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 +
> IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 +
> IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus,
> 'TERMINATION')) then true() (: Ignore the rest :)     else if
> (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1
> + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth +
> IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth +
> IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 +
> IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 +
> IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 +
> IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus,
> 'TERMINATION')) then true() (: Ignore the rest :)     else if
> (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1
> + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth +
> IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth +
> IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 +
> IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 +
> IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 +
> IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus,
> 'TERMINATION')) then true() (: Ignore the rest :)     else if
> (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1
> + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth +
> IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and
> IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth +
> IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then
> true() else false()') for element 'ContractLineItem' on schema type
> '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not
> match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 +
> IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 +
> IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29:
> cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 +
> IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'ContractLineItem'
> on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 -
> Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (some $x in ContractLineItems/
> ContractLineItem/RecordMonthStatus satisfies starts-with($x,
> 'TERMINATION')) then true() (: Ignore the rest :)     else if
> (abs(sum(ContractLineItems/ContractLineItem/(IFRSRevenuePreviousMonth +
> IFRSRevenueCurrentMonth + IFRSRevenueYear1 + IFRSRevenueYear2 +
> IFRSRevenueYear3)) - ContractLiabilityFinancingEffect +
> ContractAssetFinancingEffect - sum(ContractLineItems/ContractLineItem/
> RelativeStandaloneSellingPriceTotal)) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs((ContractAsset +
> ContractLiability - ContractInterestIncome - ContractInterestExpense) -
> sum(ContractLineItems/ContractLineItem/IFRSAdjustmentsCurrentMonth)) le
> subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then
> true() else false()') for element 'r' on schema type '#AnonType_r' did not
> succeed. XPTY0004 - Value does not match a required type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs((ContractValueShortTerm +
> ContractValueLongTerm) - ContractValue) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs((ContractValueShortTermT0 +
> ContractValueLongTermT0) - ContractValueT0) le subsequence((0.05, 0.1,
> 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs((ContractAssetShortTerm +
> ContractAssetLongTerm) - ContractAsset) le subsequence((0.05, 0.1, 0.05,
> 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs((ContractLiabilityShortTerm
> + ContractLiabilityLongTerm) - ContractLiability) le subsequence((0.05,
> 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> [Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8:
> cvc-assertion: Assertion evaluation ('if (abs(ContractNetContractPositionT0
> - sum(ContractLineItems/ContractLineItem[./MaterialCategory eq
> 'HARDWARE']/(RelativeStandaloneSellingPriceTotal -
> TransactionPriceTotal)) + sum(ContractLineItems/ContractLineItem[./MaterialCategory
> = 'FEE']/TransactionPriceTotal)) le subsequence((0.05, 0.1, 0.05, 0.05,
> 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> CountryCode), 1)) then true() else false()') for element 'r' on schema type
> '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required
> type.
>
> file:///d:/Temp/CDW/IFRS/IFRS15_CBC_Out/TanzaniaZantel/
> id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml: 278 ms
>
>
>
>
>
>
>
>
>
> Regards,
>
> Yitzhak Khabinsky
>
> Technical Services Lead
>
> Millicom International Services LLC
>
> 396 Alhambra Circle, Suite 1100
>
> Coral Gables, FL  33134
>
> Skype4B: +1 (305) 445-4172
>
> Tel: (954) 684-8673
>
> *yitzhak.khabinsky@millicom.com <.k...@millicom.com>*
>
> www.millicom.com
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>
>
>
>



-- 
Regards,
Mukul Gandhi

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 validation errors

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Yitzhak,
   Thanks for the test case.

I did run your test cases. The reason why the following,
<xs:assert test="if (abs(price - 10) le subsequence((0.05, 100.00, 0.05,
0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
country), 1)) then true() else false()">
    <xs:annotation>
        <xs:documentation>Rule #2</xs:documentation>
        <xs:documentation>string from country element value,
fails</xs:documentation>
    </xs:annotation>
</xs:assert>

gives an error, is because in the implementation of fn:index-of function in
Xerces's XPath 2.0 processor, the 2nd argument is not atomized internally.
I would say, that the mentioned atomization would be good to have, to be
consistent with implementations of various other XPath 2.0 functions in
Xerces's XPath 2.0 processor.
But I won't call the failure of one of your test cases as mentioned in this
thread, a bug in our XSD 1.1 processor, since I can't find anywhere in
XPath 2.0 and XPath 2.0 F&O specs that the missing atomization (in the
fn:index-of function) is mandatory.

As a workaround, I'd suggest that, following XPath expression
index-of(('BO','CO','GT','HN','PY','SV','TZ'), country) should be written
as,

index-of(('BO','CO','GT','HN','PY','SV','TZ'), string(country))
[this would also make your XSD 1.1 document portable]

I prefer, string(country) over xs:string(country).

As an additional note, I admit we're not in the position as of now, to fix
any further bugs in Xerces's XPath 2.0 processor, since none of our team
members has commit rights on the Eclipse WTP Source Editing project (
https://www.eclipse.org/webtools/sse/); earlier we used to have commit
rights on the WTP Source Editing project; this project is the owner of our
XPath 2.0 processor.

You might like to request the WTP project to fix the issue which you've
discovered. Their mailing list is wtp-dev@eclipse.org. If the WTP Project
fixes this issue on their source repos (the branch R3_2_maintenance on
their XPath 2.0 repos), we can then build new XPath 2.0 jar from their new
source code and provide to our users.

On Fri, Jul 6, 2018 at 2:08 AM, Yitzhak Khabinsky <
Yitzhak.Khabinsky@millicom.com> wrote:

> Hi Mukul,
>
>
>
> Here is a small XML/XSD test case.
>
> You can find it in the attachment.
>
>
>
> I created 3 rules, all around how the *country* element passed as a
> parameter:
>
>    1. string literal, passed
>    2. *country element string value, fails*
>    3. country element value cast as string, passed
>
>
>
> Just the Rule #2 emits the error, though the schema knows that the
> *country* element has a string data type and it fails for no obvious
> reason.
>
>
>
> [Error] test1.xml:5:8: cvc-assertion: Assertion evaluation ('if (abs(price
> - 10) le subsequence((0.05, 100.00, 0.05, 0.05, 0.05, 0.05, 0.05),
> index-of(('BO','CO','GT','HN','PY','SV','TZ'), country), 1)) then true()
> else false()') for element 'root' on schema type '#AnonType_root' did not
> succeed. XPTY0004 - Value does not match a required type.
>
>
>
> So it looks like that the problem is not related to the suggested reasons:
>
>    - The fn:abs(..) return type is numeric?
>    - and fn:subsequence(..) return type is item()*
>    - subsequence is returning a sequence of cardinality/size greater than
>    one
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="test Test1.xsd" xmlns="test">
>     <country>CO</country>
>     <price>25.1234</price>
> </root>
>
>
>
> <?xml version="1.0"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault=
> "qualified" targetNamespace="test" xpathDefaultNamespace="##
> targetNamespace" xmlns="test">
>     <xs:element name="root">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element ref="country"/>
>                 <xs:element ref="price"/>
>             </xs:sequence>
>
>             <xs:assert test="if (abs(price - 10) le subsequence((0.05,
> 100.00, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> 'CO'), 1)) then true() else false()">
>                 <xs:annotation>
>                     <xs:documentation>Rule #1</xs:documentation>
>                     <xs:documentation>string literal, passed<
> /xs:documentation>
>                 </xs:annotation>
>             </xs:assert>
>             <xs:assert test="if (abs(price - 10) le subsequence((0.05,
> 100.00, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> country), 1)) then true() else false()">
>                 <xs:annotation>
>                 <xs:documentation>Rule #2</xs:documentation>
>                     <xs:documentation>string from country element value,
> fails</xs:documentation>
>                 </xs:annotation>
>             </xs:assert>
>             <xs:assert test="if (abs(price - 10) le subsequence((0.05,
> 100.00, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'),
> xs:string(country)), 1)) then true() else false()">
>                 <xs:annotation>
>                 <xs:documentation>Rule #3</xs:documentation>
>                     <xs:documentation>cast as string from country element
> value, passed</xs:documentation>
>                 </xs:annotation>
>             </xs:assert>
>         </xs:complexType>
>     </xs:element>
>
>     <xs:element name="country" type="xs:string"/>
>     <xs:element name="price" type="xs:decimal"/>
> </xs:schema>
>





-- 
Regards,
Mukul Gandhi