Tolal:29 Click:
1
2
XForms Interview Questions And Answers
Page 1
Ques: 1 How you define properties of XForms?
Ans:
Properties helps to define data restrictions, types and its behaviour in XForms.
I have given you some properties.
1. required="true()" property : This property it doesn't allow to submit an empty value to specified instance data.
2. type="decimal" property : Using this property we can submit only decimal value.
3. calculate property : Using this property we can calculate a value of instance data.
Using <bind> element we can also bind XForms property with XForms data.To understand this i have given you a example.
<model>
<instance>
<person>
<fname/>
<mname/>
<lname/>
</person>
</instance>
<bind nodeset="person/mname" required="true()"/>
</model>
This example shows that the attribute nodeset="person/mname" binds the property required="false()" with instance data element <mname>.means don't write middle name here.
Ques: 2 How you define functions in XForms?
Ans:
I cleared you XForms already have some functions and we can also call the function those are in Script.
I have you some list of functions that we used in XForms.
boolean-from-string(string) : This functon return true and false when its string parameters are "true" or "1" and "false" or "0" respectively.
if(booleantest, string1, string2) : First it perform the booleantest and return sting1 if test is true or return string2 when test is false.
avg(node-set) : It returns the average of all nodes that are in specified node-set.It returns NaN when node-set is empty.
<values>
<value>20</value>
<value>25</value>
<value>0</value>
</values>
avg(/values/value)
It will returns: 15
min(node-set) : It returns the minimum value of all nodes of a specified node-set.It returns NaN
when node-set is empty.
<values>
<value>20</value>
<value>25</value>
<value>0</value>
</values>
min(/values/value)
It will returns: 0
max(node-set) : It returns the maximum value of all nodes of a specified node-set.It returns NaN
when node-set is empty.
<values>
<value>20</value>
<value>25</value>
<value>0</value>
</values>
max(/values/value)
It will returns: 25
count-non-empty(node-set) : It returns the number of non-empty nodes of a specified node-set
<values>
<value>20</value>
<value>25</value>
<value>0</value>
<value />
</values>
count-non-empty(/values/value)
It will returns: 3
index(string) : It returns the current index of a given repeat set.
property(string) : It returns property that named by string parameter.
property("version")-It is use to return the XForms version number.
property("conformance-level")- It is use to returns conformance level ("basic" or "full") of XForms.
now() : It returns current system date and time in xs:dateTime format.
instance(string) : XForms Model may have more than one instance. It returns the root node of the specified instance data
<xforms:instance id="orderform">
<firstName>vivek</firstName>
<middleName>kumar</middleName>
<lastName>agarwal</lastName>
</xforms:instance>
ref="instance('orderform')/firstName"
It returns a node-set that consists of the firstName element node from the instance named "orderform"
Ques: 3 How to perform Actions in XForms?
Ans:
Using Actions we handle response to events in XForms.
Actions that we use in XForms are given below:
1. Meassage Action
2. Setvalue Action
1. Messsage Action: We use <message> element in XForms to defines a message.And to display that message into XForms user interface.
Example:
<input ref="fname">
<label>First Name</label>
<message level="ephemeral" event="DOMFocusIn">
Enter Your First Name
</message>
</input>
In this example the message "Enter Your First Name" will displayed as a tool tip when user will focus on the input field.
And the event="DomFocusIn" is use to define the event to trigger that action.
And the level="ephemeral" is use to define the message that will display as a tool tip.
2. Setvalue Action: We use <setvalue> element in XForms to set a value that will show with response of an event.
Example:
<input ref="size">
<label>Size</label>
<setvalue value="100" event="xforms-ready"/>
</input>
In this example instance element <size> will stores a value 100 when the form opens.
Ques: 4 How to bind datatype in XForms?
Ans:
If you want bind data types in XForms than you have to use <bind> element. which is use to bind datatype with their instance data.
Example:
<xf:bind nodeset="/person/size" type="xsd:integer"/>
Ques: 5 How you define data types in XForms?
Ans:
XML Schema data type supported by XForms model.
XML Schema Data Types: Because XFormes model supports XML Schema data types. Using this feature XForms processor check the data for correct input values.
If we want to use XML Schema data types, we must have to use XML Schema namespaces into our namespace declaration,
Example:
<html
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
After using the XML Schema namespaces, we can add type attributes into our XForms instance elements like this:
Example:
<xf:instance>
<person xmlns="">
<fname xsi:type="xsd:string"/>
<lname xsi:type="xsd:string"/>
<born xsi:type="xsd:date"/>
<size xsi:type="xsd:integer"/>
</person>
</xf:instance>
I haven given you a list of XML Schema data types except that XForms uses all XML schema data type.
List of unsupported XML Schema datatype in XForms.
1.duration
2.ENTITY
3.ENTITIES
4.NOTATION
Ques: 6 How to perform selection control in XForms?
Ans:
When we want perform control on one or more items in user interface of XForms we use Selection control.
I have perform three type of selection control. These are,
1.Select1 Control
2.Select Control
3.Range Control
1.Select1 Control: When we want to select one item from list of items we use Select1 Control.
Example:
<select1 ref="status">
<label>Status:</label>
<item>
<label>Married</label>
<value>M</value>
</item>
<item>
<label>Unmarried</label>
<value>UM</value>
</item>
</select1>
In this example user can select only one status Married or Unmarried.And it will stored in the XForms instance of XML document like M and UM.
2. Select Control: When we want to select one or more items from list of items we use select control.
Example:
<select ref="languages">
<label>Languages:</label>
<item>
<label>English</label>
<value>E</value>
</item>
<item>
<label>Hindi</label>
<value>H</value>
</item>
<item>
<label>French</label>
<value>F</value>
</item>
<item>
<label>Spanish</label>
<value>S</value>
</item>
<item>
<label>German</label>
<value>G</value>
</item>
</select>
Now, In the above example user can select more than language.
3. Range Control: Using Range control we can select a value from a range of values.
Example:
<range ref="length" start="0" end="200" step="10">
<label>Length:</label>
</range>
Now, In the above example user can select a value between 0 and 200 in steps of 10.
Ques: 7 How to perform Upload Control?
Ans:
We use upload control perform task to control when we uploaded files into server.
<upload bind="name">
<label>File is used to upload:</label>
<filename bind="file"/>
<mediatype bind="media"/>
</upload>
Ques: 8 How to perform output control?
Ans:
Using output control we can control how to display Xform data.
Example:
I have given you a instance of XML document.
<instance>
<person>
<name>
<fname>vivek</fname>
<mname>kumar</mname>
<lname>agarwal</lname>
</name>
</person>
</instance>
We can perform output control on above XML instance.
<p>First Name: <output ref="name/fname" /></p>
<p>Middle Name: <output ref="name/mname" /></p>
<p>Last Name: <output ref="name/lname" /></p>
Output:
Firse Name: vivek
Middle Name: kumar
Last Name: agarwal
Ques: 9 How to perform Textarea control?
Ans:
Using textarea control we can perform task to control multi-line user input.
<textarea ref="message">
<label>Message Box:</label>
</textarea>
Ques: 10 How to perform secret control?
Ans:
The secret control are degined to perform some special task like that input passwords or other hidden information:
<secret ref="name/password">
<label>Pass:</label>
</secret>
Ques: 11 What is label element?
Ans:
I told you when you want to perform input controls than <label> element is necessary child element for this.
Because with use of <label> element is secure and we used that forms in all different types of devices.i.e. Label will be spoken for voice software.
Ques: 12 How you define input control?
Ans:
One of the most common XForms control is input control.
Example:
<input ref="name/fname">
<label>First Name</label>
</input>
<input ref="name/mname">
<label>Middle Name</label>
</input>
<input ref="name/lname">
<label>Last Name</label>
</input>
These input control will display like that,
First Name:
Middle Name:
Last Name:
Ques: 13 How you define controls in XForms?
Ans:
XForms controls are also told as user interface elements we use to control user interface of XForms.
I have given you some main common controls given below:
<input>
<submit>
a ref attribute is attach with each controls element.That is use to point the XForms data model of each control element.
Ques: 14 How to perform binding using bind attribute?
Ans:
We can also perform binding b/w the XForms model and XForms user interface With bind attribute like that,Example:I have given you XForms model instance:<model><instance> <person> <name> <fname/> <mname/> <lname/> </name> </person></instance><bind nodeset=\"/person/name/fname\" id=\"firstname\"/><bind nodeset=\"/person/name/mname\" id=\"middlename\"/><bind
nodeset=\"/person/name/lname\" id=\"lastname\"/></model> Now, Using bind attribute XForms user interface can bind <input> elements like that:<input bind=\"firstname\"><label>First Name</label></input><input bind=\"middlename\"><label>Middle Name</label></input><input bind=\"lastname\"><label>Last Name</label></input>
Using binding we can easily deal with multiple instance model and multiple forms.
Ques: 15 How to perform bindimg using ref atribute?
Ques: 16 Define XPath?
Ans:
We use Xpath to define parts of an XML document.It is an W3C standard.
Main task given by XPath is that,
XPath uses pth expression which helps to identify each node of an XML document.
I have given you a path expression like that,
/person/lname
We use this path expression to address the node lname.
<person>
<fname>vivek</fname>
<mname>kumar</mname>
<lname>agarwal</lname>
</person>
Ques: 17 WHat is Binding in XForms?
Ans:
When XForms achieve that task to address data in XForms with use of XPath.Than it is called as Binding.
I have allready told you XForms define data in two sections.These sections are: XForms model(is a XML instance for data) and XForms user interface(used to describe input and presentation of data).
Than we can say that In Binding we use XPATH to made connection b/w them(these two sections).
Ans:
I have told you in binding we create coneections b/w XForms model and XForms user interface.
Now,I will you how to perform binding b/w them usinfg ref attribute.
Exxample:This code shows XForms model instance:
<instance>
<person>
<name>
<fname/>
<mname/>
<lname/>
</name>
</person>
</instance>
Now, With use of the ref attribute XForms user interface can bind <input> elements:
<input ref="name/fname">
<label>First Name</label>
</input>
<input ref="name/mname">
<label>Middle Name</label>
</input>
<input ref="name/lname">
<label>Last Name</label>
</input>
I the above example ref="name/lname" attribute point the <fname> element in the instance model. ref attribute binds the input field with <lname> element.And to perform task to collect data from the form.
It may happens that XForms user interface use ref attribute like that,
<input ref="/person/name/fname">
<label>First Name</label>
</input>
<input ref="/person/name/mname">
<label>Middle Name</label>
</input>
<input ref="/person/name/lname">
<label>Last Name</label>
</input>
In the above example first /(slash) use to indicate the root of an XML document.
Ques: 18 How you define XForms Namespace?
Ans:
XForms Namespace are used in HTML and XHTML1.0.We can perform task to use XForms Namespace to declare all XForms element with XForms Namespace.
I have given you example which shows how to use XFoms Namespace.
Example:
<html xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<xf:model>
<xf:instance>
<person>
<fname/>
<mname/>
<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="mname">
<xf:label>Middle 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 above example we use XForms Namespace as 'xf:'.And you can use this XForms Namespace to call any thing.
Ques: 19 How you define XForms Processor?
Ans:
We use XForms Processor inside the browser to submit XForm data to the target.
I have you example show how to submit data into XML.
Eaxmple:
<person>
<fname>vivek</fname>
<mname>kumar</mname>
<lname>agarwal</lname>
</person>
Ques: 20 How to use both XForms Model and XForms User Interface togather?
Ans:
We can use both XForms Model and XForms User Interface togather like that,
Example:
<xforms>
<model>
<instance>
<person>
<fname/>
<mname/>
<lname/>
</person>
</instance>
<submission id="form1"
action="submit.asp"
method="get"/>
</model>
<input ref="fname"><label>First Name</label></input>
<input ref="mname"><label>Middle Name</label></input>
<input ref="lname"><label>Last Name</label></input>
<submit submission="form1"><label>Submit</label></submit>
</xforms>
Goto Page:
1
2
XForms Objective
XForms Objective Questions And Answers
XForms Interview Questions And Answers
XForms Subjective Questions And Answers
R4R,XForms Objective, XForms Subjective, XForms Interview Questions And Answers,XForms,XForms Interview,XForms Questions ,XForms Answers