Debian Codegraph @

rhino/testsrc/tests/e4x/XML/13.4.4.4.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 gTestfile = '13.4.4.4.js';
8
9 START("13.4.4.4 - XML attribute()");
10
11 TEST(1, true, XML.prototype.hasOwnProperty("attribute"));
12
13 // Get count of employees
14 emps =
15 <employees count="2">
16 <employee id="0"><name>Jim</name><age>25</age></employee>
17 <employee id="1"><name>Joe</name><age>20</age></employee>
18 </employees>;
19
20 TEST_XML(2, 2, emps.attribute("count"));
21
22 // Get the id of the employee age 25
23 emps =
24 <employees>
25 <employee id="0"><name>Jim</name><age>25</age></employee>
26 <employee id="1"><name>Joe</name><age>20</age></employee>
27 </employees>;
28
29 TEST_XML(3, 0, emps.employee.(age == "25").attribute("id"));
30
31 // Get the id of the employee named Jim
32 emps =
33 <employees>
34 <employee id="0"><name>Jim</name><age>25</age></employee>
35 <employee id="1"><name>Joe</name><age>20</age></employee>
36 </employees>;
37
38 TEST_XML(4, 0, emps.employee.(name == "Jim").attribute("id"));
39
40 END();