Report

60
Page50 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

Transcript of Report

Page 1: Report

Page

50

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

BTECH – COMPUTER SCIENCE & ENGINEERING

JSS ACADEMY OF TECHNICAL EDUCATION, NOIDA

Page 2: Report

Page

50

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

JSSATE, Noida

Page 3: Report

Page

50

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, Gurgaon 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.

Ankit Goel

Roll No. 0709110011

Btech – Computer Science & Engineering

JSSATE, Noida

Page 4: Report

Page

50

TABLE OF CONTENTS

S. No. TOPIC PAGE No.

1. PREFACE 1

2. POWER GRID CORPORATION OF INDIA LIMITED 2

3 AIM OF THE TRAINING 4

4. SOFTWARE REQUIREMENTS 5

5. INTRODUCING XML 7

6. XPATH 11

7. XSLT 12

8. XML SCHEMA DESIGN 13

9. INTRODUCING XFORMS 17

10. ODF 26

11. XFORMS AND XPATH IN OPENOFFICE.ORG 27

12. MAPPING XML DATA TO SQL DATABASE 40

13. CONCLUSION 42

14. REFERENCES 43

15. ANNEXURE 44

Page 5: Report

Page

50

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

15-07-2010

Page 6: Report

Page

50

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 DirectorMr. 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

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 five Regional Load Despatch Centres as below:

Eastern Region Load Despatch Centre, Kolkatta North Eastern Region Load Despatch Centre, Shillong

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

Page 7: Report

Page

50

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 mitigationc)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.

POWERGRID’s 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.

Services Provided On POWERGRID’s 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 POWERGRID’s network:

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

Multi-site LAN Interconnect plus Internet Access

Internet bandwidth

Unique Features Of POWERGRID’s Telecom NetworkMost of the POWERGRID’s 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 POWERGRID’s Telecom route are:

Instant bandwidth allocation on POWERGRID’s 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

Page 8: Report

Page

50

3. AIM OF THE TRAINING

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.

Page 9: Report

Page

50

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

4. Microsoft Windows 7 Ultimate

Page 10: Report

Page

50

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 HTMLIf 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 SharingIn 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 Data TransportOne 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 Simplifies Platform ChangesUpgrading 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.

XML Makes our Data More AvailableDifferent 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

Page 11: Report

Page

50

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 (ISO-8859-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 Form a Tree StructureXML 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> </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).

Page 12: Report

Page

50

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>.

Example 2:<?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 --> <person id="1" gender="f"> <fname>Dorothy</fname> <mname/> <!—Element can be empty --> <lname>Chouhan</lname> <dob>1990-03-23</dob> <mobileno>98987565790</mobileno>

Page 13: Report

Page

50

<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 DocumentsA "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.

Valid XML DocumentsA "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)><!ELEMENT lname (#PCDATA)><!ELEMENT dob (#PCDATA)><!ELEMENT mobileno (#PCDATA)><!ELEMENT placeofbirth (city, state)><!ELEMENT city (#PCDATA)>

Page 14: Report

Page

50

<!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 DeclarationIf 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"

External DTD DeclarationIf the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the following syntax:

<!DOCTYPE root-element SYSTEM "filename">

Example XML document with an external DTD:

Page 15: Report

Page

50

<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE name SYSTEM "name.dtd"><name> <fname> Ankit</fname> <lname>Goel</lname></name>

PCDATAPCDATA 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.

CDATACDATA 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.

6. XPATH

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 Descriptionnodename 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 attributesNote: If the path starts with a slash ( / ) it always represents an absolute path to an element!

XPath wildcards can be used to select unknown XML elements.Wildcard Description* Matches any element node@* Matches any attribute node

Page 16: Report

Page

50

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 Result

persons Selects all the child nodes of the persons element

/persons Selects the root element persons

persons/person Selects all person elements that are children of persons

//person Selects all person elements no matter where they are in the document

persons//person Selects all person elements that are descendant of the persons element, no matter where they are under the person element

//@id 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 documentsXPath - a language for navigating in XML documentsXSL-FO - a language for formatting XML documents

For Examplefinalstyle.xsl

<?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> <th>GENDER</th> <th>DATE OF BIRTH</th> <th>PLACE OF BIRTH</th> <th>MOBILE NO</th>

Page 17: Report

Page

50

<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 documentdefines attributes that can appear in a documentdefines which elements are child elementsdefines the order of child elementsdefines the number of child elementsdefines whether an element is empty or can include textdefines data types for elements and attributesdefines default and fixed values for elements and attributes

XML Schemas are the Successors of DTDsXML Schemas are extensible to future additionsXML Schemas are richer and more powerful than DTDsXML Schemas are written in XMLXML Schemas support data typesXML Schemas support namespaces

XML Schemas Support Data TypesOne of the greatest strength of XML Schemas is the support for data types.With support for data types:It is easier to describe allowable document content

Page 18: Report

Page

50

It is easier to validate the correctness of dataIt is easier to work with data from a databaseIt 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 ElementThe 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:stringxs:decimalxs:integerxs:booleanxs:datexs:time

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

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>

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:

Page 19: Report

Page

50

<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:

<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>

Restrictions for DatatypesConstraint Descriptionenumeration Defines a list of acceptable valuesfractionDigits Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero

Page 20: Report

Page

50

length Specifies the exact number of characters or list items allowed. Must be equal to or greater than zeromaxExclusive 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

zerominExclusive 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

zeropattern Defines the exact sequence of characters that are acceptable totalDigits Specifies the exact number of digits allowed. Must be greater than zerowhiteSpace 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:

<?xml version="1.0" encoding="ISO-8859-1" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

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

Page 21: Report

Page

50

9. INTRODUCING XFORMS

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

Differences From HTML FormsUnlike the original HTML forms, the creators of XForms have used a Model-View-Controller 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 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

Page 22: Report

Page

50

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/form-data, 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 FrameworkThe 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 containsThe XForm user interface - defines the input fields and how they should be displayed

The XForms ModelThe 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 instance ElementThe 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>

The submission ElementThe submission element describes how to submit the data.The submission element defines a form and how it should be submitted.

Page 23: Report

Page

50

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 InterfaceThe 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.

We'll Need A ContainerXForms 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.

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>

And the page will display pretty much like this.The XForms ProcessorAn 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:

Page 24: Report

Page

50

<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 NamespaceThe 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>

</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.

XForms BindingXForms 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.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/fnameaddresses the fname node in the XML document:<person> <fname>Hege</fname> <lname>Refsnes</lname>

Page 25: Report

Page

50

</person>

Binding Using RefWith 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 BindWith 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>

Some more examples:

<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=""> <xf:instance> <person xmlns=""> <fname/> <lname/>

Page 26: Report

Page

50

<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>

Output :

Result of Action associated with submit button:person.xml

Page 27: Report

Page

50

Page 28: Report

Page

50

Another Example demonstrating bind:

<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: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>

Page 29: Report

Page

50

<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>

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

</body></html>

Page 30: Report

Page

50

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>

</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>

Page 31: Report

Page

5010. 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.

ODF does not use the entirei 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.

Page 32: Report

Page

50

11. XForms and XPath in OpenOffice.org

XForms in OpenOffice.org

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

Page 33: Report

Page

50

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

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

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

Page 34: Report

Page

50

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

Form Control(s)Model(s)

Instance DataSubmissionsBindings

Page 35: Report

Page

50

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 want1.

Let's change the name of our first model from “Model 1” to “application.”

Click the “Models” button

Select “Rename”

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.

Page 36: Report

Page

50

Form Controls at WorkEnsure 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.

Page 37: Report

Page

50

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

This brings up a window as shown in figure.

Page 38: Report

Page

50

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

Page 39: Report

Page

50

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

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.

Page 40: Report

Page

50

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

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.

Page 41: Report

Page

50

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

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

Double left click the Name text box in the XForm

Left clicking the Data tab

Page 42: Report

Page

50

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

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

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

Page 43: Report

Page

50

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

Page 44: Report

Page

50

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.

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:

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.

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 .

Page 45: Report

Page

50

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.

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 form—allowing for the representation of the result withing the current form. Again, here we see practical XForms uses which provide rich user experiences.

Page 46: Report

Page

50

12. MAPPING XML DATA TO SQL DATABASES

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

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

Page 47: Report

Page

50

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.

Page 48: Report

Page

50

13. CONCLUSION

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.

Page 49: Report

Page

50

14. REFERENCES

1. www.w3schools.com2. en.wikibooks.org/wiki/XForms3. www.google.com

Page 50: Report

Page

50

ANNEXURE

SAMPLE FORMS

QUESTIONNARE FOR IN-HOUSE

DEVELOPED SOFTWARE

Page 51: Report

Page

50

IMAC FORM