_[_W_3_C_] ************ DDooccuummeenntt OObbjjeecctt MMooddeell ((DDOOMM)) LLeevveell 33 XXPPaatthh SSppeecciiffiiccaattiioonn ************ ********** VVeerrssiioonn 11..00 ********** ********** WW33CC WWoorrkkiinngg GGrroouupp NNoottee 2266 FFeebbrruuaarryy 22000044 ********** This version: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_4_/_N_O_T_E_-_D_O_M_-_L_e_v_e_l_-_3_-_X_P_a_t_h_-_2_0_0_4_0_2_2_6 Latest version: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_D_O_M_-_L_e_v_e_l_-_3_-_X_P_a_t_h Previous version: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_3_/_C_R_-_D_O_M_-_L_e_v_e_l_-_3_-_X_P_a_t_h_-_2_0_0_3_0_3_3_1 Editor: Ray Whitmer, Netscape/AOL, then Invited Expert This document is also available in these non-normative formats: _X_M_L_ _f_i_l_e, _p_l_a_i_n _t_e_x_t, _P_o_s_t_S_c_r_i_p_t_ _f_i_l_e, _P_D_F_ _f_i_l_e, _s_i_n_g_l_e_ _H_T_M_L_ _f_i_l_e, and _Z_I_P_ _f_i_l_e. _C_o_p_y_r_i_g_h_t ©2004 _W_3_C® (_M_I_T, _E_R_C_I_M, _K_e_i_o), All Rights Reserved. W3C _l_i_a_b_i_l_i_t_y, _t_r_a_d_e_m_a_r_k, _d_o_c_u_m_e_n_t_ _u_s_e and _s_o_f_t_w_a_r_e_ _l_i_c_e_n_s_i_n_g rules apply. =============================================================================== ********** AAbbssttrraacctt ********** This specification defines the Document Object Model Level 3 XPath. It provides simple functionalities to access a DOM tree using [_X_P_a_t_h_ _1_._0]. ********** SSttaattuuss ooff tthhiiss ddooccuummeenntt ********** TThhiiss sseeccttiioonn ddeessccrriibbeess tthhee ssttaattuuss ooff tthhiiss ddooccuummeenntt aatt tthhee ttiimmee ooff iittss ppuubblliiccaattiioonn.. OOtthheerr ddooccuummeennttss mmaayy ssuuppeerrsseeddee tthhiiss ddooccuummeenntt.. AA lliisstt ooff ccuurrrreenntt WW33CC ppuubblliiccaattiioonnss aanndd tthhee llaatteesstt rreevviissiioonn ooff tthhiiss tteecchhnniiccaall rreeppoorrtt ccaann bbee ffoouunndd iinn tthhee _WW_33_CC_ _tt_ee_cc_hh_nn_ii_cc_aa_ll_ _rr_ee_pp_oo_rr_tt_ss_ _ii_nn_dd_ee_xx aatt hhttttpp::////wwwwww..ww33..oorrgg//TTRR//.. This is a _W_o_r_k_i_n_g_ _G_r_o_u_p_ _N_o_t_e of "DOM Level 3 XPath" and is based on the _f_e_e_d_b_a_c_k_ _r_e_c_e_i_v_e_d during the Last Call period. The W3C DOM Working Group participants do not expect to provide two interoperable implementations of this module, uussiinngg tthhee ssaammee bbiinnddiinngg. Implementation feedbacks are however welcome and have to be sent to the public mailing list _w_w_w_-_d_o_m_@_w_3_._o_r_g (public _a_r_c_h_i_v_e). Other W3C Working Groups may continue the work and provide implementations of this document. Individuals or organizations are also invited to send a message to the public mailing list if they intend to produce an implementation of this module. Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. This document has been produced as part of the _W_3_C_ _D_O_M_ _A_c_t_i_v_i_t_y. The authors of this document are the DOM Working Group members. An _i_m_p_l_e_m_e_n_t_a_t_i_o_n_ _r_e_p_o_r_t is also available. Patent disclosures relevant to this specification may be found on the Working Group's _p_a_t_e_n_t_ _d_i_s_c_l_o_s_u_r_e_ _p_a_g_e. ********** TTaabbllee ooff ccoonntteennttss ********** * _E_x_p_a_n_d_e_d_ _T_a_b_l_e_ _o_f_ _C_o_n_t_e_n_t_s * _W_3_C_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_s_ _a_n_d_ _L_i_c_e_n_s_e_s * _1_._ _D_o_c_u_m_e_n_t_ _O_b_j_e_c_t_ _M_o_d_e_l_ _X_P_a_t_h * _A_p_p_e_n_d_i_x_ _A_:_ _I_D_L_ _D_e_f_i_n_i_t_i_o_n_s * _A_p_p_e_n_d_i_x_ _B_:_ _J_a_v_a_ _L_a_n_g_u_a_g_e_ _B_i_n_d_i_n_g * _A_p_p_e_n_d_i_x_ _C_:_ _E_C_M_A_S_c_r_i_p_t_ _L_a_n_g_u_a_g_e_ _B_i_n_d_i_n_g * _A_p_p_e_n_d_i_x_ _D_:_ _A_c_k_n_o_w_l_e_d_g_e_m_e_n_t_s * _G_l_o_s_s_a_r_y * _R_e_f_e_r_e_n_c_e_s * _I_n_d_e_x 26 February 2004 ************ EExxppaannddeedd TTaabbllee ooff CCoonntteennttss ************ * _E_x_p_a_n_d_e_d_ _T_a_b_l_e_ _o_f_ _C_o_n_t_e_n_t_s * _W_3_C_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_s_ _a_n_d_ _L_i_c_e_n_s_e_s o _W_3_C_®_ _D_o_c_u_m_e_n_t_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_ _a_n_d_ _L_i_c_e_n_s_e o _W_3_C_®_ _S_o_f_t_w_a_r_e_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_ _a_n_d_ _L_i_c_e_n_s_e o _W_3_C_®_ _S_h_o_r_t_ _S_o_f_t_w_a_r_e_ _N_o_t_i_c_e * _1_ _D_o_c_u_m_e_n_t_ _O_b_j_e_c_t_ _M_o_d_e_l_ _X_P_a_t_h o _1_._1_ _I_n_t_r_o_d_u_c_t_i_o_n o _1_._2_ _M_a_p_p_i_n_g_ _D_O_M_ _t_o_ _X_P_a_t_h # _1_._2_._1_ _E_l_e_m_e_n_t_ _N_o_d_e_s # _1_._2_._2_ _A_t_t_r_i_b_u_t_e_ _N_o_d_e_s # _1_._2_._3_ _N_a_m_e_s_p_a_c_e_ _N_o_d_e_s # _1_._2_._4_ _T_e_x_t_ _N_o_d_e_s # _1_._2_._5_ _E_n_t_i_t_y_ _R_e_f_e_r_e_n_c_e_ _N_o_d_e_s # _1_._2_._6_ _C_o_m_m_e_n_t_ _N_o_d_e_s # _1_._2_._7_ _P_r_o_c_e_s_s_i_n_g_ _I_n_s_t_r_u_c_t_i_o_n_ _N_o_d_e_s # _1_._2_._8_ _D_o_c_u_m_e_n_t_ _o_r_d_e_r o _1_._3_ _C_o_n_f_o_r_m_a_n_c_e o _1_._4_ _I_n_t_e_r_f_a_c_e_s * _A_p_p_e_n_d_i_x_ _A_:_ _I_D_L_ _D_e_f_i_n_i_t_i_o_n_s * _A_p_p_e_n_d_i_x_ _B_:_ _J_a_v_a_ _L_a_n_g_u_a_g_e_ _B_i_n_d_i_n_g o _B_._1_ _O_t_h_e_r_ _X_P_a_t_h_ _i_n_t_e_r_f_a_c_e_s * _A_p_p_e_n_d_i_x_ _C_:_ _E_C_M_A_S_c_r_i_p_t_ _L_a_n_g_u_a_g_e_ _B_i_n_d_i_n_g * _A_p_p_e_n_d_i_x_ _D_:_ _A_c_k_n_o_w_l_e_d_g_e_m_e_n_t_s o _D_._1_ _P_r_o_d_u_c_t_i_o_n_ _S_y_s_t_e_m_s * _G_l_o_s_s_a_r_y * _R_e_f_e_r_e_n_c_e_s o _1_ _N_o_r_m_a_t_i_v_e_ _r_e_f_e_r_e_n_c_e_s o _2_ _I_n_f_o_r_m_a_t_i_v_e_ _r_e_f_e_r_e_n_c_e_s * _I_n_d_e_x 26 February 2004 ************ WW33CC CCooppyyrriigghhtt NNoottiicceess aanndd LLiicceennsseess ************ CCooppyyrriigghhtt ©© 22000044 _WW_oo_rr_ll_dd_ _WW_ii_dd_ee_ _WW_ee_bb_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm,, ((_MM_aa_ss_ss_aa_cc_hh_uu_ss_ee_tt_tt_ss_ _II_nn_ss_tt_ii_tt_uu_tt_ee_ _oo_ff _TT_ee_cc_hh_nn_oo_ll_oo_gg_yy,, _EE_uu_rr_oo_pp_ee_aa_nn_ _RR_ee_ss_ee_aa_rr_cc_hh_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm_ _ff_oo_rr_ _II_nn_ff_oo_rr_mm_aa_tt_ii_cc_ss_ _aa_nn_dd_ _MM_aa_tt_hh_ee_mm_aa_tt_ii_cc_ss,, _KK_ee_ii_oo _UU_nn_ii_vv_ee_rr_ss_ii_tt_yy)).. AAllll RRiigghhttss RReesseerrvveedd.. This document is published under the _W_3_C_®_ _D_o_c_u_m_e_n_t_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_ _a_n_d _L_i_c_e_n_s_e. The bindings within this document are published under the _W_3_C_® _S_o_f_t_w_a_r_e_ _C_o_p_y_r_i_g_h_t_ _N_o_t_i_c_e_ _a_n_d_ _L_i_c_e_n_s_e. The software license requires "Notice of any changes or modifications to the W3C files, including the date changes were made." Consequently, modified versions of the DOM bindings must document that they do not conform to the W3C standard; in the case of the IDL definitions, the pragma prefix can no longer be 'w3c.org'; in the case of the Java language binding, the package names can no longer be in the 'org.w3c' package. =============================================================================== ********** WW33CC®® DDooccuummeenntt CCooppyyrriigghhtt NNoottiiccee aanndd LLiicceennssee ********** NNoottee:: This section is a copy of the W3C® Document Notice and License and could be found at _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_C_o_n_s_o_r_t_i_u_m_/_L_e_g_a_l_/_2_0_0_2_/_c_o_p_y_r_i_g_h_t_-_d_o_c_u_m_e_n_t_s_- _2_0_0_2_1_2_3_1. CCooppyyrriigghhtt ©© 22000044 _WW_oo_rr_ll_dd_ _WW_ii_dd_ee_ _WW_ee_bb_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm,, ((_MM_aa_ss_ss_aa_cc_hh_uu_ss_ee_tt_tt_ss_ _II_nn_ss_tt_ii_tt_uu_tt_ee_ _oo_ff _TT_ee_cc_hh_nn_oo_ll_oo_gg_yy,, _EE_uu_rr_oo_pp_ee_aa_nn_ _RR_ee_ss_ee_aa_rr_cc_hh_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm_ _ff_oo_rr_ _II_nn_ff_oo_rr_mm_aa_tt_ii_cc_ss_ _aa_nn_dd_ _MM_aa_tt_hh_ee_mm_aa_tt_ii_cc_ss,, _KK_ee_ii_oo _UU_nn_ii_vv_ee_rr_ss_ii_tt_yy)).. AAllll RRiigghhttss RReesseerrvveedd.. hhttttpp::////wwwwww..ww33..oorrgg//CCoonnssoorrttiiuumm//LLeeggaall//22000022//ccooppyyrriigghhtt--ddooccuummeennttss--2200002211223311 Public documents on the W3C site are provided by the copyright holders under the following license. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on AALLLL copies of the document, or portions thereof, that you use: 1. A link or URL to the original W3C document. 2. The pre-existing copyright notice of the original author, or if it doesn't exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright © [$date-of- document] _W_o_r_l_d_ _W_i_d_e_ _W_e_b_ _C_o_n_s_o_r_t_i_u_m, (_M_a_s_s_a_c_h_u_s_e_t_t_s_ _I_n_s_t_i_t_u_t_e_ _o_f _T_e_c_h_n_o_l_o_g_y, _E_u_r_o_p_e_a_n_ _R_e_s_e_a_r_c_h_ _C_o_n_s_o_r_t_i_u_m_ _f_o_r_ _I_n_f_o_r_m_a_t_i_c_s_ _a_n_d_ _M_a_t_h_e_m_a_t_i_c_s, _K_e_i_o_ _U_n_i_v_e_r_s_i_t_y). All Rights Reserved. _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_C_o_n_s_o_r_t_i_u_m_/ _L_e_g_a_l_/_2_0_0_2_/_c_o_p_y_r_i_g_h_t_-_d_o_c_u_m_e_n_t_s_-_2_0_0_2_1_2_3_1" 3. IIff iitt eexxiissttss, the STATUS of the W3C document. When space permits, inclusion of the full text of this NNOOTTIICCEE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the _C_o_p_y_r_i_g_h_t_ _F_A_Q) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON- INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. =============================================================================== ********** WW33CC®® SSooffttwwaarree CCooppyyrriigghhtt NNoottiiccee aanndd LLiicceennssee ********** NNoottee:: This section is a copy of the W3C® Software Copyright Notice and License and could be found at _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_C_o_n_s_o_r_t_i_u_m_/_L_e_g_a_l_/_2_0_0_2_/_c_o_p_y_r_i_g_h_t_- _s_o_f_t_w_a_r_e_-_2_0_0_2_1_2_3_1 CCooppyyrriigghhtt ©© 22000044 _WW_oo_rr_ll_dd_ _WW_ii_dd_ee_ _WW_ee_bb_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm,, ((_MM_aa_ss_ss_aa_cc_hh_uu_ss_ee_tt_tt_ss_ _II_nn_ss_tt_ii_tt_uu_tt_ee_ _oo_ff _TT_ee_cc_hh_nn_oo_ll_oo_gg_yy,, _EE_uu_rr_oo_pp_ee_aa_nn_ _RR_ee_ss_ee_aa_rr_cc_hh_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm_ _ff_oo_rr_ _II_nn_ff_oo_rr_mm_aa_tt_ii_cc_ss_ _aa_nn_dd_ _MM_aa_tt_hh_ee_mm_aa_tt_ii_cc_ss,, _KK_ee_ii_oo _UU_nn_ii_vv_ee_rr_ss_ii_tt_yy)).. AAllll RRiigghhttss RReesseerrvveedd.. hhttttpp::////wwwwww..ww33..oorrgg//CCoonnssoorrttiiuumm//LLeeggaall//22000022//ccooppyyrriigghhtt--ssooffttwwaarree--2200002211223311 This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the _W_3_C_®_ _S_h_o_r_t_ _S_o_f_t_w_a_r_e_ _N_o_t_i_c_e should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. 3. Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. ********** WW33CC®® SShhoorrtt SSooffttwwaarree NNoottiiccee ********** NNoottee:: This section is a copy of the W3C® Short Software Notice and could be found at _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_C_o_n_s_o_r_t_i_u_m_/_L_e_g_a_l_/_2_0_0_2_/_c_o_p_y_r_i_g_h_t_-_s_o_f_t_w_a_r_e_-_s_h_o_r_t_- _n_o_t_i_c_e_-_2_0_0_2_1_2_3_1 CCooppyyrriigghhtt ©© 22000044 _WW_oo_rr_ll_dd_ _WW_ii_dd_ee_ _WW_ee_bb_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm,, ((_MM_aa_ss_ss_aa_cc_hh_uu_ss_ee_tt_tt_ss_ _II_nn_ss_tt_ii_tt_uu_tt_ee_ _oo_ff _TT_ee_cc_hh_nn_oo_ll_oo_gg_yy,, _EE_uu_rr_oo_pp_ee_aa_nn_ _RR_ee_ss_ee_aa_rr_cc_hh_ _CC_oo_nn_ss_oo_rr_tt_ii_uu_mm_ _ff_oo_rr_ _II_nn_ff_oo_rr_mm_aa_tt_ii_cc_ss_ _aa_nn_dd_ _MM_aa_tt_hh_ee_mm_aa_tt_ii_cc_ss,, _KK_ee_ii_oo _UU_nn_ii_vv_ee_rr_ss_ii_tt_yy)).. AAllll RRiigghhttss RReesseerrvveedd.. Copyright © [$date-of-software] _W_o_r_l_d_ _W_i_d_e_ _W_e_b_ _C_o_n_s_o_r_t_i_u_m, (_M_a_s_s_a_c_h_u_s_e_t_t_s _I_n_s_t_i_t_u_t_e_ _o_f_ _T_e_c_h_n_o_l_o_g_y, _E_u_r_o_p_e_a_n_ _R_e_s_e_a_r_c_h_ _C_o_n_s_o_r_t_i_u_m_ _f_o_r_ _I_n_f_o_r_m_a_t_i_c_s_ _a_n_d _M_a_t_h_e_m_a_t_i_c_s, _K_e_i_o_ _U_n_i_v_e_r_s_i_t_y). All Rights Reserved. This work is distributed under the W3C® Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 26 February 2004 ************ 11.. DDooccuummeenntt OObbjjeecctt MMooddeell XXPPaatthh ************ Editor: Ray Whitmer, Netscape/AOL ********** TTaabbllee ooff ccoonntteennttss ********** * _1_._1_ _I_n_t_r_o_d_u_c_t_i_o_n * _1_._2_ _M_a_p_p_i_n_g_ _D_O_M_ _t_o_ _X_P_a_t_h o _1_._2_._1_ _E_l_e_m_e_n_t_ _N_o_d_e_s o _1_._2_._2_ _A_t_t_r_i_b_u_t_e_ _N_o_d_e_s o _1_._2_._3_ _N_a_m_e_s_p_a_c_e_ _N_o_d_e_s o _1_._2_._4_ _T_e_x_t_ _N_o_d_e_s o _1_._2_._5_ _E_n_t_i_t_y_ _R_e_f_e_r_e_n_c_e_ _N_o_d_e_s o _1_._2_._6_ _C_o_m_m_e_n_t_ _N_o_d_e_s o _1_._2_._7_ _P_r_o_c_e_s_s_i_n_g_ _I_n_s_t_r_u_c_t_i_o_n_ _N_o_d_e_s o _1_._2_._8_ _D_o_c_u_m_e_n_t_ _o_r_d_e_r * _1_._3_ _C_o_n_f_o_r_m_a_n_c_e * _1_._4_ _I_n_t_e_r_f_a_c_e_s o _X_P_a_t_h_E_x_c_e_p_t_i_o_n, _X_P_a_t_h_E_x_c_e_p_t_i_o_n_C_o_d_e, _X_P_a_t_h_E_v_a_l_u_a_t_o_r, _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n, _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r, _X_P_a_t_h_R_e_s_u_l_t, _X_P_a_t_h_N_a_m_e_s_p_a_c_e ********** 11..11 IInnttrroodduuccttiioonn ********** XPath 1.0 [_X_P_a_t_h_ _1_._0] is becoming an important part of a variety of many specifications including XForms, XPointer, XSL, XML Query, and so on. It is also a clear advantage for user applications which use DOM to be able to use XPath expressions to locate nodes automatically and declaratively. This specification was created to map between the Document Object Model's representation of the W3C Information Set and XPath's _m_o_d_e_l to permit XPath functions to be supplied and results returned within the framework of DOM _A_P_Is in a standard, interoperable way, allowing also for _l_i_v_e_n_e_s_s of data, which is not addressed by the XPath specification but is present in results coming from the DOM hierarchy. ********** 11..22 MMaappppiinngg DDOOMM ttoo XXPPaatthh ********** This section presents a mapping between the Document Object Model [_D_O_M_ _L_e_v_e_l_ _2 _C_o_r_e] and the XPath 1.0 [_X_P_a_t_h_ _1_._0] model for the purposes of implementing the APIs. ******** 11..22..11 EElleemmeenntt NNooddeess ******** The DOM model uses Element nodes to represent _EE_ll_ee_mm_ee_nn_tt_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss. These nodes of a document are directly used to represent the elements of an XPath result. ******** 11..22..22 AAttttrriibbuuttee NNooddeess ******** The DOM model uses Attr nodes to represent _AA_tt_tt_rr_ii_bb_uu_tt_ee_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss of attribute and namespace attribute properties of _EE_ll_ee_mm_ee_nn_tt_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm. These nodes have no parent, but have an ownerElement which can be used as XPath defines an attribute's parent. XPath 1.0 does not make available the namespace attributes of an element. The DOM implementation of XPath 1.0 using these defined interfaces never directly returns Attr nodes of namespace attributes, but returned Element nodes still contain them. ******** 11..22..33 NNaammeessppaaccee NNooddeess ******** The XPath model expects namespace nodes for each in-scope namespace to be attached to each _e_l_e_m_e_n_t. DOM only maintains the namespace attributes instead of replicating in-scope namespaces on each Element where they are in-scope. The DOM implementation of XPath produces a new node of type XPATH_NAMESPACE_NODE, defined in the _X_P_a_t_h_N_a_m_e_s_p_a_c_e interface, to properly preserve identity and ordering in a way that is compatible with XPath. This node type is only visible using the XPath evaluation methods. The set of in-scope namespaces of an element is the default xml namespace combined with the contributions of namespace attributes of the current and all ancestor elements. In addition to explicit namespace attributes, any element has an implicit declaration of its own prefix, if any, or if no prefix then of the default namespace, which is enforced during namespace serialization, fixup, and lookup, which must be added to the set of in-scope namespaces when generating namespace nodes for an element. This causes the set of namespace nodes to be consistent with serialization, fixup, and lookup of namespaces in DOM Level 3. ******** 11..22..44 TTeexxtt NNooddeess ******** The XPath model relies on the XML Information Set [_X_M_L_ _I_n_f_o_r_m_a_t_i_o_n_ _S_e_t] ands represents _CC_hh_aa_rr_aa_cc_tt_ee_rr_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss in a single logical text node where DOM may have multiple fragmented Text nodes due to cdata sections, entity references, etc. Instead of returning multiple nodes where XPath sees a single logical text node, only the first non-empty DOM Text or CDATASection node of any logical XPath text will be returned in the node set. Applications using XPath in an environment with fragmented text nodes must manually gather the text of a single logical text node possibly from multiple nodes beginning with the first Text node or CDATASection node returned by the implementation. NNoottee:: In an attempt to better implement the XML Information Set, DOM Level 3 Core [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e] adds the attribute wholeText on the Text interface for retrieving the whole text for _l_o_g_i_c_a_l_l_y_-_a_d_j_a_c_e_n_t_ _T_e_x_t_ _n_o_d_e_s and the method replaceWholeText for replacing those nodes. ******** 11..22..55 EEnnttiittyy RReeffeerreennccee NNooddeess ******** The DOM model may represent _UU_nn_ee_xx_pp_aa_nn_dd_ee_dd_ _EE_nn_tt_ii_tt_yy_ _RR_ee_ff_ee_rr_ee_nn_cc_ee_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss or may provide the position and URI of expanded entity hierarchies by using EntityReference nodes. XPath 1.0 does not preserve corresponding information. Where the node represents an unexpanded entity reference, it is skipped as dictated by the XPath specifications for all infoset items besides those specifically processed. Where there is a hierarchy underneath the node, these nodes are processed as though they were siblings of the entity reference, as is consistent with the rest of the DOM specification. EntityReference nodes found within a DOM hierarchy are never returned as a node of the result, but returned nodes may contain or be contained within an EntityReference node. Text may be split partially inside and partially outside of an EntityReference node, but this is solved by handling Text nodes as described in the previous section. ******** 11..22..66 CCoommmmeenntt NNooddeess ******** The DOM model uses Comment nodes to represent _CC_oo_mm_mm_ee_nn_tt_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss. These nodes of a document are directly used to represent the comments of an XPath result. ******** 11..22..77 PPrroocceessssiinngg IInnssttrruuccttiioonn NNooddeess ******** The DOM model uses ProcessingInstruction nodes to represent _PP_rr_oo_cc_ee_ss_ss_ii_nn_gg _II_nn_ss_tt_rr_uu_cc_tt_ii_oo_nn_ _II_nn_ff_oo_rr_mm_aa_tt_ii_oo_nn_ _II_tt_ee_mm_ss. These nodes of a document are directly used to represent the processing instructions of an XPath result. ******** 11..22..88 DDooccuummeenntt oorrddeerr ******** The _d_o_c_u_m_e_n_t_ _o_r_d_e_r of nodes in the DOM Core has been defined to be compatible with the _XX_PP_aa_tt_hh_ _dd_oo_cc_uu_mm_ee_nn_tt_ _oo_rr_dd_ee_rr. The XPath DOM extends the document order of the DOM Core to include the _X_P_a_t_h_N_a_m_e_s_p_a_c_e nodes. Element nodes occur before their children. The attribute nodes and namespace nodes of an element occur before the children of the element. The namespace nodes are defined to occur before the attribute nodes. The relative order of namespace nodes is implementation- dependent. The relative order of attribute nodes is implementation-dependent. The compareTreePosition method on the Node interface defined in the DOM Core must compare the _X_P_a_t_h_N_a_m_e_s_p_a_c_e nodes using this extended document order if the XPath DOM module is supported. NNoottee:: It is possible that in future versions of XPath, the order of namespace nodes or other aspects of document order may change incompatibly. ********** 11..33 CCoonnffoorrmmaannccee ********** This section explains conformance to DOM Level 3 XPath Module. A DOM implementation must not return true to hasFeature("xpath", "3.0") unless the implementation conforms to that module. As documented in [_D_O_M_ _L_e_v_e_l_ _3 _C_o_r_e], if a null or empty string is passed in for the second parameter, then conformance is still required to some version of the DOM XPath Module or false must be returned. A conformant implementation is DOM Level 3 XPath must support all the interfaces as specified in that specification. In addition to implementing the interfaces in the DOM XPath Module, a conforming implementation must correctly implement each part of the XPath 1.0 specification when evaluating expressions including Location Paths, Expressions, the Core Function Library, and the mapping between DOM and the XPath 1.0 data model described in the DOM Level 3 XPath Module. The XPath id()function must return the corresponding element, if any, returned by the DOM method Document.getElementById. After meeting the requirements for conformance, a conforming implementation may implement additional functions and variables. Applications which evaluate expressions using these extensions will not necessarily be portable to other implementations of the DOM Level 3 XPath Module. ********** 11..44 IInntteerrffaacceess ********** An implementation is DOM Level 3 XPath conformant if it supports the Core module defined in [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e] and the module defined in this specification. An implementation conforms to a DOM module if it supports all the interfaces for that module and the associated semantics. A DOM application may use the hasFeature(feature, version) method of the DOMImplementation interface with parameter values "XPath" and "3.0" (respectively) to determine whether or not the XPath module is supported by the implementation. In order to fully support this module, an implementation must also support the "Core" feature defined in the DOM Level 2 Core specification [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e]. A DOM implementation must not return true to the hasFeature(feature, version) method of the DOMImplementation interface for that feature unless the implementation conforms to that module. The version number for the feature used in this document is "3.0". EExxcceeppttiioonn XXPPaatthhEExxcceeppttiioonn A new exception has been created for exceptions specific to these XPath interfaces. IIDDLL DDeeffiinniittiioonn exception _X_P_a_t_h_E_x_c_e_p_t_i_o_n { unsigned short code; }; // XPathExceptionCode const unsigned short _I_N_V_A_L_I_D___E_X_P_R_E_S_S_I_O_N___E_R_R = 51; const unsigned short _T_Y_P_E___E_R_R = 52; DDeeffiinniittiioonn ggrroouupp XXPPaatthhEExxcceeppttiioonnCCooddee DDeeffiinneedd CCoonnssttaannttss INVALID_EXPRESSION_ERR If the expression has a syntax error or otherwise is not a legal expression according to the rules of the specific _X_P_a_t_h_E_v_a_l_u_a_t_o_r or contains specialized extension functions or variables not supported by this implementation. TYPE_ERR If the expression cannot be converted to return the specified type. IInntteerrffaaccee XXPPaatthhEEvvaalluuaattoorr The evaluation of XPath expressions is provided by XPathEvaluator. In a DOM implementation which supports the XPath 3.0 feature, as described above, the XPathEvaluator interface will be implemented on the same object which implements the Document interface permitting it to be obtained by the usual binding-specific method such as casting or by using the DOM Level 3 getInterface method. In this case the implementation obtained from the Document supports the XPath DOM module and is compatible with the XPath 1.0 specification. Evaluation of expressions with specialized extension functions or variables may not work in all implementations and is, therefore, not portable. XPathEvaluator implementations may be available from other sources that could provide specific support for specialized extension functions or variables as would be defined by other specifications. IIDDLL DDeeffiinniittiioonn interface _X_P_a_t_h_E_v_a_l_u_a_t_o_r { _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n _c_r_e_a_t_e_E_x_p_r_e_s_s_i_o_n(in DOMString expression, in _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r resolver) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, DOMException); _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r _c_r_e_a_t_e_N_S_R_e_s_o_l_v_e_r(in Node nodeResolver); DOMObject _e_v_a_l_u_a_t_e(in DOMString expression, in Node contextNode, in _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r resolver, in unsigned short type, in DOMObject result) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, DOMException); }; MMeetthhooddss createExpression Creates a parsed XPath expression with resolved namespaces. This is useful when an expression will be reused in an application since it makes it possible to compile the expression string into a more efficient internal form and preresolve all _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x_e_s which occur within the expression. PPaarraammeetteerrss expression of type DOMString The XPath expression string to be parsed. resolver of type _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate _n_a_m_e_s_p_a_c_e_ _U_R_I_s. If this is specified as null, any _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x within the expression will result in DOMException being thrown with the code NAMESPACE_ERR. RReettuurrnn VVaalluuee _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n The compiled form of the XPath expression. EExxcceeppttiioonnss _X_P_a_t_h_E_x_c_e_p_t_i_o_n INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the XPathEvaluator. DOMException NAMESPACE_ERR: Raised if the expression contains _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x_e_s which cannot be resolved by the specified _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r. createNSResolver Adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document. This adapter works like the DOM Level 3 method lookupNamespaceURI on nodes in resolving the namespaceURI from a given prefix using the current information available in the node's hierarchy at the time lookupNamespaceURI is called. also correctly resolving the implicit xml prefix. PPaarraammeetteerrss nodeResolver of type Node The node to be used as a context for namespace resolution. RReettuurrnn VVaalluuee _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r which resolves namespaces with respect to the definitions in scope for a specified node. NNoo EExxcceeppttiioonnss evaluate Evaluates an XPath expression string and returns a result of the specified type if possible. PPaarraammeetteerrss expression of type DOMString The XPath expression string to be parsed and evaluated. contextNode of type Node The context is context node for the evaluation of this XPath expression. If the XPathEvaluator was obtained by casting the Document then this must be owned by the same document and must be a Document, Element, Attribute, Text, CDATASection, Comment, ProcessingInstruction, or _X_P_a_t_h_N_a_m_e_s_p_a_c_e node. If the context node is a Text or a CDATASection, then the context is interpreted as the whole logical text node as seen by XPath, unless the node is empty in which case it may not serve as the XPath context. resolver of type _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate _n_a_m_e_s_p_a_c_e_ _U_R_I_s. If this is specified as null, any _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x within the expression will result in DOMException being thrown with the code NAMESPACE_ERR. type of type unsigned short If a specific type is specified, then the result will be returned as the corresponding type. For XPath 1.0 results, this must be one of the codes of the _X_P_a_t_h_R_e_s_u_l_t interface. result of type DOMObject The result specifies a specific result object which may be reused and returned by this method. If this is specified as nullor the implementation does not reuse the specified result, a new result object will be constructed and returned. For XPath 1.0 results, this object will be of type _X_P_a_t_h_R_e_s_u_l_t. RReettuurrnn VVaalluuee DOMObject The result of the evaluation of the XPath expression. For XPath 1.0 results, this object will be of type _X_P_a_t_h_R_e_s_u_l_t. EExxcceeppttiioonnss _X_P_a_t_h_E_x_c_e_p_t_i_o_n INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the XPathEvaluatori TYPE_ERR: Raised if the result cannot be converted to return the specified type. DOMException NAMESPACE_ERR: Raised if the expression contains _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x_e_s which cannot be resolved by the specified _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r. WRONG_DOCUMENT_ERR: The Node is from a document that is not supported by this XPathEvaluator. NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath context node or the request type is not permitted by this XPathEvaluator. IInntteerrffaaccee XXPPaatthhEExxpprreessssiioonn The XPathExpression interface represents a parsed and resolved XPath expression. IIDDLL DDeeffiinniittiioonn interface _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n { DOMObject _e_v_a_l_u_a_t_e(in Node contextNode, in unsigned short type, in DOMObject result) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, DOMException); }; MMeetthhooddss evaluate Evaluates this XPath expression and returns a result. PPaarraammeetteerrss contextNode of type Node The context is context node for the evaluation of this XPath expression. If the XPathEvaluator was obtained by casting the Document then this must be owned by the same document and must be a Document, Element, Attribute, Text, CDATASection, Comment, ProcessingInstruction, or _X_P_a_t_h_N_a_m_e_s_p_a_c_e node. If the context node is a Text or a CDATASection, then the context is interpreted as the whole logical text node as seen by XPath, unless the node is empty in which case it may not serve as the XPath context. type of type unsigned short If a specific type is specified, then the result will be coerced to return the specified type relying on XPath conversions and fail if the desired coercion is not possible. This must be one of the type codes of _X_P_a_t_h_R_e_s_u_l_t. result of type DOMObject The result specifies a specific result object which may be reused and returned by this method. If this is specified as nullor the implementation does not reuse the specified result, a new result object will be constructed and returned. For XPath 1.0 results, this object will be of type _X_P_a_t_h_R_e_s_u_l_t. RReettuurrnn VVaalluuee DOMObject The result of the evaluation of the XPath expression. For XPath 1.0 results, this object will be of type _X_P_a_t_h_R_e_s_u_l_t. EExxcceeppttiioonnss _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: Raised if the result cannot be converted to return the specified type. DOMException WRONG_DOCUMENT_ERR: The Node is from a document that is not supported by the XPathEvaluator that created this XPathExpression. NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath context node or the request type is not permitted by this XPathExpression. IInntteerrffaaccee XXPPaatthhNNSSRReessoollvveerr The XPathNSResolver interface permit prefix strings in the expression to be properly bound to namespaceURI strings. _X_P_a_t_h_E_v_a_l_u_a_t_o_r can construct an implementation of XPathNSResolver from a node, or the interface may be implemented by any application. IIDDLL DDeeffiinniittiioonn interface _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r { DOMString _l_o_o_k_u_p_N_a_m_e_s_p_a_c_e_U_R_I(in DOMString prefix); }; MMeetthhooddss lookupNamespaceURI Look up the _n_a_m_e_s_p_a_c_e_ _U_R_I associated to the given _n_a_m_e_s_p_a_c_e _p_r_e_f_i_x. The XPath evaluator must never call this with a null or empty argument, because the result of doing this is undefined. PPaarraammeetteerrss prefix of type DOMString The prefix to look for. RReettuurrnn VVaalluuee DOMString Returns the associated _n_a_m_e_s_p_a_c_e_ _U_R_I or null if none is found. NNoo EExxcceeppttiioonnss IInntteerrffaaccee XXPPaatthhRReessuulltt The XPathResult interface represents the result of the evaluation of an XPath 1.0 expression within the context of a particular node. Since evaluation of an XPath expression can result in various result types, this object makes it possible to discover and manipulate the type and value of the result. IIDDLL DDeeffiinniittiioonn interface _X_P_a_t_h_R_e_s_u_l_t { // XPathResultType const unsigned short _A_N_Y___T_Y_P_E = 0; const unsigned short _N_U_M_B_E_R___T_Y_P_E = 1; const unsigned short _S_T_R_I_N_G___T_Y_P_E = 2; const unsigned short _B_O_O_L_E_A_N___T_Y_P_E = 3; const unsigned short _U_N_O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E = 4; const unsigned short _O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E = 5; const unsigned short _U_N_O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E = 6; const unsigned short _O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E = 7; const unsigned short _A_N_Y___U_N_O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E = 8; const unsigned short _F_I_R_S_T___O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E = 9; readonly attribute unsigned short _r_e_s_u_l_t_T_y_p_e; readonly attribute double _n_u_m_b_e_r_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute DOMString _s_t_r_i_n_g_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute boolean _b_o_o_l_e_a_n_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute Node _s_i_n_g_l_e_N_o_d_e_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute boolean _i_n_v_a_l_i_d_I_t_e_r_a_t_o_r_S_t_a_t_e; readonly attribute unsigned long _s_n_a_p_s_h_o_t_L_e_n_g_t_h; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval Node _i_t_e_r_a_t_e_N_e_x_t() raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, DOMException); Node _s_n_a_p_s_h_o_t_I_t_e_m(in unsigned long index) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n); }; DDeeffiinniittiioonn ggrroouupp XXPPaatthhRReessuullttTTyyppee An integer indicating what type of result this is. If a specific type is specified, then the result will be returned as the corresponding type, using _XX_PP_aa_tt_hh_ _tt_yy_pp_ee_ _cc_oo_nn_vv_ee_rr_ss_ii_oo_nn_ss where required and possible. DDeeffiinneedd CCoonnssttaannttss ANY_TYPE This code does not represent a specific type. An evaluation of an XPath expression will never produce this type. If this type is requested, then the evaluation returns whatever type naturally results from evaluation of the expression. If the natural result is a node set when ANY_TYPE was requested, then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other representation of a node set must be explicitly requested. ANY_UNORDERED_NODE_TYPE The result is a _nn_oo_dd_ee_ _ss_ee_tt as defined by [_X_P_a_t_h_ _1_._0] and will be accessed as a single node, which may be nullif the node set is empty. Document modification does not invalidate the node, but may mean that the result node no longer corresponds to the current document. This is a convenience that permits optimization since the implementation can stop once any node in the resulting set has been found. If there is more than one node in the actual result, the single node returned might not be the first in document order. BOOLEAN_TYPE The result is a _bb_oo_oo_ll_ee_aa_nn as defined by [_X_P_a_t_h_ _1_._0]. Document modification does not invalidate the boolean, but may mean that reevaluation would not yield the same boolean. FIRST_ORDERED_NODE_TYPE The result is a _nn_oo_dd_ee_ _ss_ee_tt as defined by [_X_P_a_t_h_ _1_._0] and will be accessed as a single node, which may be null if the node set is empty. Document modification does not invalidate the node, but may mean that the result node no longer corresponds to the current document. This is a convenience that permits optimization since the implementation can stop once the first node in document order of the resulting set has been found. If there are more than one node in the actual result, the single node returned will be the first in document order. NUMBER_TYPE The result is a _nn_uu_mm_bb_ee_rr as defined by [_X_P_a_t_h_ _1_._0]. Document modification does not invalidate the number, but may mean that reevaluation would not yield the same number. ORDERED_NODE_ITERATOR_TYPE The result is a node set as defined by [_X_P_a_t_h_ _1_._0] that will be accessed iteratively, which will produce document-ordered nodes. Document modification invalidates the iteration. ORDERED_NODE_SNAPSHOT_TYPE The result is a _nn_oo_dd_ee_ _ss_ee_tt as defined by [_X_P_a_t_h_ _1_._0] that will be accessed as a snapshot list of nodes that will be in original document order. Document modification does not invalidate the snapshot but may mean that reevaluation would not yield the same snapshot and nodes in the snapshot may have been altered, moved, or removed from the document. STRING_TYPE The result is a _ss_tt_rr_ii_nn_gg as defined by [_X_P_a_t_h_ _1_._0]. Document modification does not invalidate the string, but may mean that the string no longer corresponds to the current document. UNORDERED_NODE_ITERATOR_TYPE The result is a _nn_oo_dd_ee_ _ss_ee_tt as defined by [_X_P_a_t_h_ _1_._0] that will be accessed iteratively, which may not produce nodes in a particular order. Document modification invalidates the iteration. This is the default type returned if the result is a node set and ANY_TYPE is requested. UNORDERED_NODE_SNAPSHOT_TYPE The result is a _nn_oo_dd_ee_ _ss_ee_tt as defined by [_X_P_a_t_h_ _1_._0] that will be accessed as a snapshot list of nodes that may not be in a particular order. Document modification does not invalidate the snapshot but may mean that reevaluation would not yield the same snapshot and nodes in the snapshot may have been altered, moved, or removed from the document. AAttttrriibbuutteess booleanValue of type boolean, readonly The value of this boolean result. EExxcceeppttiioonnss oonn rreettrriieevvaall _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not BOOLEAN_TYPE. invalidIteratorState of type boolean, readonly Signifies that the iterator has become invalid. True if resultType is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE and the document has been modified since this result was returned. numberValue of type double, readonly The value of this number result. If the native double type of the DOM binding does not directly support the exact IEEE 754 result of the XPath expression, then it is up to the definition of the binding to specify how the XPath number is converted to the native binding number. EExxcceeppttiioonnss oonn rreettrriieevvaall _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not NUMBER_TYPE. resultType of type unsigned short, readonly A code representing the type of this result, as defined by the type constants. singleNodeValue of type Node, readonly The value of this single node result, which may be null. EExxcceeppttiioonnss oonn rreettrriieevvaall _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not ANY_UNORDERED_NODE_TYPE or FIRST_ORDERED_NODE_TYPE. snapshotLength of type unsigned long, readonly The number of nodes in the result snapshot. Valid values for snapshotItem indices are 0 to snapshotLength-1 inclusive. EExxcceeppttiioonnss oonn rreettrriieevvaall _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE. stringValue of type DOMString, readonly The value of this string result. EExxcceeppttiioonnss oonn rreettrriieevvaall _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not STRING_TYPE. MMeetthhooddss iterateNext Iterates and returns the next node from the node set or nullif there are no more nodes. RReettuurrnn VVaalluuee Node Returns the next node. EExxcceeppttiioonnss _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE. DOMException INVALID_STATE_ERR: The document has been mutated since the result was returned. NNoo PPaarraammeetteerrss snapshotItem Returns the indexth item in the snapshot collection. If index is greater than or equal to the number of nodes in the list, this method returns null. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. PPaarraammeetteerrss index of type unsigned long Index into the snapshot collection. RReettuurrnn VVaalluuee Node The node at the indexth position in the NodeList, or null if that is not a valid index. EExxcceeppttiioonnss _X_P_a_t_h_E_x_c_e_p_t_i_o_n TYPE_ERR: raised if resultType is not UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE. IInntteerrffaaccee XXPPaatthhNNaammeessppaaccee The XPathNamespace interface is returned by _X_P_a_t_h_R_e_s_u_l_t interfaces to represent the XPath namespace node type that DOM lacks. There is no public constructor for this node type. Attempts to place it into a hierarchy or a NamedNodeMap result in a DOMException with the code HIERARCHY_REQUEST_ERR. This node is _r_e_a_d_ _o_n_l_y, so methods or setting of attributes that would mutate the node result in a DOMException with the code NO_MODIFICATION_ALLOWED_ERR. The core specification describes attributes of the Node interface that are different for different node types but does not describe XPATH_NAMESPACE_NODE, so here is a description of those attributes for this node type. All attributes of Node not described in this section have a null or false value. ownerDocument matches the ownerDocument of the ownerElement even if the element is later adopted. nodeName is always the string "#namespace". prefix is the prefix of the namespace represented by the node. localName is the same as prefix. nodeType is equal to XPATH_NAMESPACE_NODE. namespaceURI is the namespace URI of the namespace represented by the node. nodeValue is the same as namespaceURI. adoptNode, cloneNode, and importNode fail on this node type by raising a DOMException with the code NOT_SUPPORTED_ERR. NNoottee:: In future versions of the XPath specification, the definition of a namespace node may be changed incomatibly, in which case incompatible changes to field values may be required to implement versions beyond XPath 1.0. IIDDLL DDeeffiinniittiioonn interface _X_P_a_t_h_N_a_m_e_s_p_a_c_e : Node { // XPathNodeType const unsigned short _X_P_A_T_H___N_A_M_E_S_P_A_C_E___N_O_D_E = 13; readonly attribute Element _o_w_n_e_r_E_l_e_m_e_n_t; }; DDeeffiinniittiioonn ggrroouupp XXPPaatthhNNooddeeTTyyppee An integer indicating which type of node this is. NNoottee:: There is currently only one type of node which is specific to XPath. The numbers in this list must not collide with the values assigned to core node types. DDeeffiinneedd CCoonnssttaannttss XPATH_NAMESPACE_NODE The node is a Namespace. AAttttrriibbuutteess ownerElement of type Element, readonly The Element on which the namespace was in scope when it was requested. This does not change on a returned namespace node even if the document changes such that the namespace goes out of scope on that _e_l_e_m_e_n_t and this node is no longer found there by XPath. 26 February 2004 ************ AAppppeennddiixx AA:: IIDDLL DDeeffiinniittiioonnss ************ This appendix contains the complete OMG IDL [_O_M_G_ _I_D_L] for the Level 3 Document Object Model XPath definitions. The IDL files are also available as: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_4_/_N_O_T_E_-_D_O_M_-_L_e_v_e_l_- _3_-_X_P_a_t_h_-_2_0_0_4_0_2_2_6_/_i_d_l_._z_i_p ******** _xx_pp_aa_tt_hh_.._ii_dd_ll:: ******** // File: xpath.idl #ifndef _XPATH_IDL_ #define _XPATH_IDL_ #include "dom.idl" #pragma prefix "dom.w3c.org" module xpath { typedef dom::DOMString DOMString; typedef dom::Node Node; typedef dom::DOMObject DOMObject; typedef dom::Element Element; interface XPathNSResolver; interface XPathExpression; exception _X_P_a_t_h_E_x_c_e_p_t_i_o_n { unsigned short code; }; // XPathExceptionCode const unsigned short _I_N_V_A_L_I_D___E_X_P_R_E_S_S_I_O_N___E_R_R = 51; const unsigned short _T_Y_P_E___E_R_R = 52; interface _X_P_a_t_h_E_v_a_l_u_a_t_o_r { _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n _c_r_e_a_t_e_E_x_p_r_e_s_s_i_o_n(in DOMString expression, in _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r resolver) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, dom::DOMException); _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r _c_r_e_a_t_e_N_S_R_e_s_o_l_v_e_r(in Node nodeResolver); DOMObject _e_v_a_l_u_a_t_e(in DOMString expression, in Node contextNode, in _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r resolver, in unsigned short type, in DOMObject result) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, dom::DOMException); }; interface _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n { DOMObject _e_v_a_l_u_a_t_e(in Node contextNode, in unsigned short type, in DOMObject result) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, dom::DOMException); }; interface _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r { DOMString _l_o_o_k_u_p_N_a_m_e_s_p_a_c_e_U_R_I(in DOMString prefix); }; interface _X_P_a_t_h_R_e_s_u_l_t { // XPathResultType const unsigned short _A_N_Y___T_Y_P_E = 0; const unsigned short _N_U_M_B_E_R___T_Y_P_E = 1; const unsigned short _S_T_R_I_N_G___T_Y_P_E = 2; const unsigned short _B_O_O_L_E_A_N___T_Y_P_E = 3; const unsigned short _U_N_O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E = 4; const unsigned short _O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E = 5; const unsigned short _U_N_O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E = 6; const unsigned short _O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E = 7; const unsigned short _A_N_Y___U_N_O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E = 8; const unsigned short _F_I_R_S_T___O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E = 9; readonly attribute unsigned short _r_e_s_u_l_t_T_y_p_e; readonly attribute double _n_u_m_b_e_r_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute DOMString _s_t_r_i_n_g_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute boolean _b_o_o_l_e_a_n_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute Node _s_i_n_g_l_e_N_o_d_e_V_a_l_u_e; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval readonly attribute boolean _i_n_v_a_l_i_d_I_t_e_r_a_t_o_r_S_t_a_t_e; readonly attribute unsigned long _s_n_a_p_s_h_o_t_L_e_n_g_t_h; // raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n) on retrieval Node _i_t_e_r_a_t_e_N_e_x_t() raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n, dom::DOMException); Node _s_n_a_p_s_h_o_t_I_t_e_m(in unsigned long index) raises(_X_P_a_t_h_E_x_c_e_p_t_i_o_n); }; interface _X_P_a_t_h_N_a_m_e_s_p_a_c_e : Node { // XPathNodeType const unsigned short _X_P_A_T_H___N_A_M_E_S_P_A_C_E___N_O_D_E = 13; readonly attribute Element _o_w_n_e_r_E_l_e_m_e_n_t; }; }; #endif // _XPATH_IDL_ 26 February 2004 ************ AAppppeennddiixx BB:: JJaavvaa LLaanngguuaaggee BBiinnddiinngg ************ This appendix contains the complete Java [_J_a_v_a] bindings for the Level 3 Document Object Model XPath. The Java files are also available as _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_4_/_N_O_T_E_-_D_O_M_-_L_e_v_e_l_- _3_-_X_P_a_t_h_-_2_0_0_4_0_2_2_6_/_j_a_v_a_-_b_i_n_d_i_n_g_._z_i_p ********** BB..11 OOtthheerr XXPPaatthh iinntteerrffaacceess ********** ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhEExxcceeppttiioonn..jjaavvaa:: ******** package org.w3c.dom.xpath; public class XPathException extends RuntimeException { public XPathException(short code, String message) { super(message); this.code = code; } public short code; // XPathExceptionCode public static final short INVALID_EXPRESSION_ERR = 51; public static final short TYPE_ERR = 52; } ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhEEvvaalluuaattoorr..jjaavvaa:: ******** package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathEvaluator { public XPathExpression createExpression(String expression, XPathNSResolver resolver) throws XPathException, DOMException; public XPathNSResolver createNSResolver(Node nodeResolver); public Object evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) throws XPathException, DOMException; } ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhEExxpprreessssiioonn..jjaavvaa:: ******** package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathExpression { public Object evaluate(Node contextNode, short type, Object result) throws XPathException, DOMException; } ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhNNSSRReessoollvveerr..jjaavvaa:: ******** package org.w3c.dom.xpath; public interface XPathNSResolver { public String lookupNamespaceURI(String prefix); } ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhRReessuulltt..jjaavvaa:: ******** package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathResult { // XPathResultType public static final short ANY_TYPE = 0; public static final short NUMBER_TYPE = 1; public static final short STRING_TYPE = 2; public static final short BOOLEAN_TYPE = 3; public static final short UNORDERED_NODE_ITERATOR_TYPE = 4; public static final short ORDERED_NODE_ITERATOR_TYPE = 5; public static final short UNORDERED_NODE_SNAPSHOT_TYPE = 6; public static final short ORDERED_NODE_SNAPSHOT_TYPE = 7; public static final short ANY_UNORDERED_NODE_TYPE = 8; public static final short FIRST_ORDERED_NODE_TYPE = 9; public short getResultType(); public double getNumberValue() throws XPathException; public String getStringValue() throws XPathException; public boolean getBooleanValue() throws XPathException; public Node getSingleNodeValue() throws XPathException; public boolean getInvalidIteratorState(); public int getSnapshotLength() throws XPathException; public Node iterateNext() throws XPathException, DOMException; public Node snapshotItem(int index) throws XPathException; } ******** oorrgg//ww33cc//ddoomm//xxppaatthh//XXPPaatthhNNaammeessppaaccee..jjaavvaa:: ******** package org.w3c.dom.xpath; import org.w3c.dom.Element; import org.w3c.dom.Node; public interface XPathNamespace extends Node { // XPathNodeType public static final short XPATH_NAMESPACE_NODE = 13; public Element getOwnerElement(); } 26 February 2004 ************ AAppppeennddiixx CC:: EECCMMAASSccrriipptt LLaanngguuaaggee BBiinnddiinngg ************ This appendix contains the complete ECMAScript [_E_C_M_A_S_c_r_i_p_t] binding for the Level 3 Document Object Model XPath definitions. Properties of the XXPPaatthhEExxcceeppttiioonn Constructor function: XXPPaatthhEExxcceeppttiioonn..IINNVVAALLIIDD__EEXXPPRREESSSSIIOONN__EERRRR The value of the constant XXPPaatthhEExxcceeppttiioonn..IINNVVAALLIIDD__EEXXPPRREESSSSIIOONN__EERRRR is 5511. XXPPaatthhEExxcceeppttiioonn..TTYYPPEE__EERRRR The value of the constant XXPPaatthhEExxcceeppttiioonn..TTYYPPEE__EERRRR is 5522. Objects that implement the XXPPaatthhEExxcceeppttiioonn interface: Properties of objects that implement the XXPPaatthhEExxcceeppttiioonn interface: ccooddee This property is a NNuummbbeerr. Objects that implement the XXPPaatthhEEvvaalluuaattoorr interface: Functions of objects that implement the XXPPaatthhEEvvaalluuaattoorr interface: ccrreeaatteeEExxpprreessssiioonn((eexxpprreessssiioonn,, rreessoollvveerr)) This function returns an object that implements the XXPPaatthhEExxpprreessssiioonn interface. The eexxpprreessssiioonn parameter is a SSttrriinngg. The rreessoollvveerr parameter is an object that implements the XXPPaatthhNNSSRReessoollvveerr interface. This function can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface or the DDOOMMEExxcceeppttiioonn interface. ccrreeaatteeNNSSRReessoollvveerr((nnooddeeRReessoollvveerr)) This function returns an object that implements the XXPPaatthhNNSSRReessoollvveerr interface. The nnooddeeRReessoollvveerr parameter is an object that implements the NNooddee interface. eevvaalluuaattee((eexxpprreessssiioonn,, ccoonntteexxttNNooddee,, rreessoollvveerr,, ttyyppee,, rreessuulltt)) This function returns an object that implements the OObbjjeecctt interface. The eexxpprreessssiioonn parameter is a SSttrriinngg. The ccoonntteexxttNNooddee parameter is an object that implements the NNooddee interface. The rreessoollvveerr parameter is an object that implements the XXPPaatthhNNSSRReessoollvveerr interface. The ttyyppee parameter is a NNuummbbeerr. The rreessuulltt parameter is an object that implements the OObbjjeecctt interface. This function can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface or the DDOOMMEExxcceeppttiioonn interface. Objects that implement the XXPPaatthhEExxpprreessssiioonn interface: Functions of objects that implement the XXPPaatthhEExxpprreessssiioonn interface: eevvaalluuaattee((ccoonntteexxttNNooddee,, ttyyppee,, rreessuulltt)) This function returns an object that implements the OObbjjeecctt interface. The ccoonntteexxttNNooddee parameter is an object that implements the NNooddee interface. The ttyyppee parameter is a NNuummbbeerr. The rreessuulltt parameter is an object that implements the OObbjjeecctt interface. This function can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface or the DDOOMMEExxcceeppttiioonn interface. Objects that implement the XXPPaatthhNNSSRReessoollvveerr interface: Functions of objects that implement the XXPPaatthhNNSSRReessoollvveerr interface: llooookkuuppNNaammeessppaacceeUURRII((pprreeffiixx)) This function returns a SSttrriinngg. The pprreeffiixx parameter is a SSttrriinngg. Properties of the XXPPaatthhRReessuulltt Constructor function: XXPPaatthhRReessuulltt..AANNYY__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..AANNYY__TTYYPPEE is 00. XXPPaatthhRReessuulltt..NNUUMMBBEERR__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..NNUUMMBBEERR__TTYYPPEE is 11. XXPPaatthhRReessuulltt..SSTTRRIINNGG__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..SSTTRRIINNGG__TTYYPPEE is 22. XXPPaatthhRReessuulltt..BBOOOOLLEEAANN__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..BBOOOOLLEEAANN__TTYYPPEE is 33. XXPPaatthhRReessuulltt..UUNNOORRDDEERREEDD__NNOODDEE__IITTEERRAATTOORR__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..UUNNOORRDDEERREEDD__NNOODDEE__IITTEERRAATTOORR__TTYYPPEE is 44. XXPPaatthhRReessuulltt..OORRDDEERREEDD__NNOODDEE__IITTEERRAATTOORR__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..OORRDDEERREEDD__NNOODDEE__IITTEERRAATTOORR__TTYYPPEE is 55. XXPPaatthhRReessuulltt..UUNNOORRDDEERREEDD__NNOODDEE__SSNNAAPPSSHHOOTT__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..UUNNOORRDDEERREEDD__NNOODDEE__SSNNAAPPSSHHOOTT__TTYYPPEE is 66. XXPPaatthhRReessuulltt..OORRDDEERREEDD__NNOODDEE__SSNNAAPPSSHHOOTT__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..OORRDDEERREEDD__NNOODDEE__SSNNAAPPSSHHOOTT__TTYYPPEE is 77. XXPPaatthhRReessuulltt..AANNYY__UUNNOORRDDEERREEDD__NNOODDEE__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..AANNYY__UUNNOORRDDEERREEDD__NNOODDEE__TTYYPPEE is 88. XXPPaatthhRReessuulltt..FFIIRRSSTT__OORRDDEERREEDD__NNOODDEE__TTYYPPEE The value of the constant XXPPaatthhRReessuulltt..FFIIRRSSTT__OORRDDEERREEDD__NNOODDEE__TTYYPPEE is 99. Objects that implement the XXPPaatthhRReessuulltt interface: Properties of objects that implement the XXPPaatthhRReessuulltt interface: rreessuullttTTyyppee This read-only property is a NNuummbbeerr. nnuummbbeerrVVaalluuee This read-only property is a NNuummbbeerr and can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface on retrieval. ssttrriinnggVVaalluuee This read-only property is a SSttrriinngg and can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface on retrieval. bboooolleeaannVVaalluuee This read-only property is a BBoooolleeaann and can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface on retrieval. ssiinngglleeNNooddeeVVaalluuee This read-only property is an object that implements the NNooddee interface and can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface on retrieval. iinnvvaalliiddIItteerraattoorrSSttaattee This read-only property is a BBoooolleeaann. ssnnaappsshhoottLLeennggtthh This read-only property is a NNuummbbeerr and can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface on retrieval. Functions of objects that implement the XXPPaatthhRReessuulltt interface: iitteerraatteeNNeexxtt(()) This function returns an object that implements the NNooddee interface. This function can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface or the DDOOMMEExxcceeppttiioonn interface. ssnnaappsshhoottIItteemm((iinnddeexx)) This function returns an object that implements the NNooddee interface. The iinnddeexx parameter is a NNuummbbeerr. This function can raise an object that implements the XXPPaatthhEExxcceeppttiioonn interface. Properties of the XXPPaatthhNNaammeessppaaccee Constructor function: XXPPaatthhNNaammeessppaaccee..XXPPAATTHH__NNAAMMEESSPPAACCEE__NNOODDEE The value of the constant XXPPaatthhNNaammeessppaaccee..XXPPAATTHH__NNAAMMEESSPPAACCEE__NNOODDEE is 1133. Objects that implement the XXPPaatthhNNaammeessppaaccee interface: Objects that implement the XXPPaatthhNNaammeessppaaccee interface have all properties and functions of the NNooddee interface as well as the properties and functions defined below. Properties of objects that implement the XXPPaatthhNNaammeessppaaccee interface: oowwnneerrEElleemmeenntt This read-only property is an object that implements the EElleemmeenntt interface. NNoottee:: The parameter resolver of the method _X_P_a_t_h_E_v_a_l_u_a_t_o_r_._e_v_a_l_u_a_t_e is specified as an object that implements the _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r interface. ECMAScript users can also pass to this method a function which returns a String and takes a String parameter instead of the resolver parameter. 26 February 2004 ************ AAppppeennddiixx DD:: AAcckknnoowwlleeddggeemmeennttss ************ Many people contributed to the DOM specifications (Level 1, 2 or 3), including participants of the DOM Working Group and the DOM Interest Group. We especially thank the following: Andrew Clover, Andrew Watson (Object Management Group), Andy Heninger (IBM), Angel Diaz (IBM), Arnaud Le Hors (W3C and IBM), Ashok Malhotra (IBM and Microsoft), Ben Chang (Oracle), Bill Smith (Sun), Bill Shea (Merrill Lynch), Bob Sutor (IBM), Chris Lovett (Microsoft), Chris Wilson (Microsoft), David Brownell (Sun), David Ezell (Hewlett-Packard Company), David Singer (IBM), Dimitris Dimitriadis (Improve AB and invited expert), Don Park (invited), Elena Litani (IBM), Eric Vasilik (Microsoft), Gavin Nicol (INSO), Ian Jacobs (W3C), James Clark (invited), James Davidson (Sun), Jared Sorensen (Novell), Jeroen van Rotterdam (X-Hive Corporation), Joe Kesselman (IBM), Joe Lapp (webMethods), Joe Marini (Macromedia), Johnny Stenback (Netscape/AOL), Jon Ferraiolo (Adobe), Jonathan Marsh (Microsoft), Jonathan Robie (Texcel Research and Software AG), Kim Adamson-Sharpe (SoftQuad Software Inc.), Lauren Wood (SoftQuad Software Inc., ffoorrmmeerr CChhaaiirr), Laurence Cable (Sun), Mark Davis (IBM), Mark Scardina (Oracle), Martin Dürst (W3C), Mary Brady (NIST), Mick Goulish (Software AG), Mike Champion (Arbortext and Software AG), Miles Sabin (Cromwell Media), Patti Lutsky (Arbortext), Paul Grosso (Arbortext), Peter Sharpe (SoftQuad Software Inc.), Phil Karlton (Netscape), Philippe Le Hégaret (W3C, WW33CC TTeeaamm CCoonnttaacctt aanndd ffoorrmmeerr CChhaaiirr), Ramesh Lekshmynarayanan (Merrill Lynch), Ray Whitmer (iMall, Excite@Home, and Netscape/AOL, CChhaaiirr), Rezaur Rahman (Intel), Rich Rollman (Microsoft), Rick Gessner (Netscape), Rick Jelliffe (invited), Rob Relyea (Microsoft), Scott Isaacs (Microsoft), Sharon Adler (INSO), Steve Byrne (JavaSoft), Tim Bray (invited), Tim Yu (Oracle), Tom Pixley (Netscape/AOL), Vidur Apparao (Netscape), Vinod Anupam (Lucent). Thanks to all those who have helped to improve this specification by sending suggestions and corrections (Please, keep bugging us with your issues!). Special thanks to the _D_O_M_ _C_o_n_f_o_r_m_a_n_c_e_ _T_e_s_t_ _S_u_i_t_e_s contributors: Curt Arnold, Fred Drake, Mary Brady (NIST), Rick Rivello (NIST), Robert Clary (Netscape). ********** DD..11 PPrroodduuccttiioonn SSyysstteemmss ********** This specification was written in XML. The HTML, OMG IDL, Java and ECMAScript bindings were all produced automatically. Thanks to Joe English, author of _c_o_s_t, which was used as the basis for producing DOM Level 1. Thanks also to Gavin Nicol, who wrote the scripts which run on top of cost. Arnaud Le Hors and Philippe Le Hégaret maintained the scripts. After DOM Level 1, we used _X_e_r_c_e_s as the basis DOM implementation and wish to thank the authors. Philippe Le Hégaret and Arnaud Le Hors wrote the _J_a_v_a _p_r_o_g_r_a_m_s which are the DOM application. Thanks also to Jan Kärrman, author of _h_t_m_l_2_p_s, which we use in creating the PostScript version of the specification. 26 February 2004 ************ GGlloossssaarryy ************ Editors: Arnaud Le Hors, W3C Robert S. Sutor, IBM Research (for DOM Level 1) Some of the following term definitions have been borrowed or modified from similar definitions in other W3C or standards documents. See the links within the definitions for more information. AAPPII An API is an Application Programming Interface, a set of functions or methods used to access some functionality. ddooccuummeenntt eelleemmeenntt There is only one document element in a Document. This element node is a child of the Document node. See _WW_ee_ll_ll_--_FF_oo_rr_mm_ee_dd_ _XX_MM_LL_ _DD_oo_cc_uu_mm_ee_nn_tt_ss in XML [_X_M_L _1_._0]. ddooccuummeenntt oorrddeerr There is an ordering, document order, defined on all the nodes in the document corresponding to the order in which the first character of the XML representation of each node occurs in the XML representation of the document after expansion of general entities. Thus, the _d_o_c_u_m_e_n_t_ _e_l_e_m_e_n_t node will be the first node. Element nodes occur before their children. Thus, document order orders element nodes in order of the occurrence of their start-tag in the XML (after expansion of entities). The attribute nodes of an element occur after the element and before its children. The relative order of attribute nodes is implementation-dependent. eelleemmeenntt Each document contains one or more elements, the boundaries of which are either delimited by start-tags and end-tags, or, for empty elements by an empty-element tag. Each element has a type, identified by name, and may have a set of attributes. Each attribute has a name and a value. See _LL_oo_gg_ii_cc_aa_ll_ _SS_tt_rr_uu_cc_tt_uu_rr_ee_ss in XML [_X_M_L_ _1_._0]. llooggiiccaallllyy--aaddjjaacceenntt tteexxtt nnooddeess Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in _d_o_c_u_m_e_n_t_ _o_r_d_e_r or in reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. lliivvee An object is live if any change to the underlying document structure is reflected in the object. mmooddeell A model is the actual data representation for the information at hand. Examples are the structural model and the style model representing the parse structure and the style information associated with a document. The model might be a tree, or a directed graph, or something else. nnaammeessppaaccee pprreeffiixx A namespace prefix is a string that associates an element or attribute name with a namespace URI in XML. See namespace prefix in Namespaces in XML [_X_M_L_ _N_a_m_e_s_p_a_c_e_s]. nnaammeessppaaccee UURRII A namespace URI is a URI that identifies an XML namespace. This is called the namespace name in Namespaces in XML [_X_M_L_ _N_a_m_e_s_p_a_c_e_s]. See also sections 1.3.2 "_DD_OO_MM_ _UU_RR_II_ss" and 1.3.3 "_XX_MM_LL_ _NN_aa_mm_ee_ss_pp_aa_cc_ee_ss" regarding URIs and namespace URIs handling and comparison in the DOM APIs. rreeaadd oonnllyy nnooddee A read only node is a node that is immutable. This means its list of children, its content, and its attributes, when it is an element, cannot be changed in any way. However, a read only node can possibly be moved, when it is not itself contained in a read only node. 26 February 2004 ************ RReeffeerreenncceess ************ For the latest version of any W3C specification please consult the list of _W_3_C _T_e_c_h_n_i_c_a_l_ _R_e_p_o_r_t_s available at http://www.w3.org/TR. ********** FF..11 NNoorrmmaattiivvee rreeffeerreenncceess ********** [[DDOOMM LLeevveell 22 CCoorree]] _D_o_c_u_m_e_n_t_ _O_b_j_e_c_t_ _M_o_d_e_l_ _L_e_v_e_l_ _2_ _C_o_r_e_ _S_p_e_c_i_f_i_c_a_t_i_o_n, A. Le Hors, et al., Editors. World Wide Web Consortium, 13 November 2000. This version of the DOM Level 2 Core Recommendation is http://www.w3.org/TR/2000/REC-DOM- Level-2-Core-20001113. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e is available at http://www.w3.org/TR/DOM-Level-2-Core. [[EECCMMAASSccrriipptt]] ECMAScript Language Specification, Third Edition. European Computer Manufacturers Association, Standard ECMA-262, December 1999. This version of the ECMAScript Language is available from http://www.ecma- international.org/. [[JJaavvaa]] _T_h_e_ _J_a_v_a_ _L_a_n_g_u_a_g_e_ _S_p_e_c_i_f_i_c_a_t_i_o_n, J. Gosling, B. Joy, and G. Steele, Authors. Addison-Wesley, September 1996. Available at http:// java.sun.com/docs/books/jls [[OOMMGG IIDDLL]] "OMG IDL Syntax and Semantics"defined in_T_h_e_ _C_o_m_m_o_n_ _O_b_j_e_c_t_ _R_e_q_u_e_s_t_ _B_r_o_k_e_r_: _A_r_c_h_i_t_e_c_t_u_r_e_ _a_n_d_ _S_p_e_c_i_f_i_c_a_t_i_o_n_,_ _v_e_r_s_i_o_n_ _2, Object Management Group. The latest version of CORBA version 2.0 is available at http://www.omg.org/ technology/documents/formal/corba_2.htm. [[XXMMLL IInnffoorrmmaattiioonn SSeett]] _X_M_L_ _I_n_f_o_r_m_a_t_i_o_n_ _S_e_t_ _(_S_e_c_o_n_d_ _E_d_i_t_i_o_n_), J. Cowan and R. Tobin, Editors. World Wide Web Consortium, 4 February 2004, revised 24 October 2001. This version of the XML Information Set Recommendation is http://www.w3.org/ TR/2004/REC-xml-infoset-20040204. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _X_M_L_ _I_n_f_o_r_m_a_t_i_o_n _S_e_t is available at http://www.w3.org/TR/xml-infoset. [[XXPPaatthh 11..00]] _X_M_L_ _P_a_t_h_ _L_a_n_g_u_a_g_e_ _(_X_P_a_t_h_)_ _V_e_r_s_i_o_n_ _1_._0, J. Clark and S. DeRose, Editors. World Wide Web Consortium, 16 November 1999. This version of the XPath 1.0 Recommendation is http://www.w3.org/TR/1999/REC-xpath-19991116. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _X_P_a_t_h_ _1_._0 is available at http://www.w3.org/TR/xpath. ********** FF..22 IInnffoorrmmaattiivvee rreeffeerreenncceess ********** [[DDOOMM LLeevveell 33 CCoorree]] _D_o_c_u_m_e_n_t_ _O_b_j_e_c_t_ _M_o_d_e_l_ _L_e_v_e_l_ _3_ _C_o_r_e_ _S_p_e_c_i_f_i_c_a_t_i_o_n, A. Le Hors, et al., Editors. World Wide Web Consortium, February 2004. This version of the Document Object Model Level 3 Core specification is http://www.w3.org/TR/ 2004/PR-DOM-Level-3-Core-20040205. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e is available at http://www.w3.org/TR/DOM-Level-3-Core. [[XXMMLL 11..00]] _E_x_t_e_n_s_i_b_l_e_ _M_a_r_k_u_p_ _L_a_n_g_u_a_g_e_ _(_X_M_L_)_ _1_._0_ _(_T_h_i_r_d_ _E_d_i_t_i_o_n_), T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, and F. Yergeau, Editors. World Wide Web Consortium, 4 February 2004, revised 10 February 1998 and 6 October 2000. This version of the XML 1.0 Recommendation is http://www.w3.org/TR/2004/ REC-xml-20040204. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _X_M_L_ _1_._0 is available at http:// www.w3.org/TR/REC-xml. [[XXMMLL NNaammeessppaacceess]] _N_a_m_e_s_p_a_c_e_s_ _i_n_ _X_M_L, T. Bray, D. Hollander, and A. Layman, Editors. World Wide Web Consortium, 14 January 1999. This version of the Namespaces in XML Recommendation is http://www.w3.org/TR/1999/REC-xml-names-19990114. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _N_a_m_e_s_p_a_c_e_s_ _i_n_ _X_M_L is available at http:// www.w3.org/TR/REC-xml-names. 26 February 2004 ************ IInnddeexx ************ _A_N_Y___T_Y_P_E _A_N_Y___U_N_O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E _A_P_I _1, _2 _B_O_O_L_E_A_N___T_Y_P_E _b_o_o_l_e_a_n_V_a_l_u_e _c_r_e_a_t_e_E_x_p_r_e_s_s_i_o_n _c_r_e_a_t_e_N_S_R_e_s_o_l_v_e_r _d_o_c_u_m_e_n_t_ _e_l_e_m_e_n_t _d_o_c_u_m_e_n_t_ _o_r_d_e_r _1, _2 _D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e _1, _2, _3 _D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e _1, _2, _3 _E_C_M_A_S_c_r_i_p_t _e_l_e_m_e_n_t _1, _2, _3 _e_v_a_l_u_a_t_e _1, _2 _F_I_R_S_T___O_R_D_E_R_E_D___N_O_D_E___T_Y_P_E _I_N_V_A_L_I_D___E_X_P_R_E_S_S_I_O_N___E_R_R _i_n_v_a_l_i_d_I_t_e_r_a_t_o_r_S_t_a_t_e _i_t_e_r_a_t_e_N_e_x_t _J_a_v_a _l_i_v_e _1, _2 _l_o_g_i_c_a_l_l_y_-_a_d_j_a_c_e_n_t_ _t_e_x_t _l_o_o_k_u_p_N_a_m_e_s_p_a_c_e_U_R_I _n_o_d_e_s _1, _2 _m_o_d_e_l _1, _2 _n_a_m_e_s_p_a_c_e_ _p_r_e_f_i_x _1, _2, _3, _4 _n_a_m_e_s_p_a_c_e_ _U_R_I _1, _2, _3, _4 _N_U_M_B_E_R___T_Y_P_E _n_u_m_b_e_r_V_a_l_u_e _O_M_G_ _I_D_L _O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E _O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E _o_w_n_e_r_E_l_e_m_e_n_t _r_e_a_d_ _o_n_l_y_ _n_o_d_e _1, _2 _r_e_s_u_l_t_T_y_p_e _s_i_n_g_l_e_N_o_d_e_V_a_l_u_e _s_n_a_p_s_h_o_t_I_t_e_m _s_n_a_p_s_h_o_t_L_e_n_g_t_h _S_T_R_I_N_G___T_Y_P_E _s_t_r_i_n_g_V_a_l_u_e _T_Y_P_E___E_R_R _U_N_O_R_D_E_R_E_D___N_O_D_E___I_T_E_R_A_T_O_R___T_Y_P_E _U_N_O_R_D_E_R_E_D___N_O_D_E___S_N_A_P_S_H_O_T___T_Y_P_E _X_M_L_ _1_._0 _1, _2, _3 _X_M_L_ _I_n_f_o_r_m_a_t_i_o_n_ _S_e_t _1, _2 _X_M_L_ _N_a_m_e_s_p_a_c_e_s _1, _2, _3 _X_P_a_t_h_ _1_._0 _1, _2, _3, _4, _5, _6, _X_P_A_T_H___N_A_M_E_S_P_A_C_E___N_O_D_E _X_P_a_t_h_E_v_a_l_u_a_t_o_r _7, _8, _9, _1_0, _1_1, _1_2 _X_P_a_t_h_E_x_c_e_p_t_i_o_n _X_P_a_t_h_E_x_p_r_e_s_s_i_o_n _X_P_a_t_h_N_a_m_e_s_p_a_c_e _X_P_a_t_h_N_S_R_e_s_o_l_v_e_r _X_P_a_t_h_R_e_s_u_l_t