Loading ...
Sorry, an error occurred while loading the content.

How can I constrain values to a complex type?

Expand Messages
  • Christian_Hoertnagl
    I m wondering whether I can constrain an entire chunk of instance data to a particular complex type, instead of having to reference multiple simple types
    Message 1 of 1 , Jul 1, 2004
    • 0 Attachment
      I'm wondering whether I can constrain an entire chunk of instance data
      to a particular complex type, instead of having to reference multiple
      simple types (section 2.3 of the spec does not rule it out). I'm
      thinking of the following (based on the schema-driven example), but
      was not yet able to make it work in formsPlayer-version 1.0.1.1012.

      Thanks for any help on solving this mystery,
      Christian

      <?xml version="1.0" encoding="iso-8859-1"?>
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:test="http://www.test.com">

      <object width="0" height="0" id="FormsPlayer"
      classid="CLSID:4D0ABA11-C5F0-4478-991A-375C4B648F58">
      <b>FormsPlayer has failed to load! Please check your installation.</b>
      </object>
      <?import namespace="xforms" implementation="#FormsPlayer"?>

      <head>
      <link rel="stylesheet" href="test.css" type="text/css"/>
      <xforms:model>

      <xforms:instance>
      <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:test="http://www.test.com">
      <!-- xsi:type="test:rootType" does not work -->
      <theInt>0815</theInt>
      <theDate>2004-07-01</theDate>
      <theBoolean>true</theBoolean>
      </root>
      </xforms:instance>

      <!-- <xforms:bind nodeset="/root" type="test:rootType"/> does not
      work -->

      <xsd:schema targetNamespace="http://www.test.com"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <!-- references to simple types defined in hree do work -->

      <xsd:complexType name="rootType">
      <xsd:sequence>
      <xsd:element name="theInt" type="xsd:int"/>
      <xsd:element name="theDate" type="xsd:date"/>
      <xsd:element name="theBoolean" type="xsd:boolean"/>
      </xsd:sequence>
      </xsd:complexType>

      </xsd:schema>
      </xforms:model>
      </head>

      <body>
      <xforms:input ref="theInt">
      <xforms:label>Please enter an integer:<br/></xforms:label>
      </xforms:input>
      <xforms:input ref="theDate">
      <xforms:label>Please enter a date:<br/></xforms:label>
      </xforms:input>
      <xforms:input ref="theBoolean">
      <xforms:label>Please enter a boolean:<br/></xforms:label>
      </xforms:input>
      </body>

      </html>
    Your message has been successfully submitted and would be delivered to recipients shortly.