Re: xml Schema: restriction of Normalized string

That is not valid.

Saxon-SA will give you the following message:
SaxonSA] The whiteSpace normalization must not be weaker than that of 
the base type

Xerces says
[Xerces] whiteSpace-valid-restriction.2: In the definition of myType, 
the value 'preserve' for the facet 'whitespace' is invalid, because the 
value for 'whitespace' has been set to 'replace' in one of the ancestor 
types.

oXygen adds also the following URL to the error message:
URL: http://www.w3.org/TR/xmlschema-2/#whiteSpace-valid-restriction

Now, if you look at the URL above that points to the spec you see the 
fragment below, look at point 2:
***
Schema Component Constraint: whiteSpace valid restriction
It is an ·error· if whiteSpace is among the members of {facets} of {base 
type definition} and any of the following conditions is true:
1 {value} is replace or preserve and the {value} of the parent 
whiteSpace is collapse
2 {value} is preserve and the {value} of the parent whiteSpace is replace
***

 From schema for schemas the definition of normalizedString is:

     <xs:simpleType id="normalizedString" name="normalizedString">
         <xs:annotation>
             <xs:documentation 
source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
         </xs:annotation>
         <xs:restriction base="xs:string">
             <xs:whiteSpace id="normalizedString.whiteSpace" 
value="replace"/>
         </xs:restriction>
     </xs:simpleType>

Best Regards,
George
-- 
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

bharath wrote:
> Hi….
> 
>  
> 
> Can you please tell me the following is valid restriction or not…
> 
>  
> 
>  
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 
>        <xs:simpleType name="myType">
> 
>               <xs:restriction base="xs:normalizedString">
> 
>                      <xs:whiteSpace value="preserve"/>
> 
>               </xs:restriction>
> 
>        </xs:simpleType>
> 
> </xs:schema>
> 
>  
> 
>  
> 
> Thanks and regards,
> 
> Bharath.
> 
> ********************************************************************************************************
>  This e-mail and attachments contain confidential information from 
> HUAWEI, which is intended only for the person or entity whose address is 
> listed above. Any use of the information contained herein in any way 
> (including, but not limited to, total or partial disclosure, 
> reproduction, or dissemination) by persons other than the intended 
> recipient's) is prohibited. If you receive this e-mail in error, please 
> notify the sender by phone or email immediately and delete it!
> 
>  
> 

Received on Friday, 5 December 2008 08:01:55 UTC