February 8, 2018

Sreekanth B

E4X Most Common Interview Questions Answers

What Is The Value Returned When The Input Parameter Type Of The Xmllist() Function In E4x Is Number?

The value is first converted to a string and then converted to an XMLList object.

Which Of The Following Is The Correct Syntax For Calling The Namespace Constructor As A Function In E4x?

Namespace(), Namespace(uriValue).

How You Define E4x?

E4X stands for ECMAScript(European Computer Manufactures Association) for XML(Extensible Markup Language). We can called as E4X is an programing language extension used to adds the ECMAScript(like: ActionScript,DMDScript,E4X, JavaScript,JScript) to XML.

Real life meaning of E4X is "JavaScript for XML".
E4X is an official JavaScript standard used to add direct support for XML.
Using E4X we can easily make scripting for XML with JavaScript.
Using E4X we can declare an XML object variable as same as declare Date and Array variable.

var p = new XML()
var q = new Date()
var r = new Array()

Which Of The Following Operators Is Used For Inserting Xml Objects In The Context Of Their Parent In E4x?


Which Of The Given Options Represents The Correct Length When Alert(emp..*.length()); Is Applied To The Following Code?

Var Emp = <emp> <name>mark</name> <likes> <os>linux</os> <browser>firefox</browser> <language>javascript</language> <language>python</language> </likes> </emp>


What Will Be The Output Of The Following Code Snippet?

Element = <xhtml:p Xmlns:xhtml="http://www.example.org">kibology For All.</xhtml:p>; Elementname = Element.name(); Alert(elementname.localname); //1 Alert(elementname.uri); // 2

Which Of The Following Options Can Be Used To Delete A Child Node Of An Xml Object In E4x?

delete xmlobject.@attribute;

Which Of The Following Is The Correct Way To Create An Xml Object In E4x?

var languages XML = new XML('JavaScriptPython');

State Whether True Or False: An Arbitrary Xml File Can Be Loaded As An E4x Ready Object?


Which Of The Following Characters Are Treated As White Space Characters?

Line feed, Tab.

Which Of The Following Methods Is Not One Of The Global Methods And Properties In E4x?

isScopeNamespaces(), removeNamespaces().

Which Of The Following Options Can Be Used For Adding Direct Support For Xml To Javascript?


Consider The Following Code Snippet. Which Of The Given Options Would Be Used In E4x To Change The Color Of The Descendant Node Chair?

Var Element = <home> <room> <furniture> <chair Color="brown"/> <furniture> </room> </home>
element.chair.color="light brown"

Which Of The Following Is Not True Of The Namespace Constructor In E4x?

If the value is a valid XML name, the prefix property is set to a string.

Which Of The Following Public Methods In E4x Has The Return Type Xml?


State Whether True Or False: The Qname.prototype.tostring() Method Throws A Typeerror Exception If Its Value Is Not A Qname Object?


What Will Be The Output Of The Following Code Snippet?

Var Customer = <customer> <phone Type="mobile">888-555-1212</phone> <phone Type="office">888-555-2121</phone> <preferred>mobile</preferred> </customer>; Alert(customer.childindex());

Which Of The Following Options Would Be Returned By The Code Shown In The Code Snippet: Var F = <foo> <a> Text </a> <a> <b/> </a> </foo>; Alert(f.a[0].hascomplexcontent());// P Alert(f.a[1].hascomplexcontent());//q Alert(f.a[0].hassimplecontent());//r Alert(f.a[1].hassimplecontent());//s

Tell Me How Can We Use E4x In Mozilla And Mozilla Based Browers?

To make use E4X with Mozilla and Mozilla based browsers (like: Netscape) we used Spidermonkey JavaScript engine. It has been extended to implement E4X but presently we can only use it in nightly trunk builds. The present releases Mozilla 1.7 suite, Firefox 1.0, Netscape 7.2 does not supported E4X.

How To Use Of E4x With Xml?

Using E4X we can easily use JAvAScript with an XML.

Example:I have written an XML document.


We can stroe this XML document as an string in variable order.

var order = new XML(txt)   or Assign the XML text to the XML object variable directly.

var order = new XML()
order=<order id="010">

We can also calculate the price like that,

var total=order.item.qty * order.item.priceCan

we display the customers full name like that,

Can add new items like that,
</item>We can display the order id like that,

We can calculate the total price, when the order has many items like that,

var price=0for each (i in order.item)
   price+= i.qty*i.price

Which Of The Following Are Not Global Methods And Properties In E4x?


Which Of The Following Methods Would Give The Output Corresponding To The Code Snippet?

Var Test = <type Name="joe"> <base Name="bob"></base> Example </type>; Output: <type Name="joe"> <base Name="bob"/> Example </type>
alert(test.toXMLString()); , alert(test.elements());

What Is The Correct Way To Add A Method To An Xml.prototype In E4x?


Which Of The Following Is Not A Valid Built-in Method For Xmllist Objects In E4x?


Which Of The Following Is Not A Reserved Keyword In E4x And Javascript?


Tell About Browser Compatibility With E4x?

E4X support limited browsers.No,mainstream browser has supported by E4X.Mozilla engine(1.8)(beta version) is limited support to E4X.We can say that Firebox 1.1 is an first version that support E4X.E4X is also expected to the future version of Internet Explorer.Firefox 1.1: Firefox1.1 can support best for E4X as compare to other browsers.

What You Understand About Ecma?

ECMA(The European Computer Manufacturers Association)international was founded in 1961.

ECMA is an organization made to standardization of information and Communication Technology(ICT) and Consumer Electronics(CE).

We use ECMA standard with

C# Language
International Character Sets
Optical Disks
Magnetic Tapes
Data Compression
Data Communication etc.
ECMA-262(JavaScript1.3)was standardize in Dec1999.
ECMA-357 (E4X) was standardized in June2004.
We use E4X to make JavaScript supported with XML.

How We Say Javascript As Same As Ecmascript?

Because of some reasons we can say that JavaScript is same as ECMAScript.

ECMAScript is called as an official name for JavaScript.
ECMAScript is exactly same as JavaScript.
JavaScript is standardize by ECMA (The European Computer Manufacturers Association) organization.

Using E4x How Can We Make Xml Easier To Use?

E4X makes easier to use JavaScript to parse and manipulate XML.This is also use to enable XML library or component to act with XML.On different browsers libraries and components perform with different syntax and work differently. I have given you example where I show how to load an existance XML document("message.xml")into XML parser and to show note from message.

Example: Without use of E4X.

var xmlDoc//This code is made only for Internet Explorer.
if (window.ActiveXObject)
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
}// This code is made for Mozilla, Firefox etc.else (document.implementation

Read More:
Using E4x How Can We Define Xml Document As A Javascript Object?

I have given you example to show XML document as JavaScript object.Example:I have you simple XML document.

<heading>Don't forget</heading>
Happy Birthday!</message>

We can store this XML document in a string calles as message into an XML object variable vusing JavaScript.var v = new XML(message) or Assign the XML text to the XML object variable directly.var v = new XML()v=<message>
<heading>Don't forget</heading>
Happy Birthday!</message>
We can use JavaScript like that,document.write(v.from)


Subscribe to get more Posts :