You'll find it easier to create new forms if you have an empty template that you can start with. Many XML editors will allow you to place such a template in a special folder so that it is available as a choice whenever you create a new XML document.
The template that follows is an HTML document that contain XForms; even if you plan to use XForms in some other language--and XForms was designed to make that possible--we would still recommend beginners to get acquainted with XForms within HTML.
To create the template:
<?xml version="1.0" encoding="utf-8"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<head>
<script src="http://lib-xh.googlecode.com/svn/trunk/xH.js" type="text/javascript">/**/</script>
<title>Empty XForm</title>
</head>
<body>
<p>Empty XForm</p>
</body>
</html>xforms-template.html.As you can see the document is much the same as an ordinary HTML page, with the following differences:
<?xml version="1.0" encoding="utf-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <head>
We don't always need XML Events and XML Schema, but since this is meant to be a template that you can just use without thinking about it, we might as well add them here.
<script src="http://lib-xh.googlecode.com/svn/trunk/xH.js" type="text/javascript">/**/</script>
This script checks for XForms support on the browser that your users have used to load your form. If formsPlayer is present, that is used, and similarly if the Firefox XForms extension is available, that will be used. The script will also automatically install formsPlayer if the user is running Internet Explorer, and no version of formsPlayer is present.