[
https://issues.apache.org/jira/browse/XERCESJ-1609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13606332#comment-13606332
]
Mukul Gandhi commented on XERCESJ-1609:
---------------------------------------
Xerces's schema 1.1 processor by default uses the XPath subset defined by the
XSD 1.1 CTA spec. You seem to be using this default configuration, and hence
getting these compilation errors. If you set the feature,
http://apache.org/xml/features/validation/cta-full-xpath-checking to 'true' on
SchemaFactory Xerces would then use full XPath 2.0 (which is also allowed by
the spec as a user option), and your <alternative> XPath expressions would
compile fine.
There's another issue I can see with your schema document. You've written,
<xs:element name="value" type="xs:anyAtomicType">
<xs:alternative test="matches(value,'^\d{4}-\d{2}-\d{2}$')" type="xs:date"/>
<xs:alternative test="matches(value,'^\d{4}-\d{2}$')" type="xs:gYearMonth"/>
<xs:alternative test="matches(value,'^\d{4}$')" type="xs:gYear"/>
</xs:element>
This would probably not produce the intended functionality as you seem to
desire. The CTA XDM instance (both in cases of XPath subset as well as full
XPath 2.0), consists only of an element node and its attributes. None of the
child nodes (of element node 'value' in this case) are represented within this
data model.
When you do <xs:alternative test="matches(value,'^\d{4}-\d{2}-\d{2}$')"
type="xs:date"/>, you seem to require matching the string value of element node
'value'. Due to the nature of CTA data model, this wouldn't work. You've to
either introduce an attribute to use CTAs, or use assertion if you want to
access a child node within an XDM tree.
I do not see the issue you've described as a bug.
> Error: System ID:0Engine name: Xerces Severity: error Description:
> c-cta-xpath: The XPath expression 'matches(value,'^\d{4}$')' couldn't compile
> successfully in 'cta-subset' mode, during CTA evaluation. Start location:
> 26:108
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1609
> URL: https://issues.apache.org/jira/browse/XERCESJ-1609
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.1 Structures
> Affects Versions: 2.11.0
> Environment: Oxygen 14.2, Linux Ubuntu 64 bit
> Reporter: Bert Verhees
>
> When using Oxygen I get an error reported, which is, in my opinion not an
> error. The (also in Oxygen included) Saxon-validation does not report an
> error. Oxygen uses:
> Name: org/apache/xerces/impl/Version.class
> Comment: Xerces-J 2.11.0-xml-schema-1.1-beta
> Implementation-Title: org.apache.xerces.impl.Version
> Implementation-Version: 2.11.0-xml-schema-1.1-beta
> Implementation-Vendor: Apache Software Foundation
> Implementation-URL: http://xerces.apache.org/xerces2-j/
> It is following example XSD which generates the error:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:openkernel="http://rosa.openkernel/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
> targetNamespace="http://rosa.openkernel/">
> <xs:element name="openEHR-DEMOGRAPHIC-PERSON.testdb_person.v1"
> type="openkernel:PERSONTYPE"/>
> <xs:complexType name="PERSONTYPE">
> <xs:sequence maxOccurs="1" minOccurs="1">
> <xs:element maxOccurs="1" minOccurs="1"
> name="openEHR-DEMOGRAPHIC-PERSON.testdb_person.v1">
> <xs:complexType>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element name="at0001__details">
> <xs:complexType>
> <xs:sequence>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element name="at0004__items">
> <xs:complexType>
> <xs:sequence>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element name="at0005__items">
> <xs:complexType>
> <xs:sequence maxOccurs="1" minOccurs="1">
> <xs:element name="value">
> <xs:complexType>
> <xs:sequence maxOccurs="1"
> minOccurs="1">
> <xs:element name="value"
> type="xs:anyAtomicType">
> <xs:alternative
> test="matches(value,'^\d{4}-\d{2}-\d{2}$')" type="xs:date"/>
> <xs:alternative
> test="matches(value,'^\d{4}-\d{2}$')" type="xs:gYearMonth"/>
> <xs:alternative
> test="matches(value,'^\d{4}$')" type="xs:gYear"/>
> </xs:element>
> </xs:sequence>
> <xs:assert
> test="matches(value,'^\d{4}(-\d{2}(-\d{2})?)?$')"
> xpathDefaultNamespace="##targetNamespace"/>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> <xs:attribute fixed="at0005"
> name="archetype_node_id" use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:sequence>
> <xs:attribute fixed="at0004" name="archetype_node_id"
> use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:sequence>
> <xs:attribute fixed="at0001" name="archetype_node_id"
> use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> The error messages are:
> System ID: bug18-3-2013.xsd
> Main validation file: bug18-3-2013.xml
> Schema: bug18-3-2013.xsd
> Engine name: Xerces
> Severity: error
> Description: c-cta-xpath: The XPath expression
> 'matches(value,'^\d{4}-\d{2}-\d{2}$')' couldn't compile successfully in
> 'cta-subset' mode, during CTA evaluation.
> Start location: 24:119
> System ID: bug18-3-2013.xsd
> Main validation file: bug18-3-2013.xml
> Schema: bug18-3-2013.xsd
> Engine name: Xerces
> Severity: error
> Description: c-cta-xpath: The XPath expression
> 'matches(value,'^\d{4}-\d{2}$')' couldn't compile successfully in
> 'cta-subset' mode, during CTA evaluation.
> Start location: 25:119
> System ID: bug18-3-2013.xsd
> Main validation file: bug18-3-2013.xml
> Schema: bug18-3-2013.xsd
> Engine name: Xerces
> Severity: error
> Description: c-cta-xpath: The XPath expression 'matches(value,'^\d{4}$')'
> couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
> Start location: 26:108
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]