You are on page 1of 52

POWER GRID CORPORATION OF INDIA LIMITED

(A GOVERNMENT OF INDIA ENTERPRISE)

SUMMER TRAINING REPORT


ON
XFORMS THROUGH OPEN OFFICE
INFORMATION TECHNOLOGY DEPARTMENT
POWER GRID CORPORATE CENTRE, GURGAON
UNDER GUIDANCE OF
Mr. Anand Shankar
DGM, IT DEPARTMENT, POWER GRID CORPORATE CENTRE

SUBMITTED BY
ANKIT GOEL
ROLL NO. 0709110011

JSS ACADEMY OF TECHNICAL EDUCATION, NOIDA

Page3

BTECH COMPUTER SCIENCE & ENGINEERING

DECLARATION

I hereby declare that the work which is being presented in the Summer Training
Report titled

XFORMS THROUGH OPEN OFFICE

in partial fulfillment of the requirements of my III Year Industrial Training during the
degree of Bachelor Of Technology in Computer Science &Engineering submitted
at Power Grid Corporate Centre Gurgaon is an authentic record of our own work
carried out under the able guidance of Mr. Anand Shankar .

The work has been carried out at Information Technology Department, Power Grid
Corporate Centre Gurgaon and has not been submitted for any other degree or
diploma. This is to certify that the above declaration is correct to the best of our
knowledge.

Ankit Goel
Roll No. 0709110011
Btech Computer Science & Engineering

Page3

JSSATE, Noida

ACKNOWLEDGEMENT

With due respect, I express my deep sense of gratitude to my respected and learned guide
Mr. Anand Shankar for his valuable guidance and untiring supervision. I am thankful to him for his constant
encouragement, suggestions and constructive criticism at all stages of summer training.
I am heartly thankful to all the staff members of Power Grid Corporate Centre, Muzaffarpur for
their kind cooperation.
Last but not the least I would like to express my deep appreciation towards my family members and
friends for providing me the much needed support and encouragement.

Md. Sabir Nezam


Roll No. 110985280141

Page3

B-Tech Electrical Engineering

TABLE OF CONTENTS
S.
PAGE No.

No.

1.
1

PREFACE

2.
2

POWER GRID CORPORATION OF INDIA LIMITED

AIM OF THE TRAINING

4.
5

SOFTWARE REQUIREMENTS

5.
7

INTRODUCING XML

6.
11

XPATH

7.
12

XSLT

8.
13

XML SCHEMA DESIGN

9.
17

INTRODUCING XFORMS

10.

ODF

TOPIC

26
XFORMS AND XPATH IN OPENOFFICE.ORG

12.
40

MAPPING XML DATA TO SQL DATABASE

13.

CONCLUSION

14.
43

REFERENCES

15.

ANNEXURE

42

44
Page3

11.
27

1. PREFACE

This report has been prepared to serve the purpose of documentation for the work I
have carried out during my industrial training at Power Grid Corporate Centre
Gurgaon .Through this report I would like to share the step by step procedure I followed
to learn the building blocks for developing general pupose forms using OpenOffice. The
focus of the trainining was realizing the power of XML .It all began from writing simple
XML instance and its definition in the form of DTD, XML schema for validation rules,
designing Xforms and its binding with XML schema with a purpose of receiving valid
input data, generating XML and transferring its data to a database in Microsoft Access. I
have tried to cover all above mentioned purposes with the help of simple examples. I
hope this report will be beneficial to its readers.
With Regards

Ankit Goel

Page3

15-07-2010

2.

POWER GRID CORPORATION OF INDIA LIMITED

Power Grid Corporation of India Limited (PGCIL), a Navratna Public Sector Enterprise, is
one of the largest transmission utilities in the world. Power Grid wheels about 45% of the total
power generated in India on its transmission network. Power Grid has a pan India presence with
around 71,500 Circuit-km of Transmission network and 120 nos. of EHVAC & HVDC sub-stations
with a total transformation capacity of 79,500 MVA. Power Grid has also diversified into Telecom
business and established a telecom network of more than 20,000 km across the country. Power
Grid has consistently maintained the transmission system availability over 99.00% which is at
par with the International Utilities.
The Present Board of Directors are as following:
Mr. S.K.Chaturvedi, Chairman & Managing Director
Mr. I.S.Jha, Director(Projects)
Mr. J.Sridharan, Director(Finance)
Mr. R.N.Nayak, Director(Operations)
Mr. V.M.Kaul, Director(Personnel)
The Corporate Centre of POWERGRID is at Saudamini, Plot No.2, Sector 29, Near IFFCO Chowk,
Gurgaon (Haryana) - 122001, INDIA.
Registered Office: B-9, Qutab Institutional Area, Katwaria Sarai, New Delhi-110016 EPABX :
011-26560112, 26560115, 26560193, 26564892

five Regional Load Despatch Centres as below:

Eastern Region Load Despatch Centre, Kolkatta


North Eastern Region Load Despatch Centre, Shillong

Page3

POWERGRID has enhanced the inter-regional capacity of National Grid to 18,700 MW.India is
divided into 5 Regions - Northern Region(NR),Eastern Region(ER),Western Region(WR),Southern
Region(SR) North East Region(NER). Out of all these Regions the NR, ER, WR and NER is
synchronized which is known as NEW Grid. Whereas SR is not synchronized with the rest of the
regions with AC lines and hence runs on a slightly different Frequency. SR is connected with WR
and ER with HVDC links only. When PGCIL was formed then the responsibility of Regional Load
Despatch Centres (RLDCs) was handed over to POWERGRID by Central Electricity Authority
(CEA). On 25th February, 2009 the National Load Despatch Center (NLDC) was inaugurated.
Now these Regional Load Despatch Centres (RLDCs) and National Load Despatch
Center (NLDC) is a separate Organisation named POSOCO (Power system Operation
Corporation), a 100% owned subsidiary of POWERGRID.
Grid Management is carried out through a hierarchial control philoshophy using Supervisory
Control and Data Acquisition (SCADA). National Load Despatch Centre (NLDC) at Delhi and

Northern Region Load Despatch Centre, New Delhi

Southern Region Load Despatch Centre, Bangaluru

Western Region Load Despatch Centre, Mumbai

The Business of POWERGRID comes from the following activities:


1) Transmission (which includes Grid Management,Construction,Operation and Maintenance of
Transmission lines and Sub-stations)
2) Telecom (handled by a separate department of POWERGRID known as Telecom Deptt. or
POWERTEL).
3) Consultancy

The mission of the corporation is establishment and operation of regional and national power
grids to facilitate transfer of electric power within and across the regions with reliability, security
and economy, on sound commercial principles.
Power Grid is committed to:
a)Establish and maintain an efficient and effective "national grid " with due regard to time, cost,
technology, and value additions.
b)Sustainable development through conservation of natural resources and adopting
environment friendly technology on principle of avoidance,minimization and mitigation
c)Ensure safe,occupational hazard free and healthy work environment ,to the satisfaction of
stake holders in all areas of its activities and shall endeavor to continually improve its
management systems and practices in conformity to legal and regulatory provisions.

POWERGRIDs Telecom Business


With the vision to bridge the digital divide in the country and ensure that benefits of information
revolution reach the entire length and breadth of the country, POWERGRID has diversified into
Telecom utilizing right of way on its Extra High Voltage Power Transmission Network
infrastructure in the country with its brand name as POWERTEL. Among the telecom players,
POWERGRID is the only utility in the country having overhead optic fibre network using OPGW
(Optical Ground Wire) on power transmission lines. POWERGRID has an all India Broad Band
Telecom Network of about 21,652 Kms with multiple self resilient rings for backbone as well as
intra city access networks connecting more than 110 cities across the country and ensuring a
reliability of more than 99.5%. POWERGRID has following Telecom Licenses:

Infrastructure Provider Category - I (IP-I license)


NLD License for providing end-to-end bandwidth

ISP category A license to provide internet services in the country.

E1/E3/DS3/STM1/STM4/STM16 Leased Line


Ethernet Private Leased Line

Multi-site LAN Interconnect plus Internet Access

Page3

Services Provided On POWERGRIDs Network:


The Network deploys 32 wavelength DWDM system , scalable to 128 wavelength system,
connecting all the metros and remote locations in North East and Jammu & Kashmir. The
balance network deploys SDH (STM 16/STM 4) systems. The following services are available on
POWERGRIDs network:

Internet bandwidth

Unique Features Of POWERGRIDs Telecom Network


Most of the POWERGRIDs optic fibre backbone network is laid overhead on the extra high
voltage Power transmission lines .The Telecom network on the Transmission lines has proved to
be sturdy and secure, rodent menace free, vandalism proof which offers it distinct advantage
over the underground optic fibre. The other advantages of leasing bandwidth capacity on
POWERGRIDs Telecom route are:
Instant bandwidth allocation on POWERGRIDs Telecom route
End to end connectivity

Instant upgradation to higher capacity

Better Service Level

Services catering to the specific needs of the customers

High reliability, high quality service in a cost effective manner

3. AIM OF THE TRAINING

Page3

To learn the basics of XML and XForms and creating a simple application
using Xforms in OpenOffice , which validates the input data at the client
side and generates its XML instance, which can be used to transport data
and store data in a database.

4.

SOFTWARE REQUIREMENTS

1. Mozilla Firefox version 3.6.6 with Mozilla Xforms 0.8.7 Extension


2. OpenOffice.org 3.2.1
3. Microsoft Access 2007

Page3

4. Microsoft Windows 7 Ultimate

5.

INTRODUCING XML

XML stands for EXtensible Markup Language


XML is a markup language much like HTML

XML was designed to carry data, not to display data

XML tags are not predefined. You must define your own tags

XML is designed to be self-descriptive

XML is a W3C Recommendation

XML is not a replacement for HTML.XML and HTML were designed with different goals:

XML was designed to transport and store data, with focus on what data is

HTML was designed to display data, with focus on how data looks

XML Separates Data from HTML


If we need to display dynamic data in our HTML document, it will take a lot of work to edit the
HTML each time the data changes. With XML, data can be stored in separate XML files. This way
we can concentrate on using HTML for layout and display, and be sure that changes in the
underlying data will not require any changes to the HTML.
XML Simplifies Data Sharing
In the real world, computer systems and databases contain data in incompatible formats.XML
data is stored in plain text format. This provides a software- and hardware-independent way of
storing data.This makes it much easier to create data that can be shared by different
applications.

XML Simplifies Platform Changes


Upgrading to new systems (hardware or software platforms), is always time consuming. Large
amounts of data must be converted and incompatible data is often lost.XML data is stored in
text format. This makes it easier to expand or upgrade to new operating systems, new
applications, or new browsers, without losing data.

Page3

XML Simplifies Data Transport


One of the most time-consuming challenges for developers is to exchange data between
incompatible systems over the Internet.Exchanging data as XML greatly reduces this
complexity, since the data can be read by different incompatible applications.

XML Makes our Data More Available


Different applications can access our data, not only in HTML pages, but also from XML data
sources.
With XML, our data can be available to all kinds of "reading machines" (Handheld computers,
voice machines, news feeds, etc), and make it more available for blind people, or people with
other disabilities.
XML is Used to Create New Internet Languages
A lot of new Internet languages are created with XML.
Here are some examples:
XHTML
WSDL for describing available web services

WAP and WML as markup languages for handheld devices

RSS languages for news feeds

RDF and OWL for describing resources and ontology

SMIL for describing multimedia for the web

An Example XML Document


<?xml version="1.0" encoding="ISO-8859-1"?>
<name>
<fname> Ankit</fname>
<lname>Goel</lname>
</name>
The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (ISO8859-1 = Latin-1/West European character set). The next line describes the root element of
the document.
<name>
The next 2 lines describe 2 child elements of the root (fname, lname):
<fname> Ankit</fname>
<lname>Goel</lname>
And finally the last line defines the end of the root element:
</name>

XML documents must contain a root element. This element is "the parent" of all other
elements.
The elements in an XML document form a document tree. The tree starts at the root and
branches to the lowest level of the tree.
All elements can have sub elements (child elements):
<root>
<child>
<subchild>.....</subchild>

Page3

XML Documents Form a Tree Structure

</child>
</root>
The terms parent, child, and sibling are used to describe the relationships between elements.
Parent elements have children. Children on the same level are called siblings (brothers or
sisters).
All elements can have text content and attributes (just like in HTML).

Example:

The image above represents one book in the XML below:


<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>

The root element in the example is <bookstore>. All <book> elements in the document are
contained within <bookstore>.
The <book> element has 4 children: <title>,< author>, <year>, <price>.
<?xml version="1.0" encoding="UTF-8"?> <!-- This is a comment -->
<persons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- namespaces -->

Page3

Example 2:

<person id="1" gender="f">


<fname>Dorothy</fname>
<mname/>
<!Element can be empty -->
<lname>Chouhan</lname>
<dob>1990-03-23</dob>
<mobileno>98987565790</mobileno>
<placeofbirth state="MadhyaPradesh">
<city>Indore</city>
</placeofbirth>
<pan>AJSJG7565K</pan>
</person><person id="2" gender="f"> <!id and gender are attributes of element person -->
<fname>Ankita</fname>
<mname/>
<lname>Pant</lname>
<dob>1989-09-20</dob>
<mobileno>9894565657565</mobileno>
<placeofbirth state="UttarPradesh">
<city>Bareilly</city>
</placeofbirth>
<pan>AJSJG7565K</pan>
</person>

XML elements can have attributes, just like HTML.


Attributes provide additional information about an element. Attribute values must always be
quoted.

XML Validation
Well Formed XML Documents
A "Well Formed" XML document has correct XML syntax.
XML documents must have a root element.
XML elements must have a closing tag.
XML tags are case sensitive.
XML elements must be properly nested.
XML attribute values must be quoted.

A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a
Document Type Definition (DTD). The purpose of a DTD is to define the structure of an XML
document. It defines the structure with a list of legal elements and attributes.
For example :
Pers.dtd
<!DOCTYPE personal_details
[
<!ELEMENT persons (person+)>
<!ELEMENT person (name,dob,mobileno,placeofbirth,pan)>
<!ATTLIST person id ID #REQUIRED>
<!ATTLIST person gender (male|female) "male">
<!ELEMENT name (fname, mname?, lname)>
<!ELEMENT fname (#PCDATA)>
<!ELEMENT mname (#PCDATA)>

Page3

Valid XML Documents

<!ELEMENT lname (#PCDATA)>


<!ELEMENT dob (#PCDATA)>
<!ELEMENT mobileno (#PCDATA)>
<!ELEMENT placeofbirth (city, state)>
<!ELEMENT city (#PCDATA)>
<!ATTLIST placeofbirth state (AndhraPradesh|ArunacahalPradesh|Assam|Bihar|
Chattisgarh|Goa|Gujrat|Haryana|HimachalPradesh|JammuandKashmir|Jharkhand|
Karnataka|Kerala|MadhyaPradesh|Maharashtra|Manipur|Meghalaya|Mizoram|Nagaland|
Orissa|Punjab|Rajasthan|Sikkim|TamilNadu|Tripura|Uttaranchal|UttarPradesh|
WestBengal) "AndhraPradesh">
<!ELEMENT pan (#PCDATA)>
]>

A DTD can be declared inline inside an XML document, or as an external reference.


Internal DTD Declaration
If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE definition with the
following syntax:
<!DOCTYPE root-element [element-declarations]>
Example XML document with an internal DTD:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE name [
<!ELEMENT name(fname,lname)>
<!ELEMENT fname(#PCDATA)>
<!ELEMENT lname(#PCDATA)>
]>
<name>
<fname> Sadhna</fname>
<lname>Gautam</lname>
</name>

The DTD above is interpreted like this:


!DOCTYPE name defines that the root element of this document is note
!ELEMENT name defines that the note element contains two elements: "fname, lname"
!ELEMENT fname defines the to element to be of type "#PCDATA"
!ELEMENT lname defines the from element to be of type "#PCDATA"
If the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the
following syntax:

Page3

External DTD Declaration

<!DOCTYPE root-element SYSTEM "filename">


Example XML document with an external DTD:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE name SYSTEM "name.dtd">


<name>
<fname> Ankit</fname>
<lname>Goel</lname>
</name>

PCDATA
PCDATA means parsed character data.
Think of character data as the text found between the start tag and the end tag of an XML
element.
PCDATA is text that WILL be parsed by a parser. The text will be examined by the
parser for entities and markup.
CDATA
CDATA means character data.
CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated
as markup and entities will not be expanded.
W3C supports an XML-based alternative to DTD, called XML Schema.We will study XML Schema
in the following chapters.

XPath is a syntax for defining parts of an XML document


XPath uses path expressions to navigate in XML documents

XPath contains a library of standard functions

XPath is a major element in XSLT

XPath is a W3C recommendation

XPath uses path expressions to select nodes in an XML document. The node is selected by
following a path or steps. The most useful path expressions are listed below:
Expression
Description
nodename
Selects all child nodes of the named node
/
Selects from the root node
//
Selects nodes in the document from the current node that match the
selection no matter where they are
.
Selects the current node
..
Selects the parent of the current node
@
Selects attributes
Note: If the path starts with a slash ( / ) it always represents an absolute path to an element!

Page3

6. XPATH

XPath wildcards can be used to select unknown XML elements.


Wildcard
Description
*
Matches any element node
@*
Matches any attribute node
node()
Matches any node of any kind
EXAMPLE:
<persons>
<person id=1>
<fname>Ankit</fname>
<lname>Goel</lname>
</person>
<person id=2>
<fname>Atul</fname>
<lname>Sahani</lname>
</person>
</persons>

Path Expression
persons
/persons
persons/person
//person
persons//person
//@id

Result
Selects all the child nodes of the persons element
Selects the root element persons
Selects all person elements that are children of persons
Selects all person elements no matter where they are in the document
Selects all person elements that are descendant of the persons element, no
matter where they are under the person element
Selects all attributes that are named id

7. XSLT
XSL stands for EXtensible Stylesheet Language.
XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.
With XSLT we can transform an XML document into HTML.
XSLT is the recommended style sheet language of XML.
XSLT can be used to transform XML into HTML, before it is displayed by a browser.
XSL consists of three parts:
XSLT - a language for transforming XML documents
XPath - a language for navigating in XML documents
XSL-FO - a language for formatting XML documents
For Example

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Personal Details </h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>NAME</th>

Page3

finalstyle.xsl

<th>GENDER</th>
<th>DATE OF BIRTH</th>
<th>PLACE OF BIRTH</th>
<th>MOBILE NO</th>
<th>PAN</th>
</tr>
<xsl:for-each select="person">
<tr>
<td><xsl:value-of select="fname"/> &#160;<xsl:value-of
select="mname"/>
&#160; <xsl:value-of select="lname"/></td>
<td><xsl:value-of select="@gender"/></td>
<td><xsl:value-of select="dob"/></td>
<td><xsl:value-of select="placeofbirth/city"/> &#160; <xsl:value-of
select="placeofbirth/@state"/> </td>
<td><xsl:value-of select="mobileno"/></td>
<td><xsl:value-of select="pan"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

8.

XML SCHEMA DESIGN

The XML Schema language is also referred to as XML Schema Definition (XSD).
What is an XML Schema?
The purpose of an XML Schema is to define the legal building blocks of an XML document, just
like a DTD.
An XML Schema:
defines elements that can appear in a document
defines attributes that can appear in a document
defines which elements are child elements
defines the order of child elements
defines the number of child elements
defines whether an element is empty or can include text
defines data types for elements and attributes
defines default and fixed values for elements and attributes

XML Schemas Support Data Types


One of the greatest strength of XML Schemas is the support for data types.

Page3

XML Schemas are the Successors of DTDs


XML Schemas are extensible to future additions
XML Schemas are richer and more powerful than DTDs
XML Schemas are written in XML
XML Schemas support data types
XML Schemas support namespaces

With support for data types:


It is easier to describe allowable document content
It is easier to validate the correctness of data
It is easier to work with data from a database
It is easier to define data facets (restrictions on data)
It is easier to define data patterns (data formats)
It is easier to convert data between different data types
Defining a Simple Element
The syntax for defining a simple element is:
<xs:element name="xxx" type="yyy"/>
where xxx is the name of the element and yyy is the data type of the element.
XML Schema has a lot of built-in data types. The most common types are:
xs:string
xs:decimal
xs:integer
xs:boolean
xs:date
xs:time

Example
Here are some XML elements:
<firstname>Goel</firstname>
<age>19</age>
<dateborn>1990-09-17</dateborn>

Simple elements may have a default value OR a fixed value specified.


A default value is automatically assigned to the element when no other value is specified.
In the following example the default value is "red":
<xs:element name="color" type="xs:string" default="red"/>
A fixed value is also automatically assigned to the element, and you cannot specify another
value.
In the following example the fixed value is "red":
<xs:element name="color" type="xs:string" fixed="red"/>
The syntax for defining an attribute is:

Page3

XML schema design for above XML instance


<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person">
<xs:sequence>
<xs:element name="name"/>
<xs:element name=age" type=xs:integer"/>
<xs:element name=dateborn" type="xs:date"/>
</xs:sequence>
<xs:attribute name=id" type=xs:ID use=required/>
</xs:schema>

<xs:attribute name="xxx" type="yyy"/>


To specify that the attribute is required, use the "use" attribute:
<xs:attribute name="lang" type="xs:string" use="required"/>
The following example defines an element called "age" with a restriction. The value of age
cannot be lower than 0 or greater than 120:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="120"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

The example below defines an element called gender with a restriction. The only acceptable
values are: m,f
<xs:element name="gender" type="gendertype"/>
<xs:simpletype name="gendertype">
<xs:restriction base="xs:string">
<xs:enumeration value="m"/>
<xs:enumeration value="f"/>
</xs:restriction>
</xs:simpletype>

The next example defines an element called "password" with a restriction. There must be exactly eight
characters in a row and those characters must be lowercase or uppercase letters from a to z, or a number from 0
to 9:

Restrictions for Datatypes


Constraint Description
enumeration Defines a list of acceptable values

Page3

<xs:element name="password">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

fractionDigits Specifies the maximum number of decimal places allowed. Must be equal to or
greater than zero
length
Specifies the exact number of characters or list items allowed. Must be equal to or
greater than zero
maxExclusive Specifies the upper bounds for numeric values (the value must be less than this
value)
maxInclusive Specifies the upper bounds for numeric values (the value must be less than or
equal to this value)
maxLength
Specifies the maximum number of characters or list items allowed. Must be equal
to or greater than zero
minExclusive Specifies the lower bounds for numeric values (the value must be greater than this
value)
minInclusive Specifies the lower bounds for numeric values (the value must be greater than or
equal to this value)
minLength
Specifies the minimum number of characters or list items allowed. Must be equal
to or greater than zero
pattern
Defines the exact sequence of characters that are acceptable
totalDigits
Specifies the exact number of digits allowed. Must be greater than zero
whiteSpace
Specifies how white space (line feeds, tabs, spaces, and carriage returns) is
handled

Look at this complex XML element, "employee", which contains only other elements:
<?xml version="1.0" encoding="ISO-8859-1"?>
<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="employee.xsd">
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>

The "employee" element can be declared directly by naming the element, like this:

<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>

Page3

<?xml version="1.0" encoding="ISO-8859-1" ?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

9. INTRODUCING XFORMS

Differences From HTML Forms


Unlike the original HTML forms, the creators of XForms have used a Model-ViewController approach. The "model" consists of one or more XForms models describing form data,
constraints upon that data, and submissions. The "view" describes what controls appear in the
form, how they are grouped together, and what data they are bound to. CSS can be used to
describe a form's appearance.
An XForms document can be as simple as an HTML form (by only specifying the submission
element in the model section, and placing the controls in the body), but XForms includes many

Page3

What Is XForms?
XForms is the next generation of HTML forms
XForms is richer and more flexible than HTML forms
XForms will be the forms standard in XHTML 2.0
XForms is platform and device independent
XForms separates data and logic from presentation
XForms uses XML to define form data
XForms stores and transports data in XML documents
XForms contains features like calculations and validations of forms
XForms reduces or eliminates the need for scripting
XForms is a W3C Recommendation

advanced features. For example, new data can be requested and used to update the form while
it is running, much like using XmlHttpRequest/AJAX except without scripting. The form author
can validate user data against XML Schema data types, require certain data, disable input
controls or change sections of the form depending on circumstances, enforce particular
relationships between data, input variable length arrays of data, output calculated values
derived from form data, prefill entries using an XML document, respond to actions in real time
(versus at submission time), and modify the style of each control depending on the device they
are displayed on (browser versus mobile versus text only, etc.). There is often no need for any
scripting with languages such as JavaScript.
Like HTML forms, XForms can use various non-XML submission protocols (multipart/formdata, application/x-www-form-urlencoded), but a new feature is that XForms can send data to a
server in XML format. XML documents can also be used to prefill data in the form. Because XML
is a standard, many tools exist that can parse and modify data upon submission, unlike the case
with legacy forms where in general the data needs to be parsed and manipulated on a case by
case basis. XForms is itself an XML dialect, and therefore can create and be created from other
XML documents using XSLT. Using transformations, XForms can be automatically created
from XML Schemas, and XForms can be converted to XHTML forms.
The XForms Framework
The purpose of an HTML form is to collect data. XForms has the same purpose.
With XForms, input data is described in two different parts:
The XForm model - defines what the form is, what it should do, what data it contains
The XForm user interface - defines the input fields and how they should be displayed

The instance Element


The instance element defines the data to be collected.
XForms is always collecting data for an XML document. The instance element in the XForms
model defines the XML document.
In the example above the "data instance" (the XML document) the form is collecting data for
looks like this:
<person>
<fname/>
<lname/>
</person>
After collecting the data, the XML document might look like this:
<person>
<fname>John</fname>
<lname>Smith</lname>
</person>

Page3

The XForms Model


The XForms model describes the data.
The XForms model defines a data model inside a model element:
<model>
<instance>
<person>
<fname/>
<lname/>
</person>
</instance>
<submission id="form1" action="submit.asp" method="get"/>
</model>
In the example above, the XForms model uses an instance element to define the XML-template
for the data to be collected, and a submission element to describe how to submit the data.

The submission Element


The submission element describes how to submit the data.
The submission element defines a form and how it should be submitted.
In the example above, the id="form1" identifies a form, the action="submit.asp" defines the
URL to where the form should be submitted, and the method="get" attribute defines the
method to use when submitting the form data.
The XForms User Interface
The XForms user interface defines the input fields and how they should be displayed.
The user interface elements are called controls (or input controls):
<input ref="fname"><label>First Name</label></input>
<input ref="lname"><label>Last Name</label></input>
<submit submission="form1"><label>Submit</label></submit>
In the example above the two <input> elements define two input fields. The ref="fname" and
ref="lname" attributes point to the <fname> and <lname> elements in the XForms model.
The <submit> element has a submission="form1" attribute which refers to the <submission>
element in the XForms model. A submit element is usually displayed as a button.
Notice the <label> elements in the example. With XForms every input control element has a
required <label> element.

All Together Now


<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<xf:model id="model1">
<xf:instance>
<person xmlns="">
<fname/>
<lname/>
</person>
</xf:instance>
<xf:submission id="s01" method="put action="person.xml" />
</xf:model>
</head>
<body>
<xf:input model=model1 ref="fname">
<xf:label>First Name:</xf:label> </xf:input>
<xf:input model="model1" ref="lname">
<xf:label>Last Name:</xf:label></xf:input>
<xf:submit submission="s01">
<xf:label>Submit</xf:label>
</xf:submit>
<p>Click "Submit" to store entered order.</p>
</body>
</html>

Page3

We'll Need A Container


XForms is not designed to work alone. There is no such thing as an XForms document.
XForms has to run inside another XML document. It could run inside XHTML 1.0, and it will run
inside XHTML 2.0.

And the page will display pretty much like this.


The XForms Processor
An XForms Processor built into the browser will be responsible for submitting the XForms data
to a target.
The data can be submitted as XML and could look something like this:
<person>
<fname>Ankit</fname>
<lname>Goel</lname>
</person>
Or it can be submitted as text, looking something like this:
fname=Ankit lname=Goel
The XForms Namespace
The official namespace for XForms is: http://www.w3.org/2002/xforms

This example uses the XForms namespace:


<html xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<xf:model>
<xf:instance>
<person>
<fname/>
<lname/>
</person>
</xf:instance>
<xf:submission id="form1" method="get" action="submit.asp"/>
</xf:model>
</head>
<body>
<xf:input ref="fname"><xf:label>First Name</xf:label></xf:input><br />
<xf:input ref="lname"><xf:label>Last Name</xf:label></xf:input><br /><br />
<xf:submit submission="form1"><xf:label>Submit</xf:label></xf:submit>
</body>

XForms Binding
XForms uses two sections to define data: The XForms model and the XForms user interface.
The XForms model is an XML template (instance) for the data, and the XForms user interface is a
description of the input and display of the data.
XForms uses XPath to define the connection between the two sections. This is called
binding.

Page3

</html>
In the example above we have used the xf: prefix for the XForms namespace, but you are free to
call the prefix anything you want.

XPath uses path expressions to identify nodes in an XML document. These path expressions look
much like the expressions you see when you work with a computer file system.
This XPath expression:
/person/fname
addresses the fname node in the XML document:
<person>
<fname>Hege</fname>
<lname>Refsnes</lname>
</person>
Binding Using Ref
With an XForms model instance like this:
<instance>
<person>
<name>
<fname/>
<lname/>
</name>
</person>
</instance>
The XForms user interface can bind <input> elements using the ref attribute:
<input ref="name/fname"><label>First Name</label></input>
<input ref="name/lname"><label>Last Name</label></input>
The ref="name/fname" attribute in the example above is an XPath expression pointing to the
<fname> element in the instance model. This binds the input field to the <fname> element in
the XML document (instance) that is collecting data from the form.
The XForms user interface could also use a reference like this:
<input ref="/person/name/fname"><label>First Name</label></input>
<input ref="/person/name/lname"><label>Last Name</label></input>
In the example above, the slash (/) at the beginning of the XPath expression indicates the root of
the XML document.
Binding Using Bind
With an XForms model instance like this:
<model>
<instance>
<person>
<name>
<fname/>
<lname/>
</name>
</person>
</instance>
<bind nodeset="/person/name/fname" id="firstname"/>
<bind nodeset="/person/name/lname" id="lastname"/>
</model>
The XForms user interface can bind <input> elements using the bind attribute:
<input bind="firstname"><label>First Name</label></input>
<input bind="lastname"><label>Last Name</label></input>

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms"

Page3

Some more examples:

xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<title>Enter Info</title>
<xf:model id="model1" schema="">
<xf:instance>
<person xmlns="">
<fname/>
<lname/>
<dob/>
</person>
</xf:instance>
<xf:bind nodeset="dob" type="xs:date" />
<xf:submission id="s01" method="put action="person.xml" />
</xf:model>
</head>
<body>
<xf:input model="model1" ref="fname">
<xf:label>First Name:</xf:label>
</xf:input>
<xf:input model="model1" ref="lname">
<xf:label>Last Name:</xf:label>
</xf:input>
<xf:input model="model1" type="xs:date" ref="dob">
<xf:bind nodeset="/person/dob" type="xs:date" />
<xf:label>Date of Birth:</xf:label>
</xf:input>
<br />
<xf:submit submission="s01">
<xf:label>Submit</xf:label>
</xf:submit>
<p>Click "Submit" to store entered information.</p>
</body>
</html>

Page3

Output :

Page3

Result of Action associated with submit button:


person.xml

Another Example demonstrating bind:

<xf:submission id="s01" method="put" action="person.xml" />


</xf:model>
</head>
<body>
<xf:input model="model1" ref="fname">
<xf:label>First Name:</xf:label>
</xf:input>
<xf:input model="model1" ref="mname">
<xf:label>Middle Name:</xf:label>
</xf:input>
<xf:input model="model1" ref="lname">
<xf:label>Last Name:</xf:label>
</xf:input>
<p/>
<xf:select1 ref="@gender" model="model1" appearance="full"
incremental="true">
<xf:bind nodeset="/person/@gender" type="xs:NMTOKEN" required="true"/>
<xf:item>
<xf:label>Male</xf:label>
<xf:value>m</xf:value>
</xf:item>
<xf:item>
<xf:label>Female</xf:label>
<xf:value>f</xf:value>
</xf:item>

Page3

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<title>Enter Info</title>
<xf:model id="model1" schema="demo3.xsd">
<xf:instance>
<person gender="" xmlns="">
<fname/>
<mname/>
<lname/>
<dob/>
<pan/>
<color/>
</person>
</xf:instance>
<xf:bind nodeset="fname" type="xs:string" required="true"/>
<xf:bind nodeset="mname" type="xs:string" />
<xf:bind nodeset="lname" type="xs:string" required="true" />
<xf:bind nodeset="dob" type="xs:date" />
<xf:bind nodeset="pan" type="xs:panpattern" required="true"/>
<xf:bind nodeset="color" type="xs:string" required="true" />
<xf:bind nodeset="@gender" type="xs:NMTOKEN" required="true"/>

<xf:label>Gender:</xf:label>
</xf:select1>
<p/>
<xf:input model="model1" type="xs:date" ref="dob">
<xf:bind nodeset="/person/dob" type="xs:date" />
<xf:label>Date of Birth:</xf:label>
</xf:input>
<p/>
<xf:input model="model1" type="xs:panpattern" ref="pan">
<xf:label>PAN:</xf:label>
</xf:input>
<p/>
<xf:select1 model="model1" ref="color">
<xf:bind nodeset="/person/color" type="xs:string" required="true"/>
<xf:label>Choose Color:</xf:label>
<xf:item>
<xf:label>Violet</xf:label>
<xf:value>Violet</xf:value>
</xf:item>
<xf:item>
<xf:label>Indigo</xf:label>
<xf:value>Indigo</xf:value>
</xf:item>
<xf:item>
<xf:label>Blue</xf:label>
<xf:value>Blue</xf:value>
</xf:item>
<xf:item>
<xf:label>Green</xf:label>
<xf:value>Green</xf:value>
</xf:item>
<xf:item>
<xf:label>Yellow</xf:label>
<xf:value>Yellow</xf:value>
</xf:item>
<xf:item>
<xf:label>Orange</xf:label>
<xf:value>Orange</xf:value>
</xf:item>
<xf:item>
<xf:label>Red</xf:label>
<xf:value>Red</xf:value>
</xf:item>
</xf:select1>
<p/>
<xf:submit submission="s01">
<xf:label>Submit</xf:label>
</xf:submit>

</body>
</html>

Page3

<p>Click "Submit" to store entered information.</p>

demo.xsd
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person">
<xs:sequence>
<xs:element name="fname"/>
<xs:element name="mname" minOccurs="0"/>
<xs:element name="lname"/>
<xs:element name="dob" type="xs:date"/>
<xs:element name="pan" type="panpattern"/>
<xs:element name="color" use="optional" default="Red">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="Violet" />
<xs:enumeration value="Indigo" />
<xs:enumeration value="Blue" />
<xs:enumeration value="Green" />
<xs:enumeration value="Yellow" />
<xs:enumeration value="Orange" />
<xs:enumeration value="Red" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="gender" use="optional" default="m">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="m" />
<xs:enumeration value="f" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>

Page3

</xs:element>
<xs:simpleType name="panpattern">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][A-Z]"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

10. ODF
In an effort to provide a good base to build upon, I began talking a lot about XPath, XForms, and
XML. What is this new acronym O.D.F. and how does it fit into all this fine detail? Well, the
OpenDocument Format (ODF) is the default file format for OpenOffice.org and is able to store
XML, XForms, XPath, and more information in one self-contained file. In fact, the ODF format is
XML data. If you were to look at the raw OpenOffice.org document you would see XML data. If
you were to look at an OpenOffice.org XForms document you would see XPath data.

Page3

ODF does not use the entire i feature set of XPath, XForms, and XML as these are large standards
still being refined; however, there is enough support in ODF for OpenOffice.org to produce
effective XForms.

11. XForms and XPath in OpenOffice.org


XForms in OpenOffice.org

Page3

Using the graphical user interface of OpenOffice.org you create a new XML forms document as
shown.

When you create an XML Form document (XForms), you'll see the eight parts of the XForms
model on the screen as shown

.
Reading from left to right they are

2. Instance data tab: The tab that shows the model's instance data.

Page3

1. Form controls: The form controls allow the user to graphically manipulate data residing in
the XForm (or more properly called instance data).

3. Instance data: The graphical representation of the XML that will hold the data entered into
the form controls. The instance data is the XML template that will be filled in by
information the user types into the form controls.
4. Submission data tab: The tab that shows the model's method of transmitting the instance
data. The submission is a description of where the instance data is to be sent and how it
is to be sent. A form can have multiple ways of being submitted as will be shown.
5. Model select button: The button that allows you to select different models in the XForm.
6. Bindings data tab: The tab that shows the links between the Form Controls and the
Instance Data. The binding is a connection between an element in the instance data and a
form control (such as text box, list box, numeric field, etc.), or a connection between
instance data and a constraint in a model item.
7. Model edit/add/remove button: The button that allows you to manipulate more than one
model in the XForm. The model describes the data to be collected. XForms processing
places no limits on the number of individual forms that can be placed in a single
containing document. When a single document contains multiple forms, each form needs
a separate distinguishable model element.
8. Instance edit/add button: The button that allows you to manipulate more than one
instance in the XForm model. The model's instance element defines the data to be
collected.
An XForm may contain (but not require) these various parts to provide the user with a rich,
interactive experience. Please do not confuse the lower case model(s) of XForms mentioned
here with the uppercase Model of the data structure mentioned in The XForms Model.

XForm

Model(s)

Submissions

Instance Data

Page3

Bindings

Form Control(s)

Instance Data at Work


Open an OpenOffice.org XML document by selecting File > New > XML Form Document. You
should see the graphical interface you will use to build the XForm. Notice that Model 1 has its
own Instance 1, Submissions, and Bindings tabs.
Remember, XML data allows for defining custom-built methods for describing and storing your
information in a way that can be easily extended. You are free to rename models, instances,
submissions, and bindings to whatever names you want 1.
Let's change the name of our first model from Model 1 to application.

Click the Models button

Select Rename

Page3

By using the icons in the instance data area create the instance data tree. Latter when you
save or stream this instance data you will be saving or streaming an XML file. When you add an
element, it will be added as a child of the highlighted element. When you add an attribute, it will
show with a preceding @ sign. You do not need to type the @ yourself. Let's walk through
adding the elements and attributes discussed in the table above. Understand that at this point
you are only setting up the XML place holders to hold the actual data to be typed in latter
using form controls.

Form Controls at Work

Page3

Ensure the form controls toolbar is enabled (View > Toolbars > Form Control) and that its form
design mode is toggled on.
Different form controls have different capabilities. Generally speaking, these capabilities are
specific to the application you are using (such as OpenOffice.org). These form controls relate to
the View. Furthermore, these specific form control capabilities in this section are not specific to
XForms but to OpenOffice.org's ODT file capabilities.
Another item to be aware of is how OpenOffice.org allows the use of different form control
anchorings. Each anchoring also has different capabilities. You will want to anchor form controls
according to your personal preference1.

Adding a text box


Within the form controls toolbar

Left click on the text box icon

Go to the XForm and click and drag the text box to the dimensions you choose.

Once the text box is in the XForm, you can adjust its different capabilities. To anchor this text
box as a character, you would

Right-click the text box

Select anchor

Select as character

Let's adjust some of the properties specific to text boxes.

Double left click the text box

Page3

This brings up a window as shown in figure.

The General tab shows the general properties for a text box. Notice you can change the tab
order (what order this text box will receive focus when tabbing between different form fields),
font (size, color, effects, and so forth.), text alignment, text type (single line, multi-line with
formatting, and so forth.), and provide help text (mouse hovering shows specific text).
This can provide helpful feedback information to the user. For our Name box you might want to
have the help text read First name and last name please.
Continue to type text in the XForm and add associated text boxes to your document as needed.

Adding an option button


In our XForm , the use element would need to have at least two possible choices.
Option buttons allow the user to select one option out of a set of possibilities. Within the form
controls toolbar

Left click on the option button icon

Go to the XForm and click and drag the option button to the dimensions you choose

Once the option button is in the XForm, you can adjust its different capabilities. Let's adjust
some of the properties specific to option buttons.
Double left click the option button

Page3

The Style, Alignment, and Default status are probably of most interest for our type of XForm. It
is possible to have one option selected by default if that is what you choose.
Go ahead and insert another option button as you want at least two options for use element.
Bindings (discussed latter) limit when only one option out of the various option buttons can be
chose at any given time. In order to connect a group of option buttons so only one can be
chosen at a time, you will set all of them to have the same binding expression.

Adding a date field


Date fields allow the user to easily enter a date in a standard format. Within the form controls
toolbar

Left click on the date field icon

Go to the XForm and click and drag the date field button to the dimensions you choose

Page3

The spin button option allows the user to cycle through the date one at a time and the list box
option allows the user to view a calendar from which to choose the date.

Adding a time field


Time fields allow the user to easily enter a time in a standard format. Within the form controls
toolbar

Left click on the time field icon

Go to the XForm and click and drag the time field button to the dimensions you choose

It has similar options to the date field but related to time.

Adding a formatted field


Formatted fields allow the user to enter text in a certain predefined format. Within the form
controls toolbar

Left click on the formatted field icon

There is a wide range of options on how text can be represented using various format codes.
One quick example is the format code #.0" hours". This will allow the user to type any number,
then one decimal place, then one more number. If the user were to simply type 13.52 into this
formatted field, then OpenOffice.org would translate that into 13.5 hours More information
about format codes is available in the OpenOffice.org help pages.

Adding a combo box


Combo boxes allow the user to either select an entry from a populated list or manually type in
another option of their choosing.

Adding checkboxes
Checkboxes allow the user to easily check off what they want from a provided list. In the
checkbox properties dialog, you can specify the values for what on and off mean. Typically,
these values are 1 or Y for on and 0 or N for off.

Adding a list box

Page3

List boxes allow the user to select only one or multiple items from a predefined list of entries.
The listed entries can come from either the form control or the XForms model. In keeping with
our XForms purpose, you will latter create these entries using another XForms model within the
same XForm.

Bindings at Work
After setting up the preliminary form controls and instance data you are now ready to bind
together the various form controls and the corresponding instance data. In other words, the
binding is the critical link between the XForm's form data and the XForm's XML data. Bindings
relate both to the Model and to the Controller.
Left click the Bindings tab in the XML data navigator.
Let's first add a binding to the Name sub-element of the application root element. We shall use
XPath notation and write it as application/name.

Left click the add binding () icon where the binding Name = name and binding
expression =/application/name

Double left click the Name text box in the XForm

Left clicking the Data tab

Page3

Now add the data link between the form control (text box in this case) and the instance data via
the binding just created.

The Events tab is for even more functionality such as handling specific events (when mouse
enters the text box, when a key is pressed in the text box, when text is modified in the text box,
and so forth.) through macro programming.
You want to be able to use the XForms model to produce its own list box entries. You will do this
by creating a new XForms model. The entries will come from elements that have attributes in
this new model.
First add the new model
Name the model something that makes sense

Model Name = REGIONLIST

Highlight instanceData and click the add element icon

Add sub-elements that each have the same name, say list

Add unique attributes, say region, to each of the elements

Page3

Create instance data that has various elements by the same name.

Values for the @region attributes will be what populate the list box entires.
In the REGIONLIST model, create a binding where binding
expression=/instanceData/list/@region
OK, you have now created two models within our XForm. You can now return to the XForm to
complete our list box.
Double left click the list box

Page3

Adding conditions
Setting conditions allow instant feedback in a variety of ways to the user. Some might be to
inform them whether they are filling out the form as they should, to perform calculations for
them, to automatically skip content-sensitive or irrelevant fields, and so forth. Some conditions
might be a combination of these. In essence, the conditions create value for the user as they are
guided in completing your form as well as for you when you get the data your thought you were
requesting.

Required: A form may require certain values and this requirement may be dependent
upon other values in the form. The user is informed if the required condition is not met.

Relevant: Many forms have data entry sections who's value depend upon other values or
sections. The user is alerted through section visibility, focus, and navigation order if one
section is relevant to another section.

Read-only: A form may have values that should not be directly modifiable by the user but
may be modifiable due to the conditions of other modifiable sections.

Constraint: Many forms have data entry sections who's value should be constrained to
only a certain range, type, or value. The user is alerted to which sections have unfulfilled
constraints and told what constraint was imposed.

Calculation: A form may have sections who's value is computed from other values the
user may or may not have provided.

Data type: The user can be told what data type (number, letter, date, time, and so forth.)
is expected.
Page3

You can create these conditions without having to learn another programming language (such
as Java, JavaScript, Perl, Ruby, and so forth.) but by using the simpler and more natural XPath
language. The conditions found in XForms that allow instant feedback to the user are as follows:

Conditions are not limited to the control which they are bound to. They can include XPath
references to all parts of the data instance. A calculation may sum the values from individual
elements or attributes. A constraint may be dependent on any number of elements or attributes.
The XForms library includes the entire XPath 1.0 core function library. This includes operations
on elements, attributes, strings, numbers, and booleans as well as other extension functions
specifically designed for forms.

Submissions at Work
After gathering data from the user, you want to be able to submit it using various methods. You
might choose to submit all data to a file on the local disk, to the Internet, or to a file server. You
might also feel a need to submit only part of the data to these locations. The submission process
relates to the Controller .

First, some basic information about submissions.

Click the the submissions tab

Left click the Add Submission icon

This should bring up a window similar to Figure. Let me explain.


The Name box
This can be any name you choose.
The Action box
This is any valid URI as defined by the W3C technical architecture group. i
Unfortunately, OpenOffice.org version 3.0 does not seem to work with the
mailto: URI.

Page3

The Method list box

This provides the user with choices on different methods for saving the instance
data.
The Binding expression box
The XPath expression that selects the elements to include in the submission.
The Binding box
This allows the user to select an existing binding to which this submission it to be
assigned.
The Replace list box
This selects the action to be taken after the submission has been executed. If the
action box was set to submit to a server, then the server's reply could either
replace the whole document that is including the submitted form or it could
replace all or part of the data instance that is associated with the formallowing
for the representation of the result withing the current form. Again, here we see
practical XForms uses which provide rich user experiences.

12. MAPPING XML DATA TO SQL DATABASES


1. Mapping XML Data to MS-Access
The approach is very simple, you just have to import the XML file into your access database, the
table structure is
parsed automatically by Access.
Step 1:
Open a new access database, SELECT External Data tabang select XML file in imports section.

Page3

Step 2:
Select the *.xml data file from the folder in which you have downloaded the
file and click import

Page3

2. SQLWays is one of the database migration products that easily migrate XML digital data to
IBM DB2, Oracle, Microsoft SQL Server, Sybase and MySQL.

13. CONCLUSION

Page3

Hopefully these instructions and explanations have been helpful in showing you how to use
OpenOffice.org to create XForms using the extensibility of XML. You saw how forms with both
simple and complex data can be locally processed using XPath to provide instance feedback to
the user without sending or receiving data across a network connection. These forms may be
saved to disk, submitted to the Internet, or even a file server. These forms can latter be
reopened with the previously selected data still intact.

REFERENCES
1. www.w3schools.com
2. en.wikibooks.org/wiki/XForms

Page3

3. www.google.com

ANNEXURE
SAMPLE FORMS

QUESTIONNARE FOR IN-HOUSE

Page3

DEVELOPED SOFTWARE

Page3

IMAC FORM

Page3

You might also like