Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343224

Summary: [xpath2] "castable as" checks should have access to in-scope user defined simple type definitions
Product: [WebTools] WTP Source Editing Reporter: Mukul Gandhi <mukul.gandhi>
Component: wst.xpathAssignee: Project Inbox <wst.xsl-inbox>
Status: NEW --- QA Contact: Jesper Moller <jesper>
Severity: enhancement    
Priority: P3 CC: dtn-eclipsebugs, d_a_carver, jesper
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mukul Gandhi CLA 2011-04-18 20:39:08 EDT
Build Identifier: I20090313-0100

Let's say we have following XML document,

<X>
   <a>pass</a>
</X>

and it's validated by the following schema,

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	
    <xs:element name="X">
       <xs:complexType>
	   <xs:sequence>
	      <xs:element name="a" type="xs:string"/>			  
	   </xs:sequence>
       </xs:complexType>
    </xs:element>
	
    <xs:simpleType name="STATUS">
       <xs:restriction base="xs:string">
	  <xs:enumeration value="pass"/>
	  <xs:enumeration value="fail"/>
       </xs:restriction>
    </xs:simpleType>
	
</xs:schema>

Now when we evaluate an expression like following (within the context of above XML and schema documents),

X/a castable as STATUS

then this expression evaluation should be aware of the simple type definition STATUS.

This is particularly useful in scenarios where we use XML Schema 1.1 assertions as follows,

<xs:element name="X">
   <xs:complexType>
      <xs:sequence>
         <xs:element name="a" type="xs:string"/>			  
      </xs:sequence>
      <xs:assert test="a castable as STATUS" />
   </xs:complexType>
</xs:element>

I've written a patch for this, and would be committing it asap along with a test case.

Reproducible: Always
Comment 1 Mukul Gandhi CLA 2011-04-18 21:24:01 EDT
I've committed the changes to service branch.

Still not committing to HEAD location, since we need to sort few API issues for this fix, as per new API design and also not committing test cases for this at the moment (since that is also held due to newer API issues).

I'm leaving this bug report as NEW at the moment.