[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Challenge
Here are some random comments: -----Original Message----- From: Mark Seaborne [mailto:m_seaborne@m...] Sent: Thursday, November 06, 2003 12:17 PM To: Didier PH Martin; xml-dev@l... Subject: Re: Challenge On 6/11/03 18:43, "Didier PH Martin" <martind@n...> wrote: Hi Didier, <!-- snip --> > By the way, I may be wrong but in the XForms example you provided could the > binding be as follows: > <xforms:model> > <xforms:submission id="submit" > xforms:replace="all" > xforms:action="http://mydomain.com/MyStorage" > xforms:method="PUT"/> > <xforms:instance id="theChallenge"> > <demo xmlns=""> > <version/> > <author> > <name/> > <email/> > </author> > <description/> > </demo> > </xforms:instance> > <xforms:bind id="version" nodeset="//version" constraint=". = '1.0'"/> > <xforms:bind id="name" nodeset="//author/name"/> > <xforms:bind id="email" nodeset="//author/email"/> > <xforms:bind id="description" nodeset="//description"/> > </xforms:model> Why use //description, etc rather than /demo/description? Actually, since XForms sets the XPath context node to be the document element, you can jus tsay <xforms:bind id="version" nodeset="version" constraint=". = '1.0'"/> <xforms:bind id="name" nodeset="author/name"/> <xforms:bind id="email" nodeset="author/email"/> <xforms:bind id="description" nodeset="description"/> <!-- snip --> > I can write this whole XForms definition differently as follow: > <xforms:model> > <xforms:submission id="submit" > xforms:replace="all" > xforms:action="http://mydomain.com/MyStorage" > xforms:method="PUT"/> Since XML doesn't use prefixes on attributes that match the namespace of the element, replace="all" is the default, and the methods are required to be lowercase, (at the request of the HTML WG since all their elements and attributes and attribute value are lowercase), it would be like this: <xforms:submission id="submit" action="http://mydomain.com/MyStorage" method="put"/> > <xforms:instance src="http://myDomain.com/theChallenge.xml" /> > ..... > ..... > <input ref="//version" type="text" name="version" size="20"/> More or less, yes. The XML instance you are populating can be referenced, which is clearly a good, if not essential thing, and you can use ref on form controls to "bind" directly to the instance using an XPath 1.0 expression. Indirection via a bind element is quite a nice feature though. Actually it would be <xforms:input ref="version"><xforms:label>Version</xforms:label></xforms:input> Note that the context node being "/data" means that you can just use the ref to ne the immediate child name of the toplevel element, so it looks a lot like what XHTML 1 does with <input name="version"/>. In fact, if you omit the <instance> from a model entirely, XForms will notice that and make one up for you populated by elements with names taken from the form controls bound to the model. It's a good transition step from XHTML 1 to XHTML 2 or other XForms host languages. All the best Mark > Cheers > Didier PH Martin > http://didier-martin.com > > > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> > ----------------------------------------------------------------- The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative of OASIS <http://www.oasis-open.org> The list archives are at http://lists.xml.org/archives/xml-dev/ To subscribe or unsubscribe from this list use the subscription manager: <http://lists.xml.org/ob/adm.pl>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|