Using E4X how can we define XML document as a JavaScript object?
Submitted by: AdministratorI have given you example to show XML document as JavaScript object.Example:
I have you simple XML document.
<message>
<date>2009-26-01</date>
<to>Abhi</to>
<from>Sud</from>
<heading>Don't forget</heading>
<body>Happy Birthday!</body>
</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>
<date>2009-26-01</date>
<to>Abhi</to>
<from>Sud</from>
<heading>Don't forget</heading>
<body>Happy Birthday!</body>
</message>
We can use JavaScript like that,document.write(v.from)
Output:Sud
Submitted by: Administrator
I have you simple XML document.
<message>
<date>2009-26-01</date>
<to>Abhi</to>
<from>Sud</from>
<heading>Don't forget</heading>
<body>Happy Birthday!</body>
</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>
<date>2009-26-01</date>
<to>Abhi</to>
<from>Sud</from>
<heading>Don't forget</heading>
<body>Happy Birthday!</body>
</message>
We can use JavaScript like that,document.write(v.from)
Output:Sud
Submitted by: Administrator
Read Online E4X Job Interview Questions And Answers
Top E4X Questions
☺ | Using E4X how can we make XML easier to use? |
☺ | How you define E4X? |
☺ | What you understand about ECMA? |
☺ | Tell me how can we use E4X in Mozilla and Mozilla Based browsers? |
☺ | How we say JavaScript as same as ECMAScript? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |