Professional Documents
Culture Documents
SUBMITTED BY
ANKIT GOEL
ROLL NO. 0709110011
Page3
DECLARATION
I hereby declare that the work which is being presented in the Summer Training
Report titled
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.
Page3
TABLE OF CONTENTS
S.
PAGE No.
No.
1.
1
PREFACE
2.
2
4.
5
SOFTWARE REQUIREMENTS
5.
7
INTRODUCING XML
6.
11
XPATH
7.
12
XSLT
8.
13
9.
17
INTRODUCING XFORMS
10.
ODF
TOPIC
26
XFORMS AND XPATH IN OPENOFFICE.ORG
12.
40
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 (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
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
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.
Page3
Internet bandwidth
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
Page3
5.
INTRODUCING XML
XML tags are not predefined. You must define your own tags
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
Page3
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
</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 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:
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
Page3
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 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
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"/>  <xsl:value-of
select="mname"/>
  <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"/>   <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.
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
Page3
Example
Here are some XML elements:
<firstname>Goel</firstname>
<age>19</age>
<dateborn>1990-09-17</dateborn>
Page3
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:
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
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
9. INTRODUCING XFORMS
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
Page3
Page3
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
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
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
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.
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)
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.
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.
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
Select anchor
Select as character
Page3
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.
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.
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.
Go to the XForm and click and drag the time field button to the dimensions you choose
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 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.
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
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
Add sub-elements that each have the same name, say list
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 .
Page3
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.
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
Page3
DEVELOPED SOFTWARE
Page3
IMAC FORM
Page3