Re: Three equivalent ways to specify an unconstrained data type ... are there others?

At 2012-10-20 12:04 +0000, Costello, Roger L. wrote:
>Hi Folks,
>
>Below are declarations of three elements, E1, E2, and E3. All three 
>elements have the same data type: an unconstrained string. All other 
>data types (boolean, integer, etc.) can be similarly specified. Thus 
>there are 3 ways to specify the same thing for every built-in data type.
>
>Can you think of any other ways to specify an unconstrained data type?
>
>     <xs:element name="E1" type="xs:string" />
>
>     <xs:element name="E2" type="string-equivalent-1" />
>
>     <xs:element name="E3" type="string-equivalent-2" />
>
>     <xs:complexType name="string-equivalent-1">
>         <xs:simpleContent>
>             <xs:extension base="xs:string" />
>         </xs:simpleContent>
>     </xs:complexType>
>
>     <xs:simpleType name="string-equivalent-2">
>         <xs:restriction base="xs:string" />
>     </xs:simpleType>

How about the following?

t:\ftemp>type roger.xml
<doc>This is yet another way to have unconstrained text.</doc>

t:\ftemp>w3cschema roger.xsd roger.xml
Xerces...
No validation errors.
Saxon...
Altova...
The XML data is valid.

t:\ftemp>type roger.xsd
<?xml version="1.0" encoding="US-ASCII"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="doc">
   <xsd:complexType mixed="true"/>
</xsd:element>

</xsd:schema>
t:\ftemp>

I hope this helps.

. . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Received on Saturday, 20 October 2012 13:16:51 UTC