XForms allow programmers to gather information from those who visit websites using XML. The purpose of any Internet form is to collect data. XForms use XML to define the data requested and store the input after submission. True to most XML processes, XForm separates the data from the design of the form. The segregation of design and information storage is one of the perks of creating XML documents. XForms applies this core principle to user interfaces and dynamic web pages.
XForm uses static elements to create a template for the form and provide submission information to the processor. The compilation of these elements is the XForm model. The model defines the form, explains what data should be collected and how to submit it. Creating a model gives the browser a source format for the user interface. As with an HTML form, you must also provide submission instructions that tell the browser what to do with the information once it is entered into the form.
Like many subsets of XML, XForms requires a fixed root element and namespace declaration. XForms is a W3C recommendation and relies on a URI to declare the namespace. The namespace for XForms is xmlns:xf= "http://www.w3.org/2002/xforms.
By itself, the XForms model does nothing. Along with the model, a programmer must supply formatting and display instructions, so the webpage viewer sees a user interchange on the page and not just random text.
XForm follows the same basic syntax rules of all XML languages, but is more complex than just creating a storage container for data. In order to learn to write XForms, you should be familiar with XML, HTML, HTML forms and XHTML. An understanding of namespaces and the XPath language will help you master the format and write XML driven forms for your website.