레이블이 XForms인 게시물을 표시합니다. 모든 게시물 표시
레이블이 XForms인 게시물을 표시합니다. 모든 게시물 표시

Data Type System

Data Type System
 
표준에서 정의된 형 시스템의 배경이 되는 개념적인 프레임워크를 기술한다. 이러한 데이터 형은 SQL 및 자바와 같은 프로그램밍 언어를 위한 자료형 뿐만 아니라 언어 중립적 데이터형에 대한 ISO 11404 표준, 초기 스키마 제안 등을 바탕으로 만들어졌다.

이 표준은 크게 세 부분으로 구성된다.
  • value space이라 불리우는 유효한 값들의 집합
  • lexcial space이라 불리우는 렉시컬 표현들의 집합
  • value space, lexcial space, 개별 값(individual values)들의 프로퍼티인 facet
Value space
Value space는 주어진 자료형을 위한 값 집합이다. 이러한 Value space는 많은 데이터형을 내포하는 의미이다. 예를 들어 정수형인 경우에는 0을 포함한 양의 정수 및 음의 정수를 가질 수 있지만 소수 값은 허용되지 않으며, 문자열은 문자들로 나열되는 모든 것을 가질 수 있다 등 특정 특성들을 가지고 있는 유효한 값들의 집합을 의미한다.
Lexical space
Lexical space는 데이터형의 값을 표현하는 유효한 문자열 리터럴 집합을 의미한다. 예를 들어 “100”과 “1.E2”은 동일한 값을 표현하는 Lexical space 이다. 이러한 Lexical space내의 문자열 리터럴은 다음과 같은 특성을 갖는다.
  • 바이너리 보다는 텍스트 리터럴을 갖는다. 이는 수동 편집, 디버깅 및 유사한 활동 들을 가능하게 한다.
  • 상호 호환성을 위해 각 값의 문자수는 작은 수로 유지되어야 한다. 문자와 값 사이에는 일대 일 매핑(one-to-one mapping)이 존재한다. 이는 다른 시스템 간의 값 교환을 용이하게 한다.
  • 가능한 리터럴은 일반 프로그래밍 언어 및 라이브러리에서 발견되는 리터럴과 일치한다.
Facet
Facet은 하나의 데이터형을 다른 데이터형과 구별한다. 이러한 Facet은 문자열의 길이, 최소 및 최대 숫자 값의 범위와 같은 프로퍼티들을 포함하고 있다. Facet은 자료형을 정의하는 기본 Facet과 비기본 자료형의 허용 값을 제약하는 제약 Facet으로 구분된다.
기본 Facet(Fundamental facets)은 Value space에서 값을 의미론적으로 특징짓기 위해 사용되는 추상적이고 내재적인 프로퍼티들이다. 예를 든다면 숫자, 비숫자 구분 등이 있다. 제약 Facet(Constraining facets)은 Value space에서 값을 제약하기 위하여 자료형에 적용될 수 있는 선택적 프로퍼티들이다. 여기에는 문자열 길이 제한, 숫자 값이 범위 등이 있다. 이 Facet은 유도 데이터형(Derived datatype)을 만들 때 그에 허용되는 Value space 제한하는데 많이 사용된다.

Data Types

Data Types
 
XML Schema는 표준 정의에 맞는 형식을 지시하는 내장 형식(Built-in Type)을 기본적으로 제공하고 있다. XML Schema 사용자들은 이러한 Built-in Datatypes를 기반으로 페이싯(facet)를 통해 다양하게 사용자 정의 형식(Derived Type)을 추가 정의할 수 있다.

XForms는 XML Schema Part 2 를 기반으로 하여 Data Type을 정의하여 사용하고 있다. 그에 따라 XForms에서 사용하는 데이터 타입은 XML Built-in Type과 XForms Data Type으로 구분된다.
XML Schema Built-in Datatypes
W3C는 XML 1.0을 채택하면서 문서 내에서 사용하는 구성요소들에 대한 제한 메커니즘으로 DTD(Document Type Definitions)을 포함시켰다. 그러나 DTD는 데이터 전송, 변환 등의 요구 사항들을 만족시키지 못했다. 그에 따라 XML 사용자들을 만족시키기 위한 새로운 스펙을 정의하게 되었으며, 그 결과로 탄생한 것이 XML Schema 이다. W3C의 XML Schema는 다음과 같이 세가지 부분으로 구성되어 있다.
  • XML Schema Part 0 (Primer) : 첫 번째 부분은 설명과 예제로 이루어져 있어, XML Schema 개념을 잡고 스키마로 무엇을 할 수 있는지에 주로 대해 설명하고 있다.
  • XML Schema Part 1 (Structures) : XML 문서의 구조를 제한하는 방법을 정의하고 있다. 하나의 요소와 속성 그리고 값에 허용되는 제한들을 정의하고 있다.
  • XML Schema Part 2 (Datatypes) :내장 데이터형들(Built-in datatypes)의 집합을 정의하고 있다. 이렇게 정의된 내장 데이터형들로부터 새로운 형식을 어떻게 정의하는지에 대해서도 설명한다.
XForms Datatypes
XForms의 Model을 규정하기 위하여 XForms Schema에서 정의한 Datatype에 대한 것이며, 그 종류는 다음과 같다..

XForms Tutorial > I-6.2.10. The upload Element

xforms:upload Element
 
local file 을 upload 하기 위한 컨트롤이다.
Common Attributes : Common, UI Common, Single Node Binding
Special Attributes : incremental, mediatype, filename
  • mediatype
  • 이 엘리먼트의 컨테이너는upload element로서 첨부 파일을 선택했을 때, 그 파일의 유형을 정의하고자 할 때 사용되는 Optional element이다.
  • filename
  • 이 엘리먼트의 컨테이너는upload element로서 첨부 파일을 선택하고자 할 때 그 위치와 정보를 지정하는 Optional element이다.
Sample. list datatypes의 예
…(생략)...
<upload ref="mail/attachment" mediatype="image/*">
  <label>Select image:</label>
  <filename ref="@filename" />
  <mediatype ref="@mediatype" />
</upload>

…(생략)... 

XForms Tutorial > I-6.2.9. The range Element

xforms:range Element
 
This form control allows selection from a sequential range of values.
Common Attributes : Common, UI Common, Single Node Binding
Special Attributes : start, end, step
  • start
  • Optional hint for the lexical starting bound for the range?a legal value for the underlying data. If provided, this value is used to further refine the constraints specified by the underlying model.
  • end
  • Optional hint for the ending bound for the range?a legal value for the underlying data. If provided, this value is used to further refine the constraints specified by the underlying model.
  • step
  • Optional value to use for incrementing or decrementing the value. Must be of a type capable of expressing the difference between two legal values of the underlying data.
Sample.
…(생략)...
<xforms:model id="mymodel">
 <xforms:instance id="request_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <node1></node1>
  </root>
 </xforms:instance>
 <xforms:instance id="response_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></root>
 </xforms:instance>
</xforms:model>


<body>
<xforms:range model="mymodel" ref="instance('request_01')/node1" end="10" start="1" step="1" style="position:absolute; top:73px; left:76px; width:216px; ">
 <xforms:label>range control</xforms:label>
</xforms:range> 
<xforms:input model="mymodel" ref="instance('request_01')/node1" maxlength="10" style="position:absolute; top:124px; left:77px; height:29px; width:215px; ">
 <xforms:label>range value :</xforms:label>
</xforms:input>
</body>
...(생략)...
  • range 컨트롤의 위치를 5로 위치하면 input control에 5가 출력된다.
  • 이는 range 컨트롤과 input 컨트롤이 참조하는 instnace node가 'request_01/node1 이기 때문이다.

XForms Tutorial > I-6.2.8. The select1 Element

xforms:select1 Element
 
이 폼 컨트롤은 HTML의 <select>와 유사한 유저인터페이스를 제공한다. HTML <select> 컨트롤이 리스트 아이템을 선택하는 방식에 있어서 하나의 컨트롤을 통해 Single 및 Multiple 선택을 지원한다면 XForms는 Single과 Multiple를 분리하여 컨트롤을 제공한다. select1 element는 single 선택을 지원하는 XForms 컨트롤이다.
Common Attributes : Common, UI Common, Single Node Binding
Special Attributes : incremental, selection
  • selection
  • Optional attribute로서 디폴트 값은 “closed” 이다.
  • 이 어트리뷰트는 HTML <select> 컨트롤의 Drop-Down List 형식으로 입력이 불가능한 기능을 개선할 수 있다. 즉, selection 값이 true인 경우 콤보 박스에서 입력 가능한 인터페이스를 제공한다.
  • Data Binding Restrictions
  • Binds to xsd: any derived simpleContent
  • instace node data type과 표현
  • instance node의 데이터 타입에 따라 표현하는 방법은 select element와 동일하지만 single 선택을 위한 인터페이스 방법으로 제공되어야 한다는 점이 다르다.
appearance="full" appearance="compact" appearance="minimal"
Sample. list datatypes의 예
…(생략)...
<xforms:model>
 <xforms:instance>
  <root>
   <listitems>
    <depts> 
     <id>DEV</id>
     <desc>제품개발팀</desc> 
    </depts>
    <depts> 
     <id>SI</id>
     <desc>시스템통합 사업팀</desc> 
    </depts>
   </listitems>
       
   <selectitems />
  </root>
 </xforms:instance> 

 <xforms:bind id="bind_depts" nodeset="listitems/depts" />
</xforms:model>

</head>

<body>
 
 <xforms:select1 ref="selectitems" selection="open" >
  <xforms:itemset bind="bind_depts">
   <xforms:label ref="desc" />
   <xforms:value ref="id" />
  </xforms:itemset>   
 </xforms:select1>
 
 <br />
 <xforms:input ref="selectitems" >
  <xforms:label> 선택한 아이템의 코드는 : </xforms:label>
 </xforms:input>
</body>
…(생략)... 
  • 출력하고자 하는 인스턴스의 바인딩과 선택했을 때 그 값을 저장하고자 인스턴스 바인딩을 분리해야 한다.
  • select element를 통해 바인딩하는 대상은 선택한 값을 저장하고자 하는 인스턴스를 지정해야 한다.
  • itemset 그리고 label,value element를 통해 바인딩하는 대상은 출력하고자 하는 인스턴스를 지정해야 한다.
  • selection attribute를 통해 입력 가능한 콤보 박스를 설정할 수 있다.

XForms Tutorial > I-6.2.7. The select Element

xforms:select Element
 
이 폼 컨트롤은 HTML의 <select>와 유사한 유저인터페이스를 제공한다. HTML <select> 컨트롤이 리스트 아이템 선택을 선택하는 방식에 있어서 하나의 컨트롤을 통해 Single 및 Multiple 선택을 지원한다면 XForms는 Single과 Multiple를 분리하여 컨트롤을 제공한다. select element는 multiple 선택을 지원하는 XForms 컨트롤이다.
Common Attributes : Common, UI Common, Single Node Binding
Special Attributes : incremental, selection
  • selection
  • Optional attribute로서 디폴트 값은 “closed” 이다.
  • 이 어트리뷰트는 HTML <select> 컨트롤의 Drop-Down List 형식으로 입력이 불가능한 기능을 개선할 수 있다. 즉, selection 값이 true인 경우 콤보 박스에서 입력 가능한 인터페이스를 제공한다.
  • Data Binding Restrictions
  • Binds to xsd: any derived simpleContent
  • 바인딩시 주의 사항
  • select element 에 바인딩 되는 instance와 Common Markup for Selection Control에 바인딩 되는 instance의 의미는 다르다.
  • 실제 select element에 보여 주는 리스트 아이템은 select에 바인딩시키는 것이 아니라 item element와 value element에 바인딩 시켜야 한다.
  • select element 에 바인딩하는 것은 사용자가 선택했을 경우 그 값을 저장하기 위해 사용되는 instance 이다.
  • 참조 사항
  • 리스트 형식은 공백 문자들로 구분된 값들을 갖는다. 예를 들어 select element를 통해 아이템을 Multiple 로 선택했을 경우 그 선택된 값은 로 바인딩 된 인스턴스 노드로 세팅되게 된다. 이 때 여러 개 선택된 아이템을 구분하는 문자가 공백이다. 따라서 아이템의 value 값에 공백 문자를 사용했을 경우에는 의도된 결과와는 다르게 동작할 수 있다.
appearance="full" appearance="compact" appearance="minimal"
Sample. list datatypes의 예
…(생략)...
<item>
 <value>United States of America</value>
  ...
</item>
…(생략)... 
  • 위와 같은 value은 리스트 데이터형인 경우 의도한 결과와는 다르게 4개의 값, “United”, “States”, “of”, “America”으로 처리 될 것이다.
Sample. 기본적인 예제
…(생략)...
<xforms:model>
 <xforms:instance>
  <root>
   <listitems>
    <depts> 
     <id>DEV</id>
     <desc>제품개발팀</desc> 
    </depts>
    <depts> 
     <id>SI</id>
     <desc>시스템통합 사업팀</desc> 
    </depts>
   </listitems>
       
   <selectitems />
  </root>
 </xforms:instance> 

 <xforms:bind id="bind_depts" nodeset="listitems/depts" />
</xforms:model>

</head>

<body>
 <xforms:select ref="selectitems"> 
  <xforms:itemset bind="bind_depts">
   <xforms:label ref="desc" />
   <xforms:value ref="id" />
  </xforms:itemset>   
 </xforms:select>
 
 <br />
 <xforms:input ref="selectitems" >
  <xforms:label> 선택한 아이템의 코드는 : </xforms:label>
 </xforms:input>
</body>
…(생략)... 
  • 출력하고자 하는 인스턴스의 바인딩과 선택했을 때 그 값을 저장하고자 인스턴스 바인딩을 분리해야 한다.
  • select element를 통해 바인딩하는 대상은 선택한 값을 저장하고자 하는 인스턴스를 지정해야 한다.
  • itemset 그리고 label,value element를 통해 바인딩하는 대상은 출력하고자 하는 인스턴스를 지정해야 한다.

XForms Tutorial > I-6.2.6. The textarea Element

xforms:textarea Element
 
이 폼 컨트롤은 한 라인이 아니라 멀티 라인에 걸쳐 텍스트를 적을 수 있는 공간을 만드는 HTML 의 <textarea>와 유사한 유저인터페이스를 제공한다. 일반적으로 메일의 내용이나 게시판 등처럼 특정 내용을 기술하고자 할 때 많이 사용되는 컨트롤이다. 이 컨트롤이 사이즈, 즉 HTML cols/rows처럼 사이즈를 지정하고자 할 경우에는 Style-sheet의 width/height 통해서 지정해야 한다.
Common Attributes : Common, UI Common, Single Node Binding
Special Attributes : inputmode, incremental
  • Data Binding Restrictions
  • Binds to xsd:string or any derived simpleContent
Sample.
…(생략)...
<xforms:model id="mymodel">
 <xforms:instance id="request_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <node1></node1>
  </root>
 </xforms:instance>
 <xforms:instance id="response_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></root>
 </xforms:instance>
</xforms:model>

<body>
 <xforms:textarea model="mymodel" ref="instance('request_01')/node1" style="position:absolute; top:50px; left:38px; height:67px; width:455px; "></xforms:textarea>
</body>
...(생략)...
  • ref attribute를 통해 입력된 데이터가 instance('request_01')/node1에 Single-node Binding.

XForms Tutorial > I-6.2.5. The submit Element

xforms:submit Element
 
유저인터페이스를 제공한다. 일반적으로 HTML인 경우에는 Form 객체의 데이터를 서버로 전송하기 위해서 HTML <input type=”submit”>을 사용 하지만, XForms에서는 submission element를 사용하여 모델의 instance data를 서버로 전송한다. submit element는 submission element와 바인딩 하기 위한 기능을 제공하며, trigger 컨트롤과 차이점 중 하나이다. 다시 말해 trigger element는 submission element에 바이딩을 할 수 없지만 submit element는 submission element에 바인딩이 가능한 것이다.
Common Attributes : Common, UI Common, Single Node Binding(Options)
Special Attributes : submission
  • submission
  • Required reference to element submission
  • submission element의   IDREF를 지정한다.
  • Data Binding Restrictions
  • Binds to any node
  • This form control does not directly interact with form data
  • but is affected by model item properties of the bound node
Sample.
…(생략)...
<xforms:model>
 <xforms:instance>
  <root>
   <query> xforms </query>
  </root>
 </xforms:instance>
 
 <xforms:submission id="naver" replace="all" ref="/" method="get" 
   mediatype="application/xml" 
   action="http://search.naver.com/search.naver" indent="1" 
   separator="&" />
</xforms:model>

</head>

<body>
 <xforms:submit submission="naver"> 
  <xforms:label> 조회 </xforms:label>
 </xforms:submit>
</body>
…(생략)...
  • submission attribute를 통해서 model의 submission과 연결한다.
  • submit element는 submission element를 연결하는 역할을 한다.

XForms Tutorial > I-6.2.4. The trigger Element

이 폼 컨트롤은 HTML의 <input type="button">과 유사한 유저인터페이스를 제공하며, 특정 Action에 따라 다른 컨트롤과 연결하고자 할 경우 많이 사용된다. 예를 들어 trigger 엘리먼트를 클릭하였을 때 서버로 데이터 조회를 요청하라든지, 다른 업무 화면으로 이동하라든지 등 특정 작업을 수행하고자 할 때 사용되는 컨트롤이다.

Common Attributes

  • Common, UI Common, Single Node Binding(Options)
Data Binding Restrictions
  • Binds to any node
  • his form control does not directly interact with form data
  • but is affected by model item properties of the bound node
Sample
…(생략)...
<xforms:model>
 <xforms:instance>
  <root>
   <info>
    <text> 버튼 클릭 </text>
    <hint> 버튼을 클릭하세요. </hint>
   </info>
  </root>
 </xforms:instance>
</xforms:model>


<script for="btn_trigger" event="onclick">
 alert("버튼 클릭");
</script>

</head>

<body>
 <xforms:trigger id="btn_trigger"> 
  <xforms:label ref="info/text" /> 
  <xforms:hint ref="info/hint" />
 </xforms:trigger>
</body>
...(생략)...

XForms Tutorial > I-6.2.3. The secret Element

이 폼 컨트롤은 HTML의 <input type=”password”>와 유사한 유저인터페이스를 제공한다. 사용자의 입력 정보를 Cryptic Character 로 출력하고자 할 때 사용되는 컨트롤로서 일반적으로 비밀번호 같은 입력등에서 많이 사용된다.

Common Attributes

  • Common, UI Common, Single Node Binding
Special Attributes
  • inputmode, incremental
Data Binding Restrictions
  • Identical to input
[Point] W3C Implementation Requirements
  • [Level-A] A KeystrPasses not echoed in xforms:secret
  • Level-A] A Ensure that a cryptic character is echoed as user enters value into secret : 입력된 키 데이터를 그대로 출력하지 않고 비밀을 보장할 수 있는 특정 문자, 예를 들어 ‘*” 와 같은 문자로 출력을 해야 한다는 의미이다.
Sample
…(생략)...
<xforms:model id="mymodel">
 <xforms:instance id="request_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <node1>1234</node1>
  </root>
 </xforms:instance>
 <xforms:instance id="response_01">
  <root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></root>
 </xforms:instance>
</xforms:model>

<body>
 <xforms:secret class="iDigit" model="mymodel" ref="instance('request_01')/node1" maxlength="10" style="position:absolute; top:34px; left:29px; height:24px; width:120px; "></xforms:secret>
</body>
...(생략)...
  • ref attribute를 통해 instance('request_01')/node1의 데이터를 Single-node Binding
  • secret element에 '****' 가 출력된다

XForms Tutorial > I-6.2.2. The output Element

이 폼 컨트롤은 업무 화면에서 표현하고자 하는 데이터가 단순히 보여주는 형식의 텍스트 데이터인 경우 사용되는 컨트롤로서 조회용 업무인 경우 유용하게 사용될 수 있다. 일반적으로 생각하는 Label 엘리먼트와 동일하게 생각될 수 있으나 XForms Additional Elements의 Label과는 다르다. 그 차이점은 output 컨트롤은 컨테이너 엘리먼트 없이 사용될 수 있으나, label 컨트롤은 컨테이너 엘리먼트 없이 일반적으로 사용되지 않는다는 점이다.

Common Attributes

  • Common, Single Node Binding(optional)
Special Attributes
  • appearance, value
value
  • 값을 구하는 XPath 표현이며, 그 결과는 Form Control에 의하여 표현된다
  • XPath Expression에 의하여 Form Control에 반영된다
Data Binding Restrictions
  • Binds to any simpleContent
Sample
…(생략)...
<xforms:model>
 <xforms:instance>
  <root>
   <code>
    <id> 1951614 </id>
    <desc> 에스엠아이티 </desc>
   </code>
  </root>
 </xforms:instance>
</xforms:model>


</head>

<body>
 <xforms:output ref="code/id"> 
  <xforms:label> 코 드: </xforms:label>
 </xforms:output>
 <br/>
 <xforms:output ref="code/desc">  
  <xforms:label> 코드명: </xforms:label>
 </xforms:output> 
</body>
...(생략)...
  • output 컨트롤은 데이터 수정 불가능하며, 단지 inline 데이터 랜더링 역할.
  • ref 바인딩에 따라 코드 : 1951614 와 코드명 : 에스엠아이티를 출력한다.

XForms Tutorial> I-6.2.1. XForms input element

이 폼 컨트롤은 HTML의 INPUT 컨트롤과 유사한 유저인터페이스를 제공한다. 업무용 화면을 구성할 때 가장 많이 사용되는 컨트롤로서 이름, 주소 등의 일반적 데이터 뿐만 아니라 거의 모든 데이터를 취급할 수 있다. XForms에서의 input 컨트롤의 특징은 Binding 되는 Data Type 에 따라 동적으로 컨트롤이 바뀐다는 것이다. 예를 들어 Binding 되는 데이터 타입이 boolean 형이면 checkbox로, 날짜형이면 날짜 형식의 인터페이스를 제공하는 달력 으로 컨트롤이 변경되어야 한다. 이러한 특징은 HTML에서 지정되던 <input type="text"> 등과 같은 지정 방식을 사용하지 않고, 모델 데이터의 데이터 타입을 중심으로 하여 폼 컨트롤 인터페이스를 구성하였기 때문이다.

Common Attributes

  • Common, UI Common, Single Node Binding
Special Attributes
  • inputmode, incremental
Data Binding Restrictions
  • Binds to any simpleContent
  • SimpleContent 란? xsd:base64Binary, xsd:hexBinary 데이터 타입을 제외한 것을 말한다.
  • 거의 모든 Data Type을 Binding 할 수 있으나, 제약 타입이 있다. 대표적인 XML 스키마 데이터 타입으로서 xsd:base64Binary, xsd:hexBinary이 존재한다.
[Point] W3C Implementation Requirements
  • [Level-A] Ensure that setting of attribute incremental is respected as the user types in his message : incremental="true" 이면 값이 변경될 때마다 그 결과가 폼 컨트롤에 반영되어 정의된 다양한 Attribute들이 동작되어야 한다는 것을 의미한다. 예를 들어 값이 변경될 때 마다 Binding 되어 있는 Bind Element 또는 Instance node에 그 결과가 반영되어야 한다는 것을 말하며, 또한Bind Element에 정의되어 있는 다양한 Attribute 들이 동시에 수행되어야 한다는 것이다.
  • [Level-A] Ensure that user can type in valid data : Binding 되어 있는 Instance node의 데이터 타입에 맞게 데이터 정합성을 체크해야 한다는 의미이다. 예를 들어 Binding 되어 있는 Instance node의 데이터 타입이 xsd:integer 라면 정수형 데이터가 아닌 그 이외의 데이터인 경우 체크하여 사용자에게 어떤 방식으로든 메시지를 보여줄 수 있어야 한다는 것이다.
  • [Level-A] Render input bound to boolean type as checkbox if possible : Binding 되어 있는 Instance node의 데이터 타입이 xsd:boolean 일 경우 input형식의 컨트롤이 아니라 checkbox 컨트롤로 변환되어 유저에게 제공될 수 있어야 한다는 것이다.
…(생략)...
 <xforms:model>
  <xforms:instance>
   <root>
    <code>
     <id> 1951614 </id>
     <desc> 에스엠아이티 </desc>
    </code>
   </root>
  </xforms:instance>
 </xforms:model>
 

 </head>
 
 <body>
  <xforms:input ref="code/id"> 
   <xforms:label> 코드 </xforms:label>
  </xforms:input>
 </body>
</html>
  • ref attribute를 통해 인스턴스 code/id의 데이터를 Single-node Binding.
  • input element에 '1951614' 가 출력된다.

XForms Tutorial> I-6.2. The XForms, Form Controls

Form Control에서 사용되는 Attributes는 중복되는 부분이 많음으로 인해 앞에서 정의한 Common, UI Common 등은 별도로 설명을 하지 않고 링크 정보로 연결하겠다. 또한 Special Attributes 중 자주 사용되고 있는 inputmode, incremental 등은 먼저 설명을 하도록 한다.

inputmode Form Controls에서 사용되는 Special Attributes이다. 이 Attributes는 일반적으로 생각하는 한글/영문 입력, 숫자형 입력 등의 기능을 의미하지 않고, Keyboard Configuration과 관련된 기능이다. 예를 들어 cyrillic(키릴문자) 자판 형식으로 키보드 설정을 하고, upperCase 형식의 변환을 하고자 할 때 등에 사용되는 Attribute 이다.

incremental Form Controls에서 사용되는 Special Attributes이다. 이 Attribute Default 속성은 false 이다. 이 속성 값이 true 이면 xforms-value-changed event가 발생할 때 Form Control에 즉각으로 반영되어 특정 작업을 행할 수 있다.

Comment > Navigation Attribute XForms Form Controls Attribute에는 키보드를 통해 Form Control에 접근할 수 있는 Navigation Attributes 를 제공한다. 이를 통해 일반적으로 사용하는 단축키 (alt + key) 기능을 적용할 수 도 있으며, 여러 개의 Form Control이 존재할 경우 이동 순서 (Tab에 따른)를 제어할 수도 있다. 이에 해당하는 Attributes는 accesskey와 navindex 이다

accesskey 단축키 (alt + key) 에 해당하는 기능을 제공한다.

navindex TAB 등 컨트롤 사이의 이동과 관련된 키가 입력되었을 경우 그 이동 순서를 정의한다. 지정할 수 있는 값의 범위는 0 ~ 32767 값 사이이다.

이하 모든 From Controls Element에서 사용되는 예제의 대부분 실행 결과는 NCRM XForms Processor 및 formsPlayer 를 기준으로 하여 작성되었다. 또한 Form Controls element들은 특별히 W3C Test Suite에 요건을 기술했으며, 가능하면 예제도 포함 하였다. 해당 요건의 레벨 표현은 [Level-A]:Must / [Level-AA]:Should / [Level-AAA]:May을 의미한다.

XForms Tutorial > I-6-1. Introduction

HTML을 기반으로 하는 기존의 Form 기술은 지난 10년간 전혀 발전하지 못했다. 그로 인해 다양한 장치들에 작동하는 플랫폼에서 그대로 이용하기에는 그 자체적 한계를 가지고 있으며, 또한 웹 인터페이스를 강화하기 위한 요건 들을 포함하고 있지 못하다. 이러한 인식과 한계에서 1999년 Mozquito.com은 HTML 안에서의 더 나은 웹 양식을 위해 FML(Form Markup Language) 을 발표하게 된다. W3C HTML 워킹그룹은 FML을 기반으로 “XForms” 이라는 이름하에 다음 세대의 웹 Form을 위한 요건 정의를 하게된다. W3C의 XForms는 HTML Form의 문제들을 해결하기 위해 개발된 웹 인터페이스 정의 언어이며, 그 표현을 위한 방법의 하나로 XForms Controls가 위치한다. XForms User Interface Control (Form Control)은 Markup element 들을 사용하여 선언하는 것을 의미하며, Attribute 정의를 통해 그 상세 양식들을 정의할 수 있다.

XForms Form Control Element

Element Attributes Minimal Content Model
input Common, UI Common, Single Node Binding, inputmode (xsd:string), incremental (xsd:boolean) label, (UI Common)*
secret   Common, UI Common, Single Node Binding, inputmode (xsd:string), incremental (xsd:boolean) label, (UI Common)*
textarea   Common, UI Common, Single Node Binding, inputmode (xsd:string), incremental (xsd:boolean) label, (UI Common)*
output     Common, Single Node Binding(optional), appearance ("full"|"compact"|"minimal"|xforms:QNameButNotNCNAME) value (XPathExpression) label?
upload   Common, UI Common, Single Node Binding, mediatype (xsd:string), incremental (xsd:boolean) label,filename?,  mediatype?, (UI Common)*
range   Common, UI Common, Single Node Binding, start (xsd:string), end (xsd:string), step (xsd:string), incremental (xsd:boolean) label, (UI Common)*
trigger Common, UI Common, Single Node Binding (optional) label, (UI Common)*
submit Common, UI Common, Single Node Binding(optional), submission (xsd:IDREF) label, (UI Common)*
select   Common, UI Common, Single Node Binding, selection ("open" | "closed"), incremental (xsd:boolean) label, (List UI Common )+, (UI Common)*
select1   Common, UI Common, Single Node Binding, selection ("open" | "closed"), incremental (xsd:boolean) label, (List UI Common )+, (UI Common)*
choices Common label?, (List UI Common)+
item Common label, value, (UI Common)*
filename Common, Single Node Binding EMPTY
mediatype Common, Single Node Binding EMPTY
value Common, Single Node Binding (optional) (PCDATA|ANY)*
label Common, Single Node Binding (optional), Linking (PCDATA|(UI Inline))*
help Common Single Node Binding (optional), Linking (PCDATA|(UI Inline))*
hint Common, Single Node Binding (optional), Linking (PCDATA|(UI Inline))*
alert Common, Single Node Binding (optional), Linking (PCDATA|(UI Inline))*


위에서 정의되어 있는 XForms Form Control Element 들은 다음과 같은 Content Set 으로 구분하여 정의할 수 있다
Content SetMinimal Content Model
UI Common(help|hint|alert|Action)*
List UI Commonchoices|item|itemset)+
Form Controlsinput|secret|textarea|output|upload|range|trigger|submit|select|select1)*
UI Inline(output)*


appearance: UI Common Attributes를 사용할 수 있는 Element, 예를 들어 input, secret, select 등 에서는 appearance 라는 Optional Attribute를 사용할 수 있다.

Common: XForms Core Attribute Collections의 Common Attributes 설명 참조할 것

UI Common: help | hint | alert | Action으로 구성되어 있는 Content Set을 칭하며, 그 구체적인 내용은 Additional Elements 설명 참조할 것

Single node Binding: XForms Core Attribute Collections의 Single node Binding Attributes 설명 참조할 것

Linking: XForms Core Attribute Collections의 Linking Attributes 설명 참조할 것

XForms Tutorial > I-6. Intro

본 문서는 XForms 1.0 (W3C Recommendation 14 October 2003) 을 기준으로 하여 작성되었으며, 이해를 돕기 위해 필요한 설명들을 추가 하였다. 본 내용의 목차는 다음과 같다.

I-6. The XForms Control
I-6.1. Introduction
I-6.2. The XForms, Form Controls
I-6.2.1. The input Element
I-6.2.2. The output Element
I-6.2.3. The secret Element
I-6.2.4. The trigger Element
I-6.2.5. The submit Element
I-6.2.6. The textarea Element
I-6.2.7. The select Element
I-6.2.8. The select1 Element
I-6.2.9. The range Element
I-6.2.10. The upload Element

XForms Tutorial > I-1.3.7. The extension element

extension element는 XForms 네임스페이스와는 다른 Nmespace로부터 확장된 Elemement를 포함한다. XForms Spec에서는 이러한 Element의 Processing에 대해서는 정의하지 않는다.

Common Attributes

  • Common
<input ref="dataset/user/email" id="email-input">
  <label>Enter your email address</label>
  <extension>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about="#email-input">
        <my:addressBook>personal</my:addressBook>
      </rdf:Description>
    </rdf:RDF>
  </extension>
</input>

XForms Tutorial > I-1.3.6. The XForms Extension Module

Host Language를 XForms에 포함시키는 방법은 많이 있다. 그 중 한 방법은 Validation을 무시하는 단지 Well-Formed Processing을 사용하는 것이다. 다른 방법은 가능한 Element를 미리 정의한 XHTML1.0의 예처럼 엄격한 Validation을 사용하는 것이다. 또 다른 일반적인 방법은 몇 군데에서 사용하는 규제하지 않는 Content를 허가하는 것이다. Host Language 는 이러한 Extension Module을 사용할 수 있다.

XForms Tutorial > I-1.3.5. The XForms MustUnderstand Module

Extension 처럼 Host Language 안에 정의된 Foreign Namespaced element는 Form의 동작에 치명적인 영향을 끼친다. MustUnderstand Module에서는 어떤 Element에서도 사용할 수 있도록 Attribute를 정의한다.

Element Attributes Minimal Content Model
ANY xforms:mustUnderstand (xsd:boolean) n/a
만약 Element에 mustUnderstand=”true” 라고 되어 있으면 유저에게 Terminating Error를 알려준다. 그리고 XForms Processor는 Element를 프로세싱하기 위한 가능성을 가지지 않는다. 사용 예
<vendor:signature ref="/doc/signdata" xforms:mustUnderstand="true">

XForms Tutorial > I-1.3.4. bind element

XForms Model 하위 요소로 구성되어 있는 Bind 엘리먼트는 nodeset attribute의 Model Binding Expression을 통해 인스턴스 노드를 선택하며, 모델 아이템 프로퍼티 어트리뷰트를 통해 각 노드에 그 속성들을 적용하게 된다. 인스턴스 노드를 선택할 수 있는 바인딩 어트리뷰트에는 ref와 bind가 있다. bind 어트리뷰트는 Bind 엘리먼트를 참조하는 어트리뷰트이며, XForms Control 뿐만 아니라 Submission 엘리먼트 등에서 다양하게 사용된다. 바인딩을 위한 어트리뷰트에는 노드를 직접적으로 가리키는 ref와 Bind 엘리먼트를 통해 노드를 선택하는 bind가 있다. 이 두 가지 방법 중 XForms는 bind 어트리뷰트를 권장하고 있다.

Common Attributes

  • Common, Model Item Properties
Special Attributes
  • nodeset : nodes 의 set을 선택하는 Model Binding Expression 이다.(Model Binding Expressions 참조)
참고사항 insert Action에 의해 node가 추가되었을 때는 Binding Expression에 따라 맞는 node-set에 새로 추가된 node가 포함된다. (The insert element) 자세한 것은 Evaluation Context 에 따라 어떻게 Binding될 지 결정한다.

Making a connection – Binding Model Item Properties와 instance data node를 연결하는 것이 Binding이다. bind는 두 끝점이 있는데 한 쪽은 XForms Model이고, 다른 쪽은 Form Control이다. XForms Model내의 bind element에서는 nodeset attribute가 Model Binding Expression을 확보하고, User Interface에서는 UI Binding Expression이 된다. 이 두 끝점은 IDREF나 XPath를 사용하여 bind된다.

with IDREFs 각 Form Control에 bind attribute가 IDREF를 넘겨서, 각 bind element에 id attribute를 두고 Binding을 수행하는 방법이다
<!-- in the XForms Model -->
<xforms:bind nodeset="email" id="mybind" required="true()"/>
...
<!-- later in the document -->
<xforms:input bind="mybind"...>
이런 접근은 Form Control의 bind attribute의 사용에 따라 구분된다. 주요 장점은 Model과 View 사이를 나누어 유지보수를 할 수 있는 것이다. instance data의 structure가 바뀐다 하더라도 bind element의 attribute만 수정 하면 된다. 대형 프로젝트인 경우에는 Form Authoring이 종종 팀 분리에 연루되는데 (그래픽 디자인팀은 폼의 레이아웃을, 시스템 팀은 Data Integration을 다루기 위해) 이런 경우 IDREF Binding은 Presentation과 Content 사이에 완벽한 인터페이스를 제공한다.

with XPath Form Control에서 ref attribute의 XPath Expression 을 사용하여 instance data node에 직접 Binding 하는 방법이다.
<!-- in the XForms Model -->
<xforms:bind nodeset="email" id="mybind" required="true(  )"/>
...
<!-- later in the document -->
<xforms:input ref="email"...>
이 접근은 Form Control에 ref attribute의 사용에 따라 구분된다. 이 방법은 아주 간단한 예에서 많이 보여지며, XPath 표현이 두군데에 있기 때문에 깨지기 쉽다. 만약 Instance data 의 Structure가 바뀌게 된다면, bind element의 attribute와 ref attribute를 바꾸어 주어야 한다

Multiple Model 동일한 Document 내에 여러 Form이 있는 것은 일반적이다. 이러한 경우 Multiple XForms Model을 갖는다.
<!-- in the XForms Model 1 -->
<xform:model id="m1">
  <xforms:bind nodeset="email" type="my:email"/>
  ...
</xforms:model>

<xforms:model id="m2">
  <xforms:bind nodeset="search" type="my:query"/>
  ...
</xforms:model>

<!-- later in the document -->
<xforms:input ref="email" model="m1"...>
<xforms:input ref="search" model="m2"...>
IDREF Binding을 사용할 경우 Document 내에서 Form Control Point ID가 Unique하다면 추가적인 문제가 발생하지 않는다. XPath Binding을 사용할 경우 추가적인 정보가 필요하다. 모든 XPath Binding은 model 이라는 추가적인 attribute를 필요로 한다. 각 XForms Model는 각 독립적인 집합이고, Model 간의 Communication 이 한정되도록 하는 Option이다.

Multiple Instance HTML Form의 Hidden Field처럼 계산등을 위한 추가적인 데이터가 Form에 필요할 수 있다. 그러나, XForms 에서는 Initial Form Data가 광범위하게 배치된 XML이다. 종종 지금 있는 DTD와 XML Schema를 수정할 수 없을 때가 있다. 이럴 경우에 임시 스토리지로 XForms Instance를 추가할 수 있다.
<!-- in the XForms Model -->
<xforms:model>
  <xforms:instance id="formdata">
    <my:root>
      ...
    </my:root>
  </xforms:instance>
  <xforms:instance id="userid" src="scripts/getuserid"/>
  ...
  <xforms:bind nodeset="my:root/..."/>
  <xforms:bind nodeset="instance('userid')/..."/>
  ...
</xforms:model>
Multiple Model에서는 XPath Expression이 기본적으로 처음 Instance를 가리키기 때문에 다음 Instance를 가리킬 수 없다. 그래서 instance element의 IDREF를 참조하는 instance() 함수를 사용하고 다른 Instance의 XPath Context는 reset 된다. (항상 같은 XForms Model안에 있어야 한다.)
...(생략)...

    <xforms:model id="form1">
   <xforms:instance id="instance1">
  <instanceData>
   <p1>1</p1>
   <p2>2</p2>
   <p3>3</p3>
  </instanceData>
   </xforms:instance>
   <xforms:instance id="instance2">
  <instanceData>
   <p4>4</p4>
   <p5>5</p5>
   <p6>6</p6>
  </instanceData>
   </xforms:instance>

 <xforms:bind nodeset="instance('instance2')" id="conn2" />
 <xforms:bind nodeset="instance('instance1')" id="conn1" />

<xforms:submission id="submit01" method="post" 
action="http://xformstest.org/cgi-bin/echo.sh" indent="1" bind="conn1"/>

    </xforms:model>

  ... (생략)...

XForms Tutorial > I-1.3.3. submission element

XForms Model 하위 요소로 구성되어 있는 Submission 엘리먼트는 인스턴스 데이터를 실제 서버로 전송하는 역할을 한다. 이 엘리먼트는 HTML 폼 컬렉션 객체의 데이터를 서브밋하는 HTML Submit 컨트롤과 같은 역할을 한다. 차이점은 폼 객체의 데이터를 서브밋 하는 것이 아니라 인스턴스 데이터를 서브밋 하는 것과 그 응답 결과를 특정 인스턴스로 매핑하거나 페이지 자체를 업데이트 할 수 있는 기능이 있다는 점이다. 또한 서브밋시 여러가지 어트리뷰트를 통해서 다양한 기능을 옵션으로 제공한다. Submission 엘리먼트는 모델 하위에 여러 개가 존재할 수 있으며 그에 따라 하나의 인스턴스 데이터를 여러 개의 서버로 동시에 보낼 수 있다. 실제 이 Submission 엘리먼트를 호출하는 엘리먼트는XForms:Submit 객체이다.

Common Attributes

  • Common
Special Attributes
  • bind : bind element를 참조하며, ref attribute 보다 우선한다
  • ref : instance data를 Binding Expression을 통해 선택할 수 있다. 선택된 node와 모든 자손이 submit 된다. default = “/”
  • action : 표현된 URI에 instance Data를 submit 한다
  • method : 필수 attribute. serialized instance Data 전송 protocol을 표시한다. (default : 없음) get, put, post, form-data-post, urlencoded-post 등이 값으로 올 수 있다.
  • version : application/xml serialization 에서만 적용가능하고, XML 선언에 각 버전정보를 삽입하도록 XML serializer에게 알려준다
  • indent : application/xml serialization 에서만 적용가능하고, 가독성을 위해서 공백을 추가하도록 XML serializer에게 알려준다 (visually formatted XML). 가능한 값은 Boolean 이다
  • mediatype : serialized instance data와 연결될 internet media type을 선택한다. application/xml type과 호환하여야 하며, default이다.
  • encoding : application/xml serialization 에서만 적용가능하고, serialization을 위한 encoding을 표시한다
  • omit-xml-declaration : application/xml serialization 에서만 적용가능하고, serialized instance data에서 XML 선언이 포함되지 않도록 한다
  • standalone : application/xml serialization 에서만 적용가능하고, standalone선언이 XML 선언이 포함되도록 XML serializer에게 알려준다
  • cdata-section-elements : application/xml serialization 에서만 적용가능하고, element name을 space로 구분된 리스트로 CDATA section의 text content로 출력하도록 XML serializer에게 알려준다
  • replace : submission action으로부터 리턴된 response document 를 적용할 정보를 나타낸다. 가능한 값으로는 all, instance, none이 있고 all 이 default 이다
  • separator : urlencoding된 name/value 쌍 사이에 구분자를 적용시킨다. 가능한 값으로는 &, ; 이 있고 ; default이다
  • includenamespaceprefixes : application/xml serialization에서만 적용가능하고, instance date에 있는 모든 namespace node들 serialization에 포함한다. 가능한 값은 boolean 이다
참고사항 : CDATA , CDATA절 (character data)? 일반적으로 텍스트나 공백, 사람에게 의미 있는 정보를 제공하는 여러가지 형태의 컨텐츠를 표현하는데 이용되며, Attribute의 가장 일반적인 타입이라 할 수 있다. (즉, value 같은 것) 그와는 다른 Attribute 타입으로는 ID와 IDREF가 있는데, ID Attributes는 마치 database table의 primary key와 유사한 역할을 하고, IDREF에 의해 참조가능하다 참고사항 : XForms 1.1 XForms 1.0은 Input / Output 을 위해 Instance를 분리할 수 없었으나, XForms 1.1 에서 부터는 Request를 위한 Instance와 Response을 위한 Instance를 분리하는 방법이 Draft 문서에 추가 되었다. Output을 위한 instance를 분리하고자 할 때 사용되는 Attribute는 instance 이다.

Sample
…(생략)…
<xforms:model id="model1">
 <xforms:instance id="realData">
 <root>
  <human>
   <userid></userid>
   <username />
   <tax>
    <taxsource>0</taxsource>
   <taxbill>0</taxbill>
    <taxpermonth during="2"></taxpermonth>
   </tax>
  </human>
 </root>
</xforms:instance>
<xforms:submission replace="instance" id="submit01" method="get" mediatype="application/xml" action="http://smit21.co.kr/test.jsp" indent="1" separator="&" bind="realDataBind"/>
…(생략)…