Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 40895 invoked from network); 18 Nov 2005 04:30:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 04:30:46 -0000 Received: (qmail 42092 invoked by uid 500); 18 Nov 2005 04:24:27 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 31665 invoked by uid 500); 18 Nov 2005 04:21:32 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 23498 invoked by uid 99); 18 Nov 2005 04:20:07 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Nov 2005 20:17:19 -0800 Received: (qmail 8407 invoked by uid 65534); 18 Nov 2005 04:16:00 -0000 Message-ID: <20051118041600.8406.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r345438 [275/286] - in /cocoon/site/site/2.1: ./ developing/ developing/portal/ developing/portal/coplets/ developing/webapps/ developing/webapps/authentication/ faq/ howto/ installing/ plan/ plan/documentation/ plan/otherplanning/ plan/ove... Date: Fri, 18 Nov 2005 04:13:22 -0000 To: cvs@cocoon.apache.org From: crossley@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: cocoon/site/site/2.1/userdocs/xmlbinding.html URL: http://svn.apache.org/viewcvs/cocoon/site/site/2.1/userdocs/xmlbinding.html?rev=345438&view=auto ============================================================================== --- cocoon/site/site/2.1/userdocs/xmlbinding.html (added) +++ cocoon/site/site/2.1/userdocs/xmlbinding.html Thu Nov 17 20:00:02 2005 @@ -0,0 +1,1288 @@ + + + + + + + +Simple XML Binding + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + +
+
+
+
+ +
+ + +
+ +
+ +   +
+ + + + + +
+

Simple XML Binding

+ +

Concept

+
+

As an alternative for the more flexible binding +framework, there is also a simpler solution when that can be used when there +is a 1-to-1 coupling between the XML and the form.

+

The XML format is such that there is one XML element for each widget and the +element gets the widget id as name. Exceptions from this is that the elements in +a repeater get the name "item" and an attribute +"position" with the position of the repeater child, instead of just a number +(which is not allowed as element name). Childs of a +MultiValueField are also embeded within an "item" +element. If the Form widget does not have an id it get the name "unknown".

+

An AggregateField can both be interpreted as one value and as several +widgets. This ambiguity is resolved by chosing to emit the single value rather +than the fields as XML. For population of the form both forms are however +allowed.

+
+ +

Usage

+
+

The simple XML binding is implemented by the following class:

+
org.apache.cocoon.forms.util.XMLAdapter
+
+

To load XML, you simply construct an XMLAdapter with a form instance as +argument to the constructor. You can then load XML into the form simply by using +the XMLAdapter as a ContentHandler for the XML parser, and save the XML by using +the toSAX method on the XMLAdapter object.

+

In the flowscript CForm API, the form object has a getXML() method +that returns an XMLAdapter instance. But more simply, there are also +form.loadXML(uri) and form.saveXML(uri) methods.

+ +
+
+ +
 
+
+ + + Propchange: cocoon/site/site/2.1/userdocs/xmlbinding.html ------------------------------------------------------------------------------ svn:eol-style = native