XForms Tutorial > I-1.2.3. Single-Node Binding Attributes
Form Control또는 Action Module과 XPath에 의해 정의된 instance data node 간에 Binding 방법을 정의하는 속성을 말한다. 일반적으로 모델에 instance data를 정의한 후 화면의 컨트롤과 연결을 하고자 할 경우 사용되며, 그 방법은 다음 그림과 같이 크게 두 가지가 있다.
Attribute
Comment
First-node rule Single-node Binding Attribute 값으로 size가 1보다 큰 node-set을 선택한 경우에는 도큐먼트 순서에 따라 node-set의 첫 번째 node가 선택된다
Sample> Ref를 통한 Single-Node Binding
<?xml version="1.0" encoding="euc-kr"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title> Single-Node Binding </title>
<xforms:model id="mymodel">
<xforms:instance id="instRQ">
<root xmlns="">
<code> 217531 </code>
</root>
</xforms:instance>
</xforms:model>
</head>
<body>
<xforms:input ref="code">
<xforms:label> 코드 </xforms:label>
</xforms:input>
</body>
</html>Sample> Bind를 통한 Single-Node Binding
<?xml version="1.0" encoding="euc-kr"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title> Single-Node Binding </title>
<xforms:model id="mymodel">
<xforms:instance id="instRQ">
<root xmlns="">
<code> 217531 </code>
</root>
</xforms:instance>
</xforms:model>
<xforms:bind id="bind_code" nodeset="code" />
</head>
<body>
<xforms:input bind="bind_code" ref=”code”>
<xforms:label> 코드 </xforms:label>
</xforms:input>
</body>
</html>
댓글 없음:
댓글 쓰기