Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/06/2010, 17:43
Avatar de bng5
bng5
 
Fecha de Ingreso: junio-2009
Ubicación: 127.0.0.1
Mensajes: 269
Antigüedad: 14 años, 11 meses
Puntos: 24
Datatypes en bind de XForms - XMLSchema

Estoy usando XForms, en el modelo uso bind para indicar que tipo de datos deben ser ingresados en cada campo.
Estos tipos de datos (datatypes) corresponden al namespace http://www.w3.org/2001/XMLSchema (xs).
Ej: xs:integer, xs:base64Binary, xs:hexBinary, xs:anyURI, etc.

Quiero, además, utilizar el datatype Color especificado en http://www.w3.org/MarkUp/SCHEMA/xhtml-datatypes-1.xsd.
Este schema tiene como targetNamespace "http://www.w3.org/1999/xhtml/datatypes/", por lo que agregué ese namespace.

¿Está bien si uso schemaLocation de esta manera?
Si es así, ¿cuál sería su namespace correspondiente?
¿O tengo que usar xs:import o xs:include?

Código HTML:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dt="http://www.w3.org/1999/xhtml/datatypes/"
    xsi:schemaLocation="http://www.w3.org/1999/xhtml/datatypes/ http://www.w3.org/MarkUp/SCHEMA/xhtml-datatypes-1.xsd">
  <head>
    <xf:model>
      <xf:instance xmlns="">
        <xml>
          <numero />
          <color />
          <archivo mediatype="" filename=""/>
        </xml>
      </xf:instance>
      <xf:submission id="form1" method="post" action="/recibe"/>
      <xf:bind nodeset="numero" type="xs:integer" required="true()"/>
      <!--
      ¿Cuál debería ser el valor del atributo type?
      ¿dt:Color, xs:Color, Color?
      -->
      <xf:bind nodeset="color" type="dt:Color" required="true()"/>
      <xf:bind nodeset="archivo" type="xs:base64Binary"/>
    </xf:model>
  </head>
  <body>
    <xf:input ref="numero">
      <xf:label>Número</xf:label>
    </xf:input>
    <br />
    <xf:input ref="color">
      <xf:label>Color</xf:label>
    </xf:input>
    <br />
    <xf:upload ref="archivo">
      <xf:label>Archivo: </xf:label>
      <xf:filename ref="@filename" />
      <xf:mediatype ref="@mediatype" />
    </xf:upload>
    <br />
    <xf:submit submission="form1">
      <xf:label>post</xf:label>
    </xf:submit>
  </body>
</html>