_[_W_3_C_] ************ DDooccuummeenntt OObbjjeecctt MMooddeell ((DDOOMM)) LLeevveell 33 LLooaadd aanndd SSaavvee SSppeecciiffiiccaattiioonn ************ ********** VVeerrssiioonn 11..00 ********** ********** WW33CC RReeccoommmmeennddaattiioonn 0077 AApprriill 22000044 ********** This version: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_4_/_R_E_C_-_D_O_M_-_L_e_v_e_l_-_3_-_L_S_-_2_0_0_4_0_4_0_7 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_-_L_S Previous version: _h_t_t_p_:_/_/_w_w_w_._w_3_._o_r_g_/_T_R_/_2_0_0_4_/_P_R_-_D_O_M_-_L_e_v_e_l_-_3_-_L_S_-_2_0_0_4_0_2_0_5_/ Editors: Johnny Stenback, Netscape Andy Heninger, IBM (until March 2001) Please refer to the _ee_rr_rr_aa_tt_aa for this document, which may include some normative corrections. 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. See also _t_r_a_n_s_l_a_t_i_o_n_s of this document. _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 Load and Save Level 3, a platform- and language-neutral interface that allows programs and scripts to dynamically load the content of an XML document into a DOM document and serialize a DOM document into an XML document; DOM documents being defined in [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e] or newer, and XML documents being defined in [_X_M_L_ _1_._0] or newer. It also allows filtering of content at load time and at serialization time. ********** 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 document contains the Document Object Model Level 3 Load and Save specification and is a _W_3_C_ _R_e_c_o_m_m_e_n_d_a_t_i_o_n. It 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 _D_O_M_ _W_o_r_k_i_n_g_ _G_r_o_u_p participants. For more information about DOM, readers can also refer to _D_O_M_ _F_A_Q and _D_O_M_ _C_o_n_f_o_r_m_a_n_c_e_ _T_e_s_t_ _S_u_i_t_e_s. It is based on the feedback received during the _P_r_o_p_o_s_e_d_ _R_e_c_o_m_m_e_n_d_a_t_i_o_n period. _C_h_a_n_g_e_s_ _s_i_n_c_e_ _t_h_e_ _P_r_o_p_o_s_e_d_ _R_e_c_o_m_m_e_n_d_a_t_i_o_n_ _v_e_r_s_i_o_n and an _i_m_p_l_e_m_e_n_t_a_t_i_o_n_ _r_e_p_o_r_t are available. Please refer to the _e_r_r_a_t_a for this document, which may include some normative corrections. Comments on this document should be sent to the public mailing list _w_w_w_- _d_o_m_@_w_3_._o_r_g (_p_u_b_l_i_c_ _a_r_c_h_i_v_e). This is a stable document and has been endorsed by the W3C Membership and the participants of the DOM working group. The English version of this specification is the only normative version. See also _t_r_a_n_s_l_a_t_i_o_n_s. 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. This document has been produced under the _2_4 _J_a_n_u_a_r_y_ _2_0_0_2_ _C_P_P as amended by the _W_3_C_ _P_a_t_e_n_t_ _P_o_l_i_c_y_ _T_r_a_n_s_i_t_i_o_n_ _P_r_o_c_e_d_u_r_e. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should disclose the information in accordance with _s_e_c_t_i_o_n_ _6_ _o_f_ _t_h_e_ _W_3_C_ _P_a_t_e_n_t_ _P_o_l_i_c_y. ********** 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_ _L_o_a_d_ _a_n_d_ _S_a_v_e * _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 07 April 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_ _L_o_a_d_ _a_n_d_ _S_a_v_e o _1_._1_ _O_v_e_r_v_i_e_w_ _o_f_ _t_h_e_ _I_n_t_e_r_f_a_c_e_s o _1_._2_ _B_a_s_i_c_ _T_y_p_e_s # _1_._2_._1_ _T_h_e_ _L_S_I_n_p_u_t_S_t_r_e_a_m_ _T_y_p_e # _1_._2_._2_ _T_h_e_ _L_S_O_u_t_p_u_t_S_t_r_e_a_m_ _T_y_p_e # _1_._2_._3_ _T_h_e_ _L_S_R_e_a_d_e_r_ _T_y_p_e # _1_._2_._4_ _T_h_e_ _L_S_W_r_i_t_e_r_ _T_y_p_e o _1_._3_ _F_u_n_d_a_m_e_n_t_a_l_ _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 * _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 07 April 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 07 April 2004 ************ 11.. DDooccuummeenntt OObbjjeecctt MMooddeell LLooaadd aanndd SSaavvee ************ Editors: Johnny Stenback, Netscape Andy Heninger, IBM (until March 2001) ********** TTaabbllee ooff ccoonntteennttss ********** * _1_._1_ _O_v_e_r_v_i_e_w_ _o_f_ _t_h_e_ _I_n_t_e_r_f_a_c_e_s * _1_._2_ _B_a_s_i_c_ _T_y_p_e_s o _1_._2_._1_ _T_h_e_ _L_S_I_n_p_u_t_S_t_r_e_a_m_ _T_y_p_e # _L_S_I_n_p_u_t_S_t_r_e_a_m o _1_._2_._2_ _T_h_e_ _L_S_O_u_t_p_u_t_S_t_r_e_a_m_ _T_y_p_e # _L_S_O_u_t_p_u_t_S_t_r_e_a_m o _1_._2_._3_ _T_h_e_ _L_S_R_e_a_d_e_r_ _T_y_p_e # _L_S_R_e_a_d_e_r o _1_._2_._4_ _T_h_e_ _L_S_W_r_i_t_e_r_ _T_y_p_e # _L_S_W_r_i_t_e_r * _1_._3_ _F_u_n_d_a_m_e_n_t_a_l_ _I_n_t_e_r_f_a_c_e_s o _L_S_E_x_c_e_p_t_i_o_n, _L_S_E_x_c_e_p_t_i_o_n_C_o_d_e, _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S, _L_S_P_a_r_s_e_r, _L_S_I_n_p_u_t, _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r, _L_S_P_a_r_s_e_r_F_i_l_t_e_r, _L_S_P_r_o_g_r_e_s_s_E_v_e_n_t, _L_S_L_o_a_d_E_v_e_n_t, _L_S_S_e_r_i_a_l_i_z_e_r, _L_S_O_u_t_p_u_t, _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r This section defines a set of interfaces for loading and saving document objects as defined in [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e] or newer. The functionality specified in this section (the LLooaadd aanndd SSaavvee functionality) is sufficient to allow software developers and Web script authors to load and save XML content inside conforming products. The DOM Load and Save _A_P_I also allows filtering of XML content using only DOM API calls; access and manipulation of the Document is defined in [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e] or newer. The proposal for loading is influenced by the Java APIs for XML Processing [_J_A_X_P] and by SAX2 [_S_A_X]. ********** 11..11 OOvveerrvviieeww ooff tthhee IInntteerrffaacceess ********** The interfaces involved with the loading and saving of XML documents are: * _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S -- An extended DOMImplementation interface that provides the factory methods for creating the objects required for loading and saving. * _L_S_P_a_r_s_e_r -- An interface for parsing data into DOM documents. * _L_S_I_n_p_u_t -- Encapsulates information about the data to be loaded. * _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r -- Provides a way for applications to redirect references to external resources when parsing. * _L_S_P_a_r_s_e_r_F_i_l_t_e_r -- Provides the ability to examine and optionally remove nodes as they are being processed while parsing. * _L_S_S_e_r_i_a_l_i_z_e_r -- An interface for serializing DOM documents or nodes. * _L_S_O_u_t_p_u_t -- Encapsulates information about the destination for the data to be output. * _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r -- Provides the ability to examine and filter DOM nodes as they are being processed for the serialization. ********** 11..22 BBaassiicc TTyyppeess ********** To ensure interoperability, this specification specifies the following basic types used in various DOM modules. Even though the DOM uses the basic types in the interfaces, bindings may use different types and normative bindings are only given for Java and ECMAScript in this specification. ******** 11..22..11 TThhee _LL_SS_II_nn_pp_uu_tt_SS_tt_rr_ee_aa_mm TTyyppee ******** This type is used to represent a sequence of input bytes. TTyyppee DDeeffiinniittiioonn LLSSIInnppuuttSSttrreeaamm A _L_S_I_n_p_u_t_S_t_r_e_a_m represents a reference to a byte stream source of an XML input. IIDDLL DDeeffiinniittiioonn typedef Object _L_S_I_n_p_u_t_S_t_r_e_a_m; NNoottee:: For Java, _L_S_I_n_p_u_t_S_t_r_e_a_m is bound to the java.io.InputStream type. For ECMAScript, _L_S_I_n_p_u_t_S_t_r_e_a_m is bound to Object. ******** 11..22..22 TThhee _LL_SS_OO_uu_tt_pp_uu_tt_SS_tt_rr_ee_aa_mm TTyyppee ******** This type is used to represent a sequence of output bytes. TTyyppee DDeeffiinniittiioonn LLSSOOuuttppuuttSSttrreeaamm A _L_S_O_u_t_p_u_t_S_t_r_e_a_m represents a byte stream destination for the XML output. IIDDLL DDeeffiinniittiioonn typedef Object _L_S_O_u_t_p_u_t_S_t_r_e_a_m; NNoottee:: For Java, _L_S_O_u_t_p_u_t_S_t_r_e_a_m is bound to the java.io.OutputStream type. For ECMAScript, _L_S_O_u_t_p_u_t_S_t_r_e_a_m is bound to Object. ******** 11..22..33 TThhee _LL_SS_RR_ee_aa_dd_ee_rr TTyyppee ******** This type is used to represent a sequence of input characters in _1_6_-_b_i_t_ _u_n_i_t_s. The encoding used for the characters is UTF-16, as defined in [_U_n_i_c_o_d_e] and in [_I_S_O_/_I_E_C_ _1_0_6_4_6]). TTyyppee DDeeffiinniittiioonn LLSSRReeaaddeerr A _L_S_R_e_a_d_e_r represents a character stream for the XML input. IIDDLL DDeeffiinniittiioonn typedef Object _L_S_R_e_a_d_e_r; NNoottee:: For Java, _L_S_R_e_a_d_e_r is bound to the java.io.Reader type. For ECMAScript, _L_S_R_e_a_d_e_r is nnoott bound, and therefore has no recommended meaning in ECMAScript. ******** 11..22..44 TThhee _LL_SS_WW_rr_ii_tt_ee_rr TTyyppee ******** This type is used to represent a sequence of output characters in _1_6_-_b_i_t_ _u_n_i_t_s. The encoding used for the characters is UTF-16, as defined in [_U_n_i_c_o_d_e] and in [_I_S_O_/_I_E_C_ _1_0_6_4_6]). TTyyppee DDeeffiinniittiioonn LLSSWWrriitteerr A _L_S_W_r_i_t_e_r represents a character stream for the XML output. IIDDLL DDeeffiinniittiioonn typedef Object _L_S_W_r_i_t_e_r; NNoottee:: For Java, _L_S_W_r_i_t_e_r is bound to the java.io.Writer type. For ECMAScript, _L_S_W_r_i_t_e_r is nnoott bound, and therefore has no recommended meaning in ECMAScript. ********** 11..33 FFuunnddaammeennttaall IInntteerrffaacceess ********** The interfaces within this section are considered fundamental, and must be fully implemented by all conforming implementations of the DOM Load and Save module. A DOM application may use the hasFeature(feature, version) method of the DOMImplementation interface with parameter values "LS" (or "LS-Async") and "3.0" (respectively) to determine whether or not these interfaces are supported by the implementation. In order to fully support them, an implementation must also support the "Core" feature defined in [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e]. A DOM application may use the hasFeature(feature, version) method of the DOMImplementation interface with parameter values "LS-Async" and "3.0" (respectively) to determine whether or not the asynchronous mode is supported by the implementation. In order to fully support the asynchronous mode, an implementation must also support the "LS" feature defined in this section. For additional information about _cc_oo_nn_ff_oo_rr_mm_aa_nn_cc_ee, please see the DOM Level 3 Core specification [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e]. EExxcceeppttiioonn LLSSEExxcceeppttiioonn Parser or write operations may throw an _L_S_E_x_c_e_p_t_i_o_n if the processing is stopped. The processing can be stopped due to a DOMError with a severity of DOMError.SEVERITY_FATAL_ERROR or a non recovered DOMError.SEVERITY_ERROR, or if DOMErrorHandler.handleError() returned false. NNoottee:: As suggested in the definition of the constants in the DOMError interface, a DOM implementation may choose to continue after a fatal error, but the resulting DOM tree is then implementation dependent. IIDDLL DDeeffiinniittiioonn exception _L_S_E_x_c_e_p_t_i_o_n { unsigned short code; }; // LSExceptionCode const unsigned short _P_A_R_S_E___E_R_R = 81; const unsigned short _S_E_R_I_A_L_I_Z_E___E_R_R = 82; DDeeffiinniittiioonn ggrroouupp LLSSEExxcceeppttiioonnCCooddee An integer indicating the type of error generated. DDeeffiinneedd CCoonnssttaannttss PARSE_ERR If an attempt was made to load a document, or an XML Fragment, using _L_S_P_a_r_s_e_r and the processing has been stopped. SERIALIZE_ERR If an attempt was made to serialize a Node using _L_S_S_e_r_i_a_l_i_z_e_r and the processing has been stopped. IInntteerrffaaccee DDOOMMIImmpplleemmeennttaattiioonnLLSS DOMImplementationLS contains the factory methods for creating Load and Save objects. The expectation is that an instance of the DOMImplementationLS interface can be obtained by using binding-specific casting methods on an instance of the DOMImplementation interface or, if the Document supports the feature "Core" version "3.0" defined in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e], by using the method DOMImplementation.getFeature with parameter values "LS" (or "LS- Async") and "3.0" (respectively). IIDDLL DDeeffiinniittiioonn interface _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S { // DOMImplementationLSMode const unsigned short _M_O_D_E___S_Y_N_C_H_R_O_N_O_U_S = 1; const unsigned short _M_O_D_E___A_S_Y_N_C_H_R_O_N_O_U_S = 2; _L_S_P_a_r_s_e_r _c_r_e_a_t_e_L_S_P_a_r_s_e_r(in unsigned short mode, in DOMString schemaType) raises(DOMException); _L_S_S_e_r_i_a_l_i_z_e_r _c_r_e_a_t_e_L_S_S_e_r_i_a_l_i_z_e_r(); _L_S_I_n_p_u_t _c_r_e_a_t_e_L_S_I_n_p_u_t(); _L_S_O_u_t_p_u_t _c_r_e_a_t_e_L_S_O_u_t_p_u_t(); }; DDeeffiinniittiioonn ggrroouupp DDOOMMIImmpplleemmeennttaattiioonnLLSSMMooddee Integer parser mode constants. DDeeffiinneedd CCoonnssttaannttss MODE_ASYNCHRONOUS Create an asynchronous _L_S_P_a_r_s_e_r. MODE_SYNCHRONOUS Create a synchronous _L_S_P_a_r_s_e_r. MMeetthhooddss createLSInput Create a new empty input source object where _L_S_I_n_p_u_t_._c_h_a_r_a_c_t_e_r_S_t_r_e_a_m, _L_S_I_n_p_u_t_._b_y_t_e_S_t_r_e_a_m, _L_S_I_n_p_u_t_._s_t_r_i_n_g_D_a_t_a _L_S_I_n_p_u_t_._s_y_s_t_e_m_I_d, _L_S_I_n_p_u_t_._p_u_b_l_i_c_I_d, _L_S_I_n_p_u_t_._b_a_s_e_U_R_I, and _L_S_I_n_p_u_t_._e_n_c_o_d_i_n_g are null, and _L_S_I_n_p_u_t_._c_e_r_t_i_f_i_e_d_T_e_x_t is false. RReettuurrnn VVaalluuee _L_S_I_n_p_u_t The newly created input object. NNoo PPaarraammeetteerrss NNoo EExxcceeppttiioonnss createLSOutput Create a new empty output destination object where _L_S_O_u_t_p_u_t_._c_h_a_r_a_c_t_e_r_S_t_r_e_a_m, _L_S_O_u_t_p_u_t_._b_y_t_e_S_t_r_e_a_m, _L_S_O_u_t_p_u_t_._s_y_s_t_e_m_I_d, _L_S_O_u_t_p_u_t_._e_n_c_o_d_i_n_g are null. RReettuurrnn VVaalluuee _L_S_O_u_t_p_u_t The newly created output object. NNoo PPaarraammeetteerrss NNoo EExxcceeppttiioonnss createLSParser Create a new _L_S_P_a_r_s_e_r. The newly constructed parser may then be configured by means of its DOMConfiguration object, and used to parse documents by means of its parse method. PPaarraammeetteerrss mode of type unsigned short The mode argument is either MODE_SYNCHRONOUS or MODE_ASYNCHRONOUS, if mode is MODE_SYNCHRONOUS then the _L_S_P_a_r_s_e_r that is created will operate in synchronous mode, if it's MODE_ASYNCHRONOUS then the _L_S_P_a_r_s_e_r that is created will operate in asynchronous mode. schemaType of type DOMString An absolute URI representing the type of the _s_c_h_e_m_a language used during the load of a Document using the newly created _L_S_P_a_r_s_e_r. Note that no lexical checking is done on the absolute URI. In order to create a _L_S_P_a_r_s_e_r for any kind of schema types (i.e. the LSParser will be free to use any schema found), use the value null. NNoottee:: For W3C XML Schema [_X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1], applications must use the value "http://www.w3.org/ 2001/XMLSchema". For XML DTD [_X_M_L_ _1_._0], applications must use the value "http://www.w3.org/TR/REC-xml". Other Schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method. RReettuurrnn VVaalluuee _L_S_P_a_r_s_e_r The newly created _L_S_P_a_r_s_e_r object. This _L_S_P_a_r_s_e_r is either synchronous or asynchronous depending on the value of the mode argument. NNoottee:: By default, the newly created _L_S_P_a_r_s_e_r does not contain a DOMErrorHandler, i.e. the value of the "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new _L_S_P_a_r_s_e_r object contains a reference to the default error handler. EExxcceeppttiioonnss DOMException NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported. createLSSerializer Create a new _L_S_S_e_r_i_a_l_i_z_e_r object. RReettuurrnn VVaalluuee _L_S_S_e_r_i_a_l_i_z_e_r The newly created _L_S_S_e_r_i_a_l_i_z_e_r object. NNoottee:: By default, the newly created _L_S_S_e_r_i_a_l_i_z_e_r has no DOMErrorHandler, i.e. the value of the "error-handler" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new _L_S_S_e_r_i_a_l_i_z_e_r object contains a reference to the default error handler. NNoo PPaarraammeetteerrss NNoo EExxcceeppttiioonnss IInntteerrffaaccee LLSSPPaarrsseerr An interface to an object that is able to build, or augment, a DOM tree from various input sources. LSParser provides an API for parsing XML and building the corresponding DOM document structure. A LSParser instance can be obtained by invoking the _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S_._c_r_e_a_t_e_L_S_P_a_r_s_e_r_(_) method. As specified in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e], when a document is first made available via the LSParser: * there will never be two adjacent nodes of type NODE_TEXT, and there will never be empty text nodes. * it is expected that the value and nodeValue attributes of an Attr node initially return the _XX_MM_LL_ _11_.._00_ _nn_oo_rr_mm_aa_ll_ii_zz_ee_dd_ _vv_aa_ll_uu_ee. However, if the parameters "_vv_aa_ll_ii_dd_aa_tt_ee_--_ii_ff_--_ss_cc_hh_ee_mm_aa" and "_dd_aa_tt_aa_tt_yy_pp_ee_--_nn_oo_rr_mm_aa_ll_ii_zz_aa_tt_ii_oo_nn" are set to true, depending on the attribute normalization used, the attribute values may differ from the ones obtained by the XML 1.0 attribute normalization. If the parameters "_dd_aa_tt_aa_tt_yy_pp_ee_--_nn_oo_rr_mm_aa_ll_ii_zz_aa_tt_ii_oo_nn" is set to false, the XML 1.0 attribute normalization is guaranteed to occur, and if the attributes list does not contain namespace declarations, the attributes attribute on Element node represents the property [[aattttrriibbuutteess]] defined in [_X_M_L_ _I_n_f_o_r_m_a_t_i_o_n_ _S_e_t]. Asynchronous LSParser objects are expected to also implement the events:: EventTarget interface so that event listeners can be registered on asynchronous LSParser objects. Events supported by asynchronous LSParser objects are: load The LSParser finishes to load the document. See also the definition of the _L_S_L_o_a_d_E_v_e_n_t interface. progress The LSParser signals progress as data is parsed. This specification does not attempt to define exactly when progress events should be dispatched. That is intentionally left as implementation-dependent. Here is one example of how an application might dispatch progress events: Once the parser starts receiving data, a progress event is dispatched to indicate that the parsing starts. From there on, a progress event is dispatched for every 4096 bytes of data that is received and processed. This is only one example, though, and implementations can choose to dispatch progress events at any time while parsing, or not dispatch them at all. See also the definition of the _L_S_P_r_o_g_r_e_s_s_E_v_e_n_t interface. NNoottee:: All events defined in this specification use the namespace URI "http://www.w3.org/2002/DOMLS". While parsing an input source, errors are reported to the application through the error handler (_L_S_P_a_r_s_e_r_._d_o_m_C_o_n_f_i_g's "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" parameter). This specification does in no way try to define all possible errors that can occur while parsing XML, or any other markup, but some common error cases are defined. The types (DOMError.type) of errors and warnings defined by this specification are: "check-character-normalization-failure" [error] Raised if the parameter "_cc_hh_ee_cc_kk_--_cc_hh_aa_rr_aa_cc_tt_ee_rr_--_nn_oo_rr_mm_aa_ll_ii_zz_aa_tt_ii_oo_nn" is set to true and a string is encountered that fails normalization checking. "doctype-not-allowed" [fatal] Raised if the configuration parameter "_d_i_s_a_l_l_o_w_-_d_o_c_t_y_p_e" is set to true and a doctype is encountered. "no-input-specified" [fatal] Raised when loading a document and no input is specified in the _L_S_I_n_p_u_t object. "pi-base-uri-not-preserved" [warning] Raised if a processing instruction is encountered in a location where the base URI of the processing instruction can not be preserved. One example of a case where this warning will be raised is if the configuration parameter "_ee_nn_tt_ii_tt_ii_ee_ss" is set to false and the following XML file is parsed: &e; And subdir/myentity.ent contains: "unbound-prefix-in-entity" [warning] An implementation dependent warning that may be raised if the configuration parameter "_nn_aa_mm_ee_ss_pp_aa_cc_ee_ss" is set to true and an unbound namespace prefix is encountered in an entity's replacement text. Raising this warning is not enforced since some existing parsers may not recognize unbound namespace prefixes in the replacement text of entities. "unknown-character-denormalization" [fatal] Raised if the configuration parameter "_i_g_n_o_r_e_-_u_n_k_n_o_w_n_-_c_h_a_r_a_c_t_e_r_- _d_e_n_o_r_m_a_l_i_z_a_t_i_o_n_s" is set to false and a character is encountered for which the processor cannot determine the normalization properties. "unsupported-encoding" [fatal] Raised if an unsupported encoding is encountered. "unsupported-media-type" [fatal] Raised if the configuration parameter "_s_u_p_p_o_r_t_e_d_-_m_e_d_i_a_-_t_y_p_e_s_-_o_n_l_y" is set to true and an unsupported media type is encountered. In addition to raising the defined errors and warnings, implementations are expected to raise implementation specific errors and warnings for any other error and warning cases such as IO errors (file not found, permission denied,...), XML well-formedness errors, and so on. IIDDLL DDeeffiinniittiioonn interface _L_S_P_a_r_s_e_r { readonly attribute DOMConfiguration _d_o_m_C_o_n_f_i_g; attribute _L_S_P_a_r_s_e_r_F_i_l_t_e_r _f_i_l_t_e_r; readonly attribute boolean _a_s_y_n_c; readonly attribute boolean _b_u_s_y; Document _p_a_r_s_e(in _L_S_I_n_p_u_t input) raises(DOMException, _L_S_E_x_c_e_p_t_i_o_n); Document _p_a_r_s_e_U_R_I(in DOMString uri) raises(DOMException, _L_S_E_x_c_e_p_t_i_o_n); // ACTION_TYPES const unsigned short _A_C_T_I_O_N___A_P_P_E_N_D___A_S___C_H_I_L_D_R_E_N = 1; const unsigned short _A_C_T_I_O_N___R_E_P_L_A_C_E___C_H_I_L_D_R_E_N = 2; const unsigned short _A_C_T_I_O_N___I_N_S_E_R_T___B_E_F_O_R_E = 3; const unsigned short _A_C_T_I_O_N___I_N_S_E_R_T___A_F_T_E_R = 4; const unsigned short _A_C_T_I_O_N___R_E_P_L_A_C_E = 5; Node _p_a_r_s_e_W_i_t_h_C_o_n_t_e_x_t(in _L_S_I_n_p_u_t input, in Node contextArg, in unsigned short action) raises(DOMException, _L_S_E_x_c_e_p_t_i_o_n); void _a_b_o_r_t(); }; DDeeffiinniittiioonn ggrroouupp AACCTTIIOONN__TTYYPPEESS A set of possible actions for the parseWithContext method. DDeeffiinneedd CCoonnssttaannttss ACTION_APPEND_AS_CHILDREN Append the result of the parse operation as children of the context node. For this action to work, the context node must be an Element or a DocumentFragment. ACTION_INSERT_AFTER Insert the result of the parse operation as the immediately following sibling of the context node. For this action to work the context node's parent must be an Element or a DocumentFragment. ACTION_INSERT_BEFORE Insert the result of the parse operation as the immediately preceding sibling of the context node. For this action to work the context node's parent must be an Element or a DocumentFragment. ACTION_REPLACE Replace the context node with the result of the parse operation. For this action to work, the context node must have a parent, and the parent must be an Element or a DocumentFragment. ACTION_REPLACE_CHILDREN Replace all the children of the context node with the result of the parse operation. For this action to work, the context node must be an Element, a Document, or a DocumentFragment. AAttttrriibbuutteess async of type boolean, readonly true if the LSParser is asynchronous, false if it is synchronous. busy of type boolean, readonly true if the LSParser is currently busy loading a document, otherwise false. domConfig of type DOMConfiguration, readonly The DOMConfiguration object used when parsing an input source. This DOMConfiguration is specific to the parse operation. No parameter values from this DOMConfiguration object are passed automatically to the DOMConfiguration object on the Document that is created, or used, by the parse operation. The DOM application is responsible for passing any needed parameter values from this DOMConfiguration object to the DOMConfiguration object referenced by the Document object. In addition to the parameters recognized in on the _DD_OO_MM_CC_oo_nn_ff_ii_gg_uu_rr_aa_tt_ii_oo_nn interface defined in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e], the DOMConfiguration objects for LSParser add or modify the following parameters: "charset-overrides-xml-encoding" true [ooppttiioonnaall] (ddeeffaauulltt) If a higher level protocol such as HTTP [_I_E_T_F_ _R_F_C _2_6_1_6] provides an indication of the character encoding of the input stream being processed, that will override any encoding specified in the XML declaration or the Text declaration (see also section 4.3.3, "Character Encoding in Entities", in [_X_M_L_ _1_._0]). Explicitly setting an encoding in the _L_S_I_n_p_u_t overrides any encoding from the protocol. false [rreeqquuiirreedd] The parser ignores any character set encoding information from higher-level protocols. "disallow-doctype" true [ooppttiioonnaall] Throw a fatal ""ddooccttyyppee--nnoott--aalllloowweedd"" error if a doctype node is found while parsing the document. This is useful when dealing with things like SOAP envelopes where doctype nodes are not allowed. false [rreeqquuiirreedd] (ddeeffaauulltt) Allow doctype nodes in the document. "ignore-unknown-character-denormalizations" true [rreeqquuiirreedd] (ddeeffaauulltt) If, while verifying full normalization when [_X_M_L _1_._1] is supported, a processor encounters characters for which it cannot determine the normalization properties, then the processor will ignore any possible denormalizations caused by these characters. This parameter is ignored for [_X_M_L_ _1_._0]. false [ooppttiioonnaall] Report an fatal ""uunnkknnoowwnn--cchhaarraacctteerr-- ddeennoorrmmaalliizzaattiioonn"" error if a character is encountered for which the processor cannot determine the normalization properties. "infoset" See the definition of DOMConfiguration for a description of this parameter. Unlike in [_D_O_M_ _L_e_v_e_l_ _3 _C_o_r_e], this parameter will default to true for LSParser. "namespaces" true [rreeqquuiirreedd] (ddeeffaauulltt) Perform the namespace processing as defined in [_X_M_L_ _N_a_m_e_s_p_a_c_e_s] and [_X_M_L_ _N_a_m_e_s_p_a_c_e_s_ _1_._1]. false [ooppttiioonnaall] Do not perform the namespace processing. "resource-resolver" [rreeqquuiirreedd] A reference to a _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r object, or null. If the value of this parameter is not null when an external resource (such as an external XML entity or an XML schema location) is encountered, the implementation will request that the _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r referenced in this parameter resolves the resource. "supported-media-types-only" true [ooppttiioonnaall] Check that the media type of the parsed resource is a supported media type. If an unsupported media type is encountered, a fatal error of type ""uunnssuuppppoorrtteedd--mmeeddiiaa--ttyyppee"" will be raised. The media types defined in [_I_E_T_F_ _R_F_C_ _3_0_2_3] must always be accepted. false [rreeqquuiirreedd] (ddeeffaauulltt) Accept any media type. "validate" See the definition of DOMConfiguration for a description of this parameter. Unlike in [_D_O_M_ _L_e_v_e_l_ _3 _C_o_r_e], the processing of the internal subset is always accomplished, even if this parameter is set to false. "validate-if-schema" See the definition of DOMConfiguration for a description of this parameter. Unlike in [_D_O_M_ _L_e_v_e_l_ _3 _C_o_r_e], the processing of the internal subset is always accomplished, even if this parameter is set to false. "well-formed" See the definition of DOMConfiguration for a description of this parameter. Unlike in [_D_O_M_ _L_e_v_e_l_ _3 _C_o_r_e], this parameter cannot be set to false. filter of type _L_S_P_a_r_s_e_r_F_i_l_t_e_r When a filter is provided, the implementation will call out to the filter as it is constructing the DOM tree structure. The filter can choose to remove elements from the document being constructed, or to terminate the parsing early. The filter is invoked after the operations requested by the DOMConfiguration parameters have been applied. For example, if "_vv_aa_ll_ii_dd_aa_tt_ee" is set to true, the validation is done before invoking the filter. MMeetthhooddss abort Abort the loading of the document that is currently being loaded by the LSParser. If the LSParser is currently not busy, a call to this method does nothing. NNoo PPaarraammeetteerrss NNoo RReettuurrnn VVaalluuee NNoo EExxcceeppttiioonnss parse Parse an XML document from a resource identified by a _L_S_I_n_p_u_t. PPaarraammeetteerrss input of type _L_S_I_n_p_u_t The _L_S_I_n_p_u_t from which the source of the document is to be read. RReettuurrnn VVaalluuee Document If the LSParser is a synchronous LSParser, the newly created and populated Document is returned. If the LSParser is asynchronous, null is returned since the document object may not yet be constructed when this method returns. EExxcceeppttiioonnss DOMException INVALID_STATE_ERR: Raised if the LSParser's _L_S_P_a_r_s_e_r_._b_u_s_y attribute is true. _L_S_E_x_c_e_p_t_i_o_n PARSE_ERR: Raised if the LSParser was unable to load the XML document. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. parseURI Parse an XML document from a location identified by a URI reference [_I_E_T_F_ _R_F_C_ _2_3_9_6]. If the URI contains a fragment identifier (see section 4.1 in [_I_E_T_F_ _R_F_C_ _2_3_9_6]), the behavior is not defined by this specification, future versions of this specification may define the behavior. PPaarraammeetteerrss uri of type DOMString The location of the XML document to be read. RReettuurrnn VVaalluuee Document If the LSParser is a synchronous LSParser, the newly created and populated Document is returned, or null if an error occured. If the LSParser is asynchronous, null is returned since the document object may not yet be constructed when this method returns. EExxcceeppttiioonnss DOMException INVALID_STATE_ERR: Raised if the _L_S_P_a_r_s_e_r_._b_u_s_y attribute is true. _L_S_E_x_c_e_p_t_i_o_n PARSE_ERR: Raised if the LSParser was unable to load the XML document. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. parseWithContext Parse an XML fragment from a resource identified by a _L_S_I_n_p_u_t and insert the content into an existing document at the position specified with the context and action arguments. When parsing the input stream, the context node (or its parent, depending on where the result will be inserted) is used for resolving unbound namespace prefixes. The context node's ownerDocument node (or the node itself if the node of type DOCUMENT_NODE) is used to resolve default attributes and entity references. As the new data is inserted into the document, at least one mutation event is fired per new immediate child or sibling of the context node. If the context node is a Document node and the action is ACTION_REPLACE_CHILDREN, then the document that is passed as the context node will be changed such that its xmlEncoding, documentURI, xmlVersion, inputEncoding, xmlStandalone, and all other such attributes are set to what they would be set to if the input source was parsed using _L_S_P_a_r_s_e_r_._p_a_r_s_e_(_). This method is always synchronous, even if the LSParser is asynchronous (_L_S_P_a_r_s_e_r_._a_s_y_n_c is true). If an error occurs while parsing, the caller is notified through the ErrorHandler instance associated with the "_ee_rr_rr_oo_rr_-- _hh_aa_nn_dd_ll_ee_rr" parameter of the DOMConfiguration. When calling parseWithContext, the values of the following configuration parameters will be ignored and their default values will always be used instead: "_vv_aa_ll_ii_dd_aa_tt_ee", "_vv_aa_ll_ii_dd_aa_tt_ee_--_ii_ff_-- _ss_cc_hh_ee_mm_aa", and "_ee_ll_ee_mm_ee_nn_tt_--_cc_oo_nn_tt_ee_nn_tt_--_ww_hh_ii_tt_ee_ss_pp_aa_cc_ee". Other parameters will be treated normally, and the parser is expected to call the _L_S_P_a_r_s_e_r_F_i_l_t_e_r just as if a whole document was parsed. PPaarraammeetteerrss input of type _L_S_I_n_p_u_t The _L_S_I_n_p_u_t from which the source document is to be read. The source document must be an XML fragment, i.e. anything except a complete XML document (except in the case where the context node of type DOCUMENT_NODE, and the action is ACTION_REPLACE_CHILDREN), a DOCTYPE (internal subset), entity declaration(s), notation declaration(s), or XML or text declaration(s). contextArg of type Node The node that is used as the context for the data that is being parsed. This node must be a Document node, a DocumentFragment node, or a node of a type that is allowed as a child of an Element node, e.g. it cannot be an Attribute node. action of type unsigned short This parameter describes which action should be taken between the new set of nodes being inserted and the existing children of the context node. The set of possible actions is defined in ACTION_TYPES above. RReettuurrnn VVaalluuee Node Return the node that is the result of the parse operation. If the result is more than one top-level node, the first one is returned. EExxcceeppttiioonnss DOMException HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be inserted before, after, or as a child of the context node (see also Node.insertBefore or Node.replaceChild in [_D_O_M _L_e_v_e_l_ _3_ _C_o_r_e]). NOT_SUPPORTED_ERR: Raised if the LSParser doesn't support this method, or if the context node is of type Document and the DOM implementation doesn't support the replacement of the DocumentType child or Element child. NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a _r_e_a_d_ _o_n_l_y_ _n_o_d_e and the content is being appended to its child list, or if the parent node of the context node is _r_e_a_d_ _o_n_l_y _n_o_d_e and the content is being inserted in its child list. INVALID_STATE_ERR: Raised if the _L_S_P_a_r_s_e_r_._b_u_s_y attribute is true. _L_S_E_x_c_e_p_t_i_o_n PARSE_ERR: Raised if the LSParser was unable to load the XML fragment. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. IInntteerrffaaccee LLSSIInnppuutt This interface represents an input source for data. This interface allows an application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), a base URI, and/or a character stream. The exact definitions of a byte stream and a character stream are binding dependent. The application is expected to provide objects that implement this interface whenever such objects are needed. The application can either provide its own objects that implement this interface, or it can use the generic factory method _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S_._c_r_e_a_t_e_L_S_I_n_p_u_t_(_) to create objects that implement this interface. The _L_S_P_a_r_s_e_r will use the LSInput object to determine how to read data. The _L_S_P_a_r_s_e_r will look at the different inputs specified in the LSInput in the following order to know which one to read from, the first one that is not null and not an empty string will be used: 1. _L_S_I_n_p_u_t_._c_h_a_r_a_c_t_e_r_S_t_r_e_a_m 2. _L_S_I_n_p_u_t_._b_y_t_e_S_t_r_e_a_m 3. _L_S_I_n_p_u_t_._s_t_r_i_n_g_D_a_t_a 4. _L_S_I_n_p_u_t_._s_y_s_t_e_m_I_d 5. _L_S_I_n_p_u_t_._p_u_b_l_i_c_I_d If all inputs are null, the _L_S_P_a_r_s_e_r will report a DOMError with its DOMError.type set to "no-input-specified" and its DOMError.severity set to DOMError.SEVERITY_FATAL_ERROR. LSInput objects belong to the application. The DOM implementation will never modify them (though it may make copies and modify the copies, if necessary). IIDDLL DDeeffiinniittiioonn interface _L_S_I_n_p_u_t { // Depending on the language binding in use, // this attribute may not be available. attribute _L_S_R_e_a_d_e_r _c_h_a_r_a_c_t_e_r_S_t_r_e_a_m; attribute _L_S_I_n_p_u_t_S_t_r_e_a_m _b_y_t_e_S_t_r_e_a_m; attribute DOMString _s_t_r_i_n_g_D_a_t_a; attribute DOMString _s_y_s_t_e_m_I_d; attribute DOMString _p_u_b_l_i_c_I_d; attribute DOMString _b_a_s_e_U_R_I; attribute DOMString _e_n_c_o_d_i_n_g; attribute boolean _c_e_r_t_i_f_i_e_d_T_e_x_t; }; AAttttrriibbuutteess baseURI of type DOMString The base URI to be used (see section 5.1.4 in [_I_E_T_F_ _R_F_C _2_3_9_6]) for resolving a relative systemId to an absolute URI. If, when used, the base URI is itself a relative URI, an empty string, or null, the behavior is implementation dependent. byteStream of type _L_S_I_n_p_u_t_S_t_r_e_a_m An attribute of a language and binding dependent type that represents a stream of bytes. If the application knows the character encoding of the byte stream, it should set the encoding attribute. Setting the encoding in this way will override any encoding specified in an XML declaration in the data. certifiedText of type boolean If set to true, assume that the input is certified (see section 2.13 in [_X_M_L_ _1_._1]) when parsing [_X_M_L_ _1_._1]. characterStream of type _L_S_R_e_a_d_e_r Depending on the language binding in use, this attribute may not be available. An attribute of a language and binding dependent type that represents a stream of _1_6_-_b_i_t_ _u_n_i_t_s. The application must encode the stream using UTF-16 (defined in [_U_n_i_c_o_d_e] and in [_I_S_O_/_I_E_C_ _1_0_6_4_6]). It is not a requirement to have an XML declaration when using character streams. If an XML declaration is present, the value of the encoding attribute will be ignored. encoding of type DOMString The character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration ([_X_M_L_ _1_._0] section 4.3.3 "Character Encoding in Entities"). This attribute has no effect when the application provides a character stream or string data. For other sources of input, an encoding specified by means of this attribute will override any encoding specified in the XML declaration or the Text declaration, or an encoding obtained from a higher level protocol, such as HTTP [_I_E_T_F_ _R_F_C_ _2_6_1_6]. publicId of type DOMString The public identifier for this input source. This may be mapped to an input source using an implementation dependent mechanism (such as catalogues or other mappings). The public identifier, if specified, may also be reported as part of the location information when errors are reported. stringData of type DOMString String data to parse. If provided, this will always be treated as a sequence of _1_6_-_b_i_t_ _u_n_i_t_s (UTF-16 encoded characters). It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of the encoding attribute will be ignored. systemId of type DOMString The system identifier, a URI reference [_I_E_T_F_ _R_F_C_ _2_3_9_6], for this input source. The system identifier is optional if there is a byte stream, a character stream, or string data. It is still useful to provide one, since the application will use it to resolve any relative URIs and can include it in error messages and warnings. (The LSParser will only attempt to fetch the resource identified by the URI reference if there is no other input available in the input source.) If the application knows the character encoding of the object pointed to by the system identifier, it can set the encoding using the encoding attribute. If the specified system ID is a relative URI reference (see section 5 in [_I_E_T_F_ _R_F_C_ _2_3_9_6]), the DOM implementation will attempt to resolve the relative URI with the baseURI as the base, if that fails, the behavior is implementation dependent. IInntteerrffaaccee LLSSRReessoouurrcceeRReessoollvveerr LSResourceResolver provides a way for applications to redirect references to external resources. Applications needing to implement custom handling for external resources can implement this interface and register their implementation by setting the "resource-resolver" parameter of DOMConfiguration objects attached to _L_S_P_a_r_s_e_r and _L_S_S_e_r_i_a_l_i_z_e_r. It can also be register on DOMConfiguration objects attached to Document if the "LS" feature is supported. The _L_S_P_a_r_s_e_r will then allow the application to intercept any external entities, including the external DTD subset and external parameter entities, before including them. The top-level document entity is never passed to the resolveResource method. Many DOM applications will not need to implement this interface, but it will be especially useful for applications that build XML documents from databases or other specialized input sources, or for applications that use URNs. NNoottee:: LSResourceResolver is based on the SAX2 [_S_A_X] EntityResolver interface. IIDDLL DDeeffiinniittiioonn interface _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r { _L_S_I_n_p_u_t _r_e_s_o_l_v_e_R_e_s_o_u_r_c_e(in DOMString type, in DOMString namespaceURI, in DOMString publicId, in DOMString systemId, in DOMString baseURI); }; MMeetthhooddss resolveResource Allow the application to resolve external resources. The _L_S_P_a_r_s_e_r will call this method before opening any external resource, including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element (however, the top-level document entity is not passed to this method). The application may then request that the _L_S_P_a_r_s_e_r resolve the external resource itself, that it use an alternative URI, or that it use an entirely different input source. Application writers can use this method to redirect external system identifiers to secure and/or local URI, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box). PPaarraammeetteerrss type of type DOMString The type of the resource being resolved. For XML [_X_M_L _1_._0] resources (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". For XML Schema [_X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1], applications must use the value "http://www.w3.org/2001/XMLSchema". Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method. namespaceURI of type DOMString The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [_X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1] when resolving XML Schema resources. publicId of type DOMString The public identifier of the external entity being referenced, or null if no public identifier was supplied or if the resource is not an entity. systemId of type DOMString The system identifier, a URI reference [_I_E_T_F_ _R_F_C_ _2_3_9_6], of the external resource being referenced, or null if no system identifier was supplied. baseURI of type DOMString The absolute base URI of the resource being parsed, or null if there is no base URI. RReettuurrnn VVaalluuee _L_S_I_n_p_u_t A _L_S_I_n_p_u_t object describing the new input source, or null to request that the parser open a regular URI connection to the resource. NNoo EExxcceeppttiioonnss IInntteerrffaaccee LLSSPPaarrsseerrFFiilltteerr LSParserFilters provide applications the ability to examine nodes as they are being constructed while parsing. As each node is examined, it may be modified or removed, or the entire parse may be terminated early. At the time any of the filter methods are called by the parser, the owner Document and DOMImplementation objects exist and are accessible. The document element is never passed to the LSParserFilter methods, i.e. it is not possible to filter out the document element. Document, DocumentType, Notation, Entity, and Attr nodes are never passed to the acceptNode method on the filter. The child nodes of an EntityReference node are passed to the filter if the parameter "_ee_nn_tt_ii_tt_ii_ee_ss" is set to false. Note that, as described by the parameter "_ee_nn_tt_ii_tt_ii_ee_ss", unexpanded entity reference nodes are never discarded and are always passed to the filter. All validity checking while parsing a document occurs on the source document as it appears on the input stream, not on the DOM document as it is built in memory. With filters, the document in memory may be a subset of the document on the stream, and its validity may have been affected by the filtering. All default attributes must be present on elements when the elements are passed to the filter methods. All other default content must be passed to the filter methods. DOM applications must not raise exceptions in a filter. The effect of throwing exceptions from a filter is DOM implementation dependent. IIDDLL DDeeffiinniittiioonn interface _L_S_P_a_r_s_e_r_F_i_l_t_e_r { // Constants returned by startElement and acceptNode const short _F_I_L_T_E_R___A_C_C_E_P_T = 1; const short _F_I_L_T_E_R___R_E_J_E_C_T = 2; const short _F_I_L_T_E_R___S_K_I_P = 3; const short _F_I_L_T_E_R___I_N_T_E_R_R_U_P_T = 4; unsigned short _s_t_a_r_t_E_l_e_m_e_n_t(in Element elementArg); unsigned short _a_c_c_e_p_t_N_o_d_e(in Node nodeArg); readonly attribute unsigned long _w_h_a_t_T_o_S_h_o_w; }; DDeeffiinniittiioonn ggrroouupp CCoonnssttaannttss rreettuurrnneedd bbyy ssttaarrttEElleemmeenntt aanndd aacccceeppttNNooddee Constants returned by startElement and acceptNode. DDeeffiinneedd CCoonnssttaannttss FILTER_ACCEPT Accept the node. FILTER_INTERRUPT Interrupt the normal processing of the document. FILTER_REJECT Reject the node and its children. FILTER_SKIP Skip this single node. The children of this node will still be considered. AAttttrriibbuutteess whatToShow of type unsigned long, readonly Tells the _L_S_P_a_r_s_e_r what types of nodes to show to the method _L_S_P_a_r_s_e_r_F_i_l_t_e_r_._a_c_c_e_p_t_N_o_d_e. If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built. See NodeFilter for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT, SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here. Those nodes will never be passed to _L_S_P_a_r_s_e_r_F_i_l_t_e_r_._a_c_c_e_p_t_N_o_d_e. The constants used here are defined in [_D_O_M_ _L_e_v_e_l_ _2_ _T_r_a_v_e_r_s_a_l _a_n_d_ _R_a_n_g_e]. MMeetthhooddss acceptNode This method will be called by the parser at the completion of the parsing of each node. The node and all of its descendants will exist and be complete. The parent node will also exist, although it may be incomplete, i.e. it may have additional children that have not yet been parsed. Attribute nodes are never passed to this function. From within this method, the new node may be freely modified - children may be added or removed, text nodes modified, etc. The state of the rest of the document outside this node is not defined, and the affect of any attempt to navigate to, or to modify any other part of the document is undefined. For validating parsers, the checks are made on the original document, before any modification by the filter. No validity checks are made on any document modifications made by the filter. If this new node is rejected, the parser might reuse the new node and any of its descendants. PPaarraammeetteerrss nodeArg of type Node The newly constructed element. At the time this method is called, the element is complete - it has all of its children (and their children, recursively) and attributes, and is attached as a child to its parent. RReettuurrnn VVaalluuee unsigned short * FILTER_ACCEPT if this Node should be included in the DOM document being built. * FILTER_REJECT if the Node and all of its children should be rejected. * FILTER_SKIP if the Node should be skipped and the Node should be replaced by all the children of the Node. * FILTER_INTERRUPT if the filter wants to stop the processing of the document. Interrupting the processing of the document does no longer guarantee that the resulting DOM tree is _X_M_L_ _w_e_l_l_- _f_o_r_m_e_d. The Node is accepted and will be the last completely parsed node. NNoo EExxcceeppttiioonnss startElement The parser will call this method after each Element start tag has been scanned, but before the remainder of the Element is processed. The intent is to allow the element, including any children, to be efficiently skipped. Note that only element nodes are passed to the startElement function. The element node passed to startElement for filtering will include all of the Element's attributes, but none of the children nodes. The Element may not yet be in place in the document being constructed (it may not have a parent node.) A startElement filter function may access or change the attributes for the Element. Changing Namespace declarations will have no effect on namespace resolution by the parser. For efficiency, the Element node passed to the filter may not be the same one as is actually placed in the tree if the node is accepted. And the actual node (node object identity) may be reused during the process of reading in and filtering a document. PPaarraammeetteerrss elementArg of type Element The newly encountered element. At the time this method is called, the element is incomplete - it will have its attributes, but no children. RReettuurrnn VVaalluuee unsigned short * FILTER_ACCEPT if the Element should be included in the DOM document being built. * FILTER_REJECT if the Element and all of its children should be rejected. * FILTER_SKIP if the Element should be skipped. All of its children are inserted in place of the skipped Element node. * FILTER_INTERRUPT if the filter wants to stop the processing of the document. Interrupting the processing of the document does no longer guarantee that the resulting DOM tree is _X_M_L_ _w_e_l_l_- _f_o_r_m_e_d. The Element is rejected. Returning any other values will result in unspecified behavior. NNoo EExxcceeppttiioonnss IInntteerrffaaccee LLSSPPrrooggrreessssEEvveenntt This interface represents a progress event object that notifies the application about progress as a document is parsed. It extends the Event interface defined in [_D_O_M_ _L_e_v_e_l_ _3_ _E_v_e_n_t_s]. The units used for the attributes position and totalSize are not specified and can be implementation and input dependent. IIDDLL DDeeffiinniittiioonn interface _L_S_P_r_o_g_r_e_s_s_E_v_e_n_t : events::Event { readonly attribute _L_S_I_n_p_u_t _i_n_p_u_t; readonly attribute unsigned long _p_o_s_i_t_i_o_n; readonly attribute unsigned long _t_o_t_a_l_S_i_z_e; }; AAttttrriibbuutteess input of type _L_S_I_n_p_u_t, readonly The input source that is being parsed. position of type unsigned long, readonly The current position in the input source, including all external entities and other resources that have been read. totalSize of type unsigned long, readonly The total size of the document including all external resources, this number might change as a document is being parsed if references to more external resources are seen. A value of 0 is returned if the total size cannot be determined or estimated. IInntteerrffaaccee LLSSLLooaaddEEvveenntt This interface represents a load event object that signals the completion of a document load. IIDDLL DDeeffiinniittiioonn interface _L_S_L_o_a_d_E_v_e_n_t : events::Event { readonly attribute Document _n_e_w_D_o_c_u_m_e_n_t; readonly attribute _L_S_I_n_p_u_t _i_n_p_u_t; }; AAttttrriibbuutteess input of type _L_S_I_n_p_u_t, readonly The input source that was parsed. newDocument of type Document, readonly The document that finished loading. IInntteerrffaaccee LLSSSSeerriiaalliizzeerr A LSSerializer provides an API for serializing (writing) a DOM document out into XML. The XML data is written to a string or an output stream. Any changes or fixups made during the serialization affect only the serialized data. The Document object and its children are never altered by the serialization operation. During serialization of XML data, namespace fixup is done as defined in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e], Appendix B. [_D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e] allows empty strings as a real namespace URI. If the namespaceURI of a Node is empty string, the serialization will treat them as null, ignoring the prefix if any. LSSerializer accepts any node type for serialization. For nodes of type Document or Entity, well-formed XML will be created when possible (well- formedness is guaranteed if the document or entity comes from a parse operation and is unchanged since it was created). The serialized output for these node types is either as a XML document or an External XML Entity, respectively, and is acceptable input for an XML parser. For all other types of nodes the serialized form is implementation dependent. Within a Document, DocumentFragment, or Entity being serialized, Nodes are processed as follows * Document nodes are written, including the XML declaration (unless the parameter "_x_m_l_-_d_e_c_l_a_r_a_t_i_o_n" is set to false) and a DTD subset, if one exists in the DOM. Writing a Document node serializes the entire document. * Entity nodes, when written directly by _L_S_S_e_r_i_a_l_i_z_e_r_._w_r_i_t_e, outputs the entity expansion but no namespace fixup is done. The resulting output will be valid as an external entity. * If the parameter "_ee_nn_tt_ii_tt_ii_ee_ss" is set to true, EntityReference nodes are serialized as an entity reference of the form "&entityName;" in the output. Child nodes (the expansion) of the entity reference are ignored. If the parameter "_ee_nn_tt_ii_tt_ii_ee_ss" is set to false, only the children of the entity reference are serialized. EntityReference nodes with no children (no corresponding Entity node or the corresponding Entity nodes have no children) are always serialized. * CDATAsections containing content characters that cannot be represented in the specified output encoding are handled according to the "_ss_pp_ll_ii_tt_--_cc_dd_aa_tt_aa_--_ss_ee_cc_tt_ii_oo_nn_ss" parameter. If the parameter is set to true, CDATAsections are split, and the unrepresentable characters are serialized as numeric character references in ordinary content. The exact position and number of splits is not specified. If the parameter is set to false, unrepresentable characters in a CDATAsection are reported as "wf-invalid-character" errors if the parameter "_ww_ee_ll_ll_--_ff_oo_rr_mm_ee_dd" is set to true. The error is not recoverable - there is no mechanism for supplying alternative characters and continuing with the serialization. * DocumentFragment nodes are serialized by serializing the children of the document fragment in the order they appear in the document fragment. * All other node types (Element, Text, etc.) are serialized to their corresponding XML source form. NNoottee:: The serialization of a Node does not always generate a _w_e_l_l_-_f_o_r_m_e_d XML document, i.e. a _L_S_P_a_r_s_e_r might throw fatal errors when parsing the resulting serialization. Within the character data of a document (outside of markup), any characters that cannot be represented directly are replaced with character references. Occurrences of '<' and '&' are replaced by the predefined entities < and &. The other predefined entities (>, ', and ") might not be used, except where needed (e.g. using > in cases such as ']]>'). Any characters that cannot be represented directly in the output character encoding are serialized as numeric character references (and since character encoding standards commonly use hexadecimal representations of characters, using the hexadecimal representation when serializing character references is encouraged). To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as "'", and the double-quote character (") as """. New line characters and other characters that cannot be represented directly in attribute values in the output character encoding are serialized as a numeric character reference. Within markup, but outside of attributes, any occurrence of a character that cannot be represented in the output character encoding is reported as a DOMError fatal error. An example would be serializing the element with encoding="us-ascii". This will result with a generation of a DOMError "wf-invalid-character-in-node-name" (as proposed in "_ww_ee_ll_ll_-- _ff_oo_rr_mm_ee_dd"). When requested by setting the parameter "_nn_oo_rr_mm_aa_ll_ii_zz_ee_--_cc_hh_aa_rr_aa_cc_tt_ee_rr_ss" on LSSerializer to true, character normalization is performed according to the definition of _f_u_l_l_y_ _n_o_r_m_a_l_i_z_e_d characters included in appendix E of [_X_M_L_ _1_._1] on all data to be serialized, both markup and character data. The character normalization process affects only the data as it is being written; it does not alter the DOM's view of the document after serialization has completed. Implementations are required to support the encodings "UTF-8", "UTF-16", "UTF-16BE", and "UTF-16LE" to guarantee that data is serializable in all encodings that are required to be supported by all XML parsers. When the encoding is UTF-8, whether or not a byte order mark is serialized, or if the output is big-endian or little-endian, is implementation dependent. When the encoding is UTF-16, whether or not the output is big-endian or little-endian is implementation dependent, but a Byte Order Mark must be generated for non-character outputs, such as _L_S_O_u_t_p_u_t_._b_y_t_e_S_t_r_e_a_m or _L_S_O_u_t_p_u_t_._s_y_s_t_e_m_I_d. If the Byte Order Mark is not generated, a "byte- order-mark-needed" warning is reported. When the encoding is UTF-16LE or UTF-16BE, the output is big-endian (UTF-16BE) or little-endian (UTF-16LE) and the Byte Order Mark is not be generated. In all cases, the encoding declaration, if generated, will correspond to the encoding used during the serialization (e.g. encoding="UTF-16" will appear if UTF-16 was requested). Namespaces are fixed up during serialization, the serialization process will verify that namespace declarations, namespace prefixes and the namespace URI associated with elements and attributes are consistent. If inconsistencies are found, the serialized form of the document will be altered to remove them. The method used for doing the namespace fixup while serializing a document is the algorithm defined in Appendix B.1, "Namespace normalization", of [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e]. While serializing a document, the parameter "_d_i_s_c_a_r_d_-_d_e_f_a_u_l_t_-_c_o_n_t_e_n_t" controls whether or not non-specified data is serialized. While serializing, errors and warnings are reported to the application through the error handler (_L_S_S_e_r_i_a_l_i_z_e_r_._d_o_m_C_o_n_f_i_g's "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" parameter). This specification does in no way try to define all possible errors and warnings that can occur while serializing a DOM node, but some common error and warning cases are defined. The types (DOMError.type) of errors and warnings defined by this specification are: "no-output-specified" [fatal] Raised when writing to a _L_S_O_u_t_p_u_t if no output is specified in the _L_S_O_u_t_p_u_t. "unbound-prefix-in-entity-reference" [fatal] Raised if the configuration parameter "_nn_aa_mm_ee_ss_pp_aa_cc_ee_ss" is set to true and an entity whose replacement text contains unbound namespace prefixes is referenced in a location where there are no bindings for the namespace prefixes. "unsupported-encoding" [fatal] Raised if an unsupported encoding is encountered. In addition to raising the defined errors and warnings, implementations are expected to raise implementation specific errors and warnings for any other error and warning cases such as IO errors (file not found, permission denied,...) and so on. IIDDLL DDeeffiinniittiioonn interface _L_S_S_e_r_i_a_l_i_z_e_r { readonly attribute DOMConfiguration _d_o_m_C_o_n_f_i_g; attribute DOMString _n_e_w_L_i_n_e; attribute _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r _f_i_l_t_e_r; boolean _w_r_i_t_e(in Node nodeArg, in _L_S_O_u_t_p_u_t destination) raises(_L_S_E_x_c_e_p_t_i_o_n); boolean _w_r_i_t_e_T_o_U_R_I(in Node nodeArg, in DOMString uri) raises(_L_S_E_x_c_e_p_t_i_o_n); DOMString _w_r_i_t_e_T_o_S_t_r_i_n_g(in Node nodeArg) raises(DOMException, _L_S_E_x_c_e_p_t_i_o_n); }; AAttttrriibbuutteess domConfig of type DOMConfiguration, readonly The DOMConfiguration object used by the LSSerializer when serializing a DOM node. In addition to the parameters recognized by the _DD_OO_MM_CC_oo_nn_ff_ii_gg_uu_rr_aa_tt_ii_oo_nn interface defined in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e], the DOMConfiguration objects for LSSerializer adds, or modifies, the following parameters: "canonical-form" true [ooppttiioonnaall] Writes the document according to the rules specified in [_C_a_n_o_n_i_c_a_l_ _X_M_L]. In addition to the behavior described in "_cc_aa_nn_oo_nn_ii_cc_aa_ll_--_ff_oo_rr_mm" [_D_O_M_ _L_e_v_e_l _3_ _C_o_r_e], setting this parameter to true will set the parameters "_f_o_r_m_a_t_-_p_r_e_t_t_y_-_p_r_i_n_t", "_d_i_s_c_a_r_d_- _d_e_f_a_u_l_t_-_c_o_n_t_e_n_t", and "_x_m_l_-_d_e_c_l_a_r_a_t_i_o_n", to false. Setting one of those parameters to true will set this parameter to false. Serializing an XML 1.1 document when "canonical-form" is true will generate a fatal error. false [rreeqquuiirreedd] (ddeeffaauulltt) Do not canonicalize the output. "discard-default-content" true [rreeqquuiirreedd] (ddeeffaauulltt) Use the Attr.specified attribute to decide what attributes should be discarded. Note that some implementations might use whatever information available to the implementation (i.e. XML schema, DTD, the Attr.specified attribute, and so on) to determine what attributes and content to discard if this parameter is set to true. false [rreeqquuiirreedd] Keep all attributes and all content. "format-pretty-print" true [ooppttiioonnaall] Formatting the output by adding whitespace to produce a pretty-printed, indented, human- readable form. The exact form of the transformations is not specified by this specification. Pretty-printing changes the content of the document and may affect the validity of the document, validating implementations should preserve validity. false [rreeqquuiirreedd] (ddeeffaauulltt) Don't pretty-print the result. "ignore-unknown-character-denormalizations" true [rreeqquuiirreedd] (ddeeffaauulltt) If, while verifying full normalization when [_X_M_L _1_._1] is supported, a character is encountered for which the normalization properties cannot be determined, then raise a "unknown-character- denormalization" warning (instead of raising an error, if this parameter is not set) and ignore any possible denormalizations caused by these characters. false [ooppttiioonnaall] Report a fatal error if a character is encountered for which the processor cannot determine the normalization properties. "normalize-characters" This parameter is equivalent to the one defined by DOMConfiguration in [_D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e]. Unlike in the Core, the default value for this parameter is true. While DOM implementations are not required to support _f_u_l_l_y_ _n_o_r_m_a_l_i_z_i_n_g the characters in the document according to appendix E of [_X_M_L_ _1_._1], this parameter must be activated by default if supported. "xml-declaration" true [rreeqquuiirreedd] (ddeeffaauulltt) If a Document, Element, or Entity node is serialized, the XML declaration, or text declaration, should be included. The version (Document.xmlVersion if the document is a Level 3 document and the version is non-null, otherwise use the value "1.0"), and the output encoding (see _L_S_S_e_r_i_a_l_i_z_e_r_._w_r_i_t_e for details on how to find the output encoding) are specified in the serialized XML declaration. false [rreeqquuiirreedd] Do not serialize the XML and text declarations. Report a "xml-declaration-needed" warning if this will cause problems (i.e. the serialized data is of an XML version other than [_X_M_L_ _1_._0], or an encoding would be needed to be able to re-parse the serialized data). filter of type _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r When the application provides a filter, the serializer will call out to the filter before serializing each Node. The filter implementation can choose to remove the node from the stream or to terminate the serialization early. The filter is invoked after the operations requested by the DOMConfiguration parameters have been applied. For example, CDATA sections won't be passed to the filter if "_cc_dd_aa_tt_aa_-- _ss_ee_cc_tt_ii_oo_nn_ss" is set to false. newLine of type DOMString The end-of-line sequence of characters to be used in the XML being written out. Any string is supported, but XML treats only a certain set of characters sequence as end-of-line (See section 2.11, "End-of-Line Handling" in [_X_M_L_ _1_._0], if the serialized content is XML 1.0 or section 2.11, "End-of-Line Handling" in [_X_M_L_ _1_._1], if the serialized content is XML 1.1). Using other character sequences than the recommended ones can result in a document that is either not serializable or not well-formed). On retrieval, the default value of this attribute is the implementation specific default end-of-line sequence. DOM implementations should choose the default to match the usual convention for text files in the environment being used. Implementations must choose a default sequence that matches one of those allowed by XML 1.0 or XML 1.1, depending on the serialized content. Setting this attribute to null will reset its value to the default value. MMeetthhooddss write Serialize the specified node as described above in the general description of the LSSerializer interface. The output is written to the supplied _L_S_O_u_t_p_u_t. When writing to a _L_S_O_u_t_p_u_t, the encoding is found by looking at the encoding information that is reachable through the _L_S_O_u_t_p_u_t and the item to be written (or its owner document) in this order: 1. _L_S_O_u_t_p_u_t_._e_n_c_o_d_i_n_g, 2. Document.inputEncoding, 3. Document.xmlEncoding. If no encoding is reachable through the above properties, a default encoding of "UTF-8" will be used. If the specified encoding is not supported an "unsupported-encoding" fatal error is raised. If no output is specified in the _L_S_O_u_t_p_u_t, a "no-output- specified" fatal error is raised. The implementation is responsible of associating the appropriate media type with the serialized data. When writing to a HTTP URI, a HTTP PUT is performed. When writing to other types of URIs, the mechanism for writing the data to the URI is implementation dependent. PPaarraammeetteerrss nodeArg of type Node The node to serialize. destination of type _L_S_O_u_t_p_u_t The destination for the serialized DOM. RReettuurrnn VVaalluuee boolean Returns true if node was successfully serialized. Return false in case the normal processing stopped but the implementation kept serializing the document; the result of the serialization being implementation dependent then. EExxcceeppttiioonnss _L_S_E_x_c_e_p_t_i_o_n SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. writeToString Serialize the specified node as described above in the general description of the LSSerializer interface. The output is written to a DOMString that is returned to the caller. The encoding used is the encoding of the DOMString type, i.e. UTF-16. Note that no Byte Order Mark is generated in a DOMString object. PPaarraammeetteerrss nodeArg of type Node The node to serialize. RReettuurrnn VVaalluuee DOMString Returns the serialized data. EExxcceeppttiioonnss DOMException DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to fit in a DOMString. _L_S_E_x_c_e_p_t_i_o_n SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. writeToURI A convenience method that acts as if _L_S_S_e_r_i_a_l_i_z_e_r_._w_r_i_t_e was called with a _L_S_O_u_t_p_u_t with no encoding specified and _L_S_O_u_t_p_u_t_._s_y_s_t_e_m_I_d set to the uri argument. PPaarraammeetteerrss nodeArg of type Node The node to serialize. uri of type DOMString The URI to write to. RReettuurrnn VVaalluuee boolean Returns true if node was successfully serialized. Return false in case the normal processing stopped but the implementation kept serializing the document; the result of the serialization being implementation dependent then. EExxcceeppttiioonnss _L_S_E_x_c_e_p_t_i_o_n SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node. DOM applications should attach a DOMErrorHandler using the parameter "_ee_rr_rr_oo_rr_--_hh_aa_nn_dd_ll_ee_rr" if they wish to get details on the error. IInntteerrffaaccee LLSSOOuuttppuutt This interface represents an output destination for data. This interface allows an application to encapsulate information about an output destination in a single object, which may include a URI, a byte stream (possibly with a specified encoding), a base URI, and/or a character stream. The exact definitions of a byte stream and a character stream are binding dependent. The application is expected to provide objects that implement this interface whenever such objects are needed. The application can either provide its own objects that implement this interface, or it can use the generic factory method _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S_._c_r_e_a_t_e_L_S_O_u_t_p_u_t_(_) to create objects that implement this interface. The _L_S_S_e_r_i_a_l_i_z_e_r will use the LSOutput object to determine where to serialize the output to. The _L_S_S_e_r_i_a_l_i_z_e_r will look at the different outputs specified in the LSOutput in the following order to know which one to output to, the first one that is not null and not an empty string will be used: 1. _L_S_O_u_t_p_u_t_._c_h_a_r_a_c_t_e_r_S_t_r_e_a_m 2. _L_S_O_u_t_p_u_t_._b_y_t_e_S_t_r_e_a_m 3. _L_S_O_u_t_p_u_t_._s_y_s_t_e_m_I_d LSOutput objects belong to the application. The DOM implementation will never modify them (though it may make copies and modify the copies, if necessary). IIDDLL DDeeffiinniittiioonn interface _L_S_O_u_t_p_u_t { // Depending on the language binding in use, // this attribute may not be available. attribute _L_S_W_r_i_t_e_r _c_h_a_r_a_c_t_e_r_S_t_r_e_a_m; attribute _L_S_O_u_t_p_u_t_S_t_r_e_a_m _b_y_t_e_S_t_r_e_a_m; attribute DOMString _s_y_s_t_e_m_I_d; attribute DOMString _e_n_c_o_d_i_n_g; }; AAttttrriibbuutteess byteStream of type _L_S_O_u_t_p_u_t_S_t_r_e_a_m An attribute of a language and binding dependent type that represents a writable stream of bytes. characterStream of type _L_S_W_r_i_t_e_r Depending on the language binding in use, this attribute may not be available. An attribute of a language and binding dependent type that represents a writable stream to which _1_6_-_b_i_t_ _u_n_i_t_s can be output. encoding of type DOMString The character encoding to use for the output. The encoding must be a string acceptable for an XML encoding declaration ( [_X_M_L_ _1_._0] section 4.3.3 "Character Encoding in Entities"), it is recommended that character encodings registered (as charsets) with the Internet Assigned Numbers Authority [_I_A_N_A_- _C_H_A_R_S_E_T_S] should be referred to using their registered names. systemId of type DOMString The system identifier, a URI reference [_I_E_T_F_ _R_F_C_ _2_3_9_6], for this output destination. If the system ID is a relative URI reference (see section 5 in [_I_E_T_F_ _R_F_C_ _2_3_9_6]), the behavior is implementation dependent. IInntteerrffaaccee LLSSSSeerriiaalliizzeerrFFiilltteerr LSSerializerFilters provide applications the ability to examine nodes as they are being serialized and decide what nodes should be serialized or not. The LSSerializerFilter interface is based on the NodeFilter interface defined in [_D_O_M_ _L_e_v_e_l_ _2_ _T_r_a_v_e_r_s_a_l_ _a_n_d_ _R_a_n_g_e]. Document, DocumentType, DocumentFragment, Notation, Entity, and children of Attr nodes are not passed to the filter. The child nodes of an EntityReference node are only passed to the filter if the EntityReference node is skipped by the method _L_S_P_a_r_s_e_r_F_i_l_t_e_r_._a_c_c_e_p_t_N_o_d_e_(_). When serializing an Element, the element is passed to the filter before any of its attributes are passed to the filter. Namespace declaration attributes, and default attributes (except in the case when "_d_i_s_c_a_r_d_- _d_e_f_a_u_l_t_-_c_o_n_t_e_n_t" is set to false), are never passed to the filter. The result of any attempt to modify a node passed to a LSSerializerFilter is implementation dependent. DOM applications must not raise exceptions in a filter. The effect of throwing exceptions from a filter is DOM implementation dependent. For efficiency, a node passed to the filter may not be the same as the one that is actually in the tree. And the actual node (node object identity) may be reused during the process of filtering and serializing a document. IIDDLL DDeeffiinniittiioonn interface _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r : traversal::NodeFilter { readonly attribute unsigned long _w_h_a_t_T_o_S_h_o_w; }; AAttttrriibbuutteess whatToShow of type unsigned long, readonly Tells the _L_S_S_e_r_i_a_l_i_z_e_r what types of nodes to show to the filter. If a node is not shown to the filter using this attribute, it is automatically serialized. See NodeFilter for definition of the constants. The constants SHOW_DOCUMENT, SHOW_DOCUMENT_TYPE, SHOW_DOCUMENT_FRAGMENT, SHOW_NOTATION, and SHOW_ENTITY are meaningless here, such nodes will never be passed to a LSSerializerFilter. Unlike [_D_O_M_ _L_e_v_e_l_ _2_ _T_r_a_v_e_r_s_a_l_ _a_n_d_ _R_a_n_g_e], the SHOW_ATTRIBUTE constant indicates that the Attr nodes are shown and passed to the filter. The constants used here are defined in [_D_O_M_ _L_e_v_e_l_ _2_ _T_r_a_v_e_r_s_a_l _a_n_d_ _R_a_n_g_e]. 07 April 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 Abstract Schemas and Load and Save 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_/_R_E_C_-_D_O_M_-_L_e_v_e_l_-_3_- _L_S_-_2_0_0_4_0_4_0_7_/_i_d_l_._z_i_p ******** _ll_ss_.._ii_dd_ll:: ******** // File: ls.idl #ifndef _LS_IDL_ #define _LS_IDL_ #include "dom.idl" #include "events.idl" #include "traversal.idl" #pragma prefix "dom.w3c.org" module ls { typedef Object _L_S_I_n_p_u_t_S_t_r_e_a_m; typedef Object _L_S_O_u_t_p_u_t_S_t_r_e_a_m; typedef Object _L_S_R_e_a_d_e_r; typedef Object _L_S_W_r_i_t_e_r; typedef dom::DOMString DOMString; typedef dom::DOMConfiguration DOMConfiguration; typedef dom::Node Node; typedef dom::Document Document; typedef dom::Element Element; interface LSParser; interface LSSerializer; interface LSInput; interface LSOutput; interface LSParserFilter; interface LSSerializerFilter; exception _L_S_E_x_c_e_p_t_i_o_n { unsigned short code; }; // LSExceptionCode const unsigned short _P_A_R_S_E___E_R_R = 81; const unsigned short _S_E_R_I_A_L_I_Z_E___E_R_R = 82; interface _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S { // DOMImplementationLSMode const unsigned short _M_O_D_E___S_Y_N_C_H_R_O_N_O_U_S = 1; const unsigned short _M_O_D_E___A_S_Y_N_C_H_R_O_N_O_U_S = 2; _L_S_P_a_r_s_e_r _c_r_e_a_t_e_L_S_P_a_r_s_e_r(in unsigned short mode, in DOMString schemaType) raises(dom::DOMException); _L_S_S_e_r_i_a_l_i_z_e_r _c_r_e_a_t_e_L_S_S_e_r_i_a_l_i_z_e_r(); _L_S_I_n_p_u_t _c_r_e_a_t_e_L_S_I_n_p_u_t(); _L_S_O_u_t_p_u_t _c_r_e_a_t_e_L_S_O_u_t_p_u_t(); }; interface _L_S_P_a_r_s_e_r { readonly attribute DOMConfiguration _d_o_m_C_o_n_f_i_g; attribute _L_S_P_a_r_s_e_r_F_i_l_t_e_r _f_i_l_t_e_r; readonly attribute boolean _a_s_y_n_c; readonly attribute boolean _b_u_s_y; Document _p_a_r_s_e(in _L_S_I_n_p_u_t input) raises(dom::DOMException, _L_S_E_x_c_e_p_t_i_o_n); Document _p_a_r_s_e_U_R_I(in DOMString uri) raises(dom::DOMException, _L_S_E_x_c_e_p_t_i_o_n); // ACTION_TYPES const unsigned short _A_C_T_I_O_N___A_P_P_E_N_D___A_S___C_H_I_L_D_R_E_N = 1; const unsigned short _A_C_T_I_O_N___R_E_P_L_A_C_E___C_H_I_L_D_R_E_N = 2; const unsigned short _A_C_T_I_O_N___I_N_S_E_R_T___B_E_F_O_R_E = 3; const unsigned short _A_C_T_I_O_N___I_N_S_E_R_T___A_F_T_E_R = 4; const unsigned short _A_C_T_I_O_N___R_E_P_L_A_C_E = 5; Node _p_a_r_s_e_W_i_t_h_C_o_n_t_e_x_t(in _L_S_I_n_p_u_t input, in Node contextArg, in unsigned short action) raises(dom::DOMException, _L_S_E_x_c_e_p_t_i_o_n); void _a_b_o_r_t(); }; interface _L_S_I_n_p_u_t { // Depending on the language binding in use, // this attribute may not be available. attribute _L_S_R_e_a_d_e_r _c_h_a_r_a_c_t_e_r_S_t_r_e_a_m; attribute _L_S_I_n_p_u_t_S_t_r_e_a_m _b_y_t_e_S_t_r_e_a_m; attribute DOMString _s_t_r_i_n_g_D_a_t_a; attribute DOMString _s_y_s_t_e_m_I_d; attribute DOMString _p_u_b_l_i_c_I_d; attribute DOMString _b_a_s_e_U_R_I; attribute DOMString _e_n_c_o_d_i_n_g; attribute boolean _c_e_r_t_i_f_i_e_d_T_e_x_t; }; interface _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r { _L_S_I_n_p_u_t _r_e_s_o_l_v_e_R_e_s_o_u_r_c_e(in DOMString type, in DOMString namespaceURI, in DOMString publicId, in DOMString systemId, in DOMString baseURI); }; interface _L_S_P_a_r_s_e_r_F_i_l_t_e_r { // Constants returned by startElement and acceptNode const short _F_I_L_T_E_R___A_C_C_E_P_T = 1; const short _F_I_L_T_E_R___R_E_J_E_C_T = 2; const short _F_I_L_T_E_R___S_K_I_P = 3; const short _F_I_L_T_E_R___I_N_T_E_R_R_U_P_T = 4; unsigned short _s_t_a_r_t_E_l_e_m_e_n_t(in Element elementArg); unsigned short _a_c_c_e_p_t_N_o_d_e(in Node nodeArg); readonly attribute unsigned long _w_h_a_t_T_o_S_h_o_w; }; interface _L_S_S_e_r_i_a_l_i_z_e_r { readonly attribute DOMConfiguration _d_o_m_C_o_n_f_i_g; attribute DOMString _n_e_w_L_i_n_e; attribute _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r _f_i_l_t_e_r; boolean _w_r_i_t_e(in Node nodeArg, in _L_S_O_u_t_p_u_t destination) raises(_L_S_E_x_c_e_p_t_i_o_n); boolean _w_r_i_t_e_T_o_U_R_I(in Node nodeArg, in DOMString uri) raises(_L_S_E_x_c_e_p_t_i_o_n); DOMString _w_r_i_t_e_T_o_S_t_r_i_n_g(in Node nodeArg) raises(dom::DOMException, _L_S_E_x_c_e_p_t_i_o_n); }; interface _L_S_O_u_t_p_u_t { // Depending on the language binding in use, // this attribute may not be available. attribute _L_S_W_r_i_t_e_r _c_h_a_r_a_c_t_e_r_S_t_r_e_a_m; attribute _L_S_O_u_t_p_u_t_S_t_r_e_a_m _b_y_t_e_S_t_r_e_a_m; attribute DOMString _s_y_s_t_e_m_I_d; attribute DOMString _e_n_c_o_d_i_n_g; }; interface _L_S_P_r_o_g_r_e_s_s_E_v_e_n_t : events::Event { readonly attribute _L_S_I_n_p_u_t _i_n_p_u_t; readonly attribute unsigned long _p_o_s_i_t_i_o_n; readonly attribute unsigned long _t_o_t_a_l_S_i_z_e; }; interface _L_S_L_o_a_d_E_v_e_n_t : events::Event { readonly attribute Document _n_e_w_D_o_c_u_m_e_n_t; readonly attribute _L_S_I_n_p_u_t _i_n_p_u_t; }; interface _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r : traversal::NodeFilter { readonly attribute unsigned long _w_h_a_t_T_o_S_h_o_w; }; }; #endif // _LS_IDL_ 07 April 2004 ************ AAppppeennddiixx BB:: JJaavvaa LLaanngguuaaggee BBiinnddiinngg ************ This appendix contains the complete Java [_J_a_v_a] bindings for the Level 3 Document Object Model Load and Save. 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_/_R_E_C_-_D_O_M_-_L_e_v_e_l_-_3_- _L_S_-_2_0_0_4_0_4_0_7_/_j_a_v_a_-_b_i_n_d_i_n_g_._z_i_p ******** oorrgg//ww33cc//ddoomm//llss//LLSSEExxcceeppttiioonn..jjaavvaa:: ******** package org.w3c.dom.ls; public class LSException extends RuntimeException { public LSException(short code, String message) { super(message); this.code = code; } public short code; // LSExceptionCode public static final short PARSE_ERR = 81; public static final short SERIALIZE_ERR = 82; } ******** oorrgg//ww33cc//ddoomm//llss//DDOOMMIImmpplleemmeennttaattiioonnLLSS..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.DOMException; public interface DOMImplementationLS { // DOMImplementationLSMode public static final short MODE_SYNCHRONOUS = 1; public static final short MODE_ASYNCHRONOUS = 2; public LSParser createLSParser(short mode, String schemaType) throws DOMException; public LSSerializer createLSSerializer(); public LSInput createLSInput(); public LSOutput createLSOutput(); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSPPaarrsseerr..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.Document; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface LSParser { public DOMConfiguration getDomConfig(); public LSParserFilter getFilter(); public void setFilter(LSParserFilter filter); public boolean getAsync(); public boolean getBusy(); public Document parse(LSInput input) throws DOMException, LSException; public Document parseURI(String uri) throws DOMException, LSException; // ACTION_TYPES public static final short ACTION_APPEND_AS_CHILDREN = 1; public static final short ACTION_REPLACE_CHILDREN = 2; public static final short ACTION_INSERT_BEFORE = 3; public static final short ACTION_INSERT_AFTER = 4; public static final short ACTION_REPLACE = 5; public Node parseWithContext(LSInput input, Node contextArg, short action) throws DOMException, LSException; public void abort(); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSIInnppuutt..jjaavvaa:: ******** package org.w3c.dom.ls; public interface LSInput { public java.io.Reader getCharacterStream(); public void setCharacterStream(java.io.Reader characterStream); public java.io.InputStream getByteStream(); public void setByteStream(java.io.InputStream byteStream); public String getStringData(); public void setStringData(String stringData); public String getSystemId(); public void setSystemId(String systemId); public String getPublicId(); public void setPublicId(String publicId); public String getBaseURI(); public void setBaseURI(String baseURI); public String getEncoding(); public void setEncoding(String encoding); public boolean getCertifiedText(); public void setCertifiedText(boolean certifiedText); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSRReessoouurrcceeRReessoollvveerr..jjaavvaa:: ******** package org.w3c.dom.ls; public interface LSResourceResolver { public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSPPaarrsseerrFFiilltteerr..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.Node; import org.w3c.dom.Element; public interface LSParserFilter { // Constants returned by startElement and acceptNode public static final short FILTER_ACCEPT = 1; public static final short FILTER_REJECT = 2; public static final short FILTER_SKIP = 3; public static final short FILTER_INTERRUPT = 4; public short startElement(Element elementArg); public short acceptNode(Node nodeArg); public int getWhatToShow(); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSPPrrooggrreessssEEvveenntt..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.events.Event; public interface LSProgressEvent extends Event { public LSInput getInput(); public int getPosition(); public int getTotalSize(); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSLLooaaddEEvveenntt..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.Document; import org.w3c.dom.events.Event; public interface LSLoadEvent extends Event { public Document getNewDocument(); public LSInput getInput(); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSSSeerriiaalliizzeerr..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface LSSerializer { public DOMConfiguration getDomConfig(); public String getNewLine(); public void setNewLine(String newLine); public LSSerializerFilter getFilter(); public void setFilter(LSSerializerFilter filter); public boolean write(Node nodeArg, LSOutput destination) throws LSException; public boolean writeToURI(Node nodeArg, String uri) throws LSException; public String writeToString(Node nodeArg) throws DOMException, LSException; } ******** oorrgg//ww33cc//ddoomm//llss//LLSSOOuuttppuutt..jjaavvaa:: ******** package org.w3c.dom.ls; public interface LSOutput { public java.io.Writer getCharacterStream(); public void setCharacterStream(java.io.Writer characterStream); public java.io.OutputStream getByteStream(); public void setByteStream(java.io.OutputStream byteStream); public String getSystemId(); public void setSystemId(String systemId); public String getEncoding(); public void setEncoding(String encoding); } ******** oorrgg//ww33cc//ddoomm//llss//LLSSSSeerriiaalliizzeerrFFiilltteerr..jjaavvaa:: ******** package org.w3c.dom.ls; import org.w3c.dom.traversal.NodeFilter; public interface LSSerializerFilter extends NodeFilter { public int getWhatToShow(); } 07 April 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 Load and Save definitions. Properties of the LLSSEExxcceeppttiioonn Constructor function: LLSSEExxcceeppttiioonn..PPAARRSSEE__EERRRR The value of the constant LLSSEExxcceeppttiioonn..PPAARRSSEE__EERRRR is 8811. LLSSEExxcceeppttiioonn..SSEERRIIAALLIIZZEE__EERRRR The value of the constant LLSSEExxcceeppttiioonn..SSEERRIIAALLIIZZEE__EERRRR is 8822. Objects that implement the LLSSEExxcceeppttiioonn interface: Properties of objects that implement the LLSSEExxcceeppttiioonn interface: ccooddee This property is a NNuummbbeerr. Properties of the DDOOMMIImmpplleemmeennttaattiioonnLLSS Constructor function: DDOOMMIImmpplleemmeennttaattiioonnLLSS..MMOODDEE__SSYYNNCCHHRROONNOOUUSS The value of the constant DDOOMMIImmpplleemmeennttaattiioonnLLSS..MMOODDEE__SSYYNNCCHHRROONNOOUUSS is 11. DDOOMMIImmpplleemmeennttaattiioonnLLSS..MMOODDEE__AASSYYNNCCHHRROONNOOUUSS The value of the constant DDOOMMIImmpplleemmeennttaattiioonnLLSS..MMOODDEE__AASSYYNNCCHHRROONNOOUUSS is 22. Objects that implement the DDOOMMIImmpplleemmeennttaattiioonnLLSS interface: Functions of objects that implement the DDOOMMIImmpplleemmeennttaattiioonnLLSS interface: ccrreeaatteeLLSSPPaarrsseerr((mmooddee,, sscchheemmaaTTyyppee)) This function returns an object that implements the LLSSPPaarrsseerr interface. The mmooddee parameter is a NNuummbbeerr. The sscchheemmaaTTyyppee parameter is a SSttrriinngg. This function can raise an object that implements the DDOOMMEExxcceeppttiioonn interface. ccrreeaatteeLLSSSSeerriiaalliizzeerr(()) This function returns an object that implements the LLSSSSeerriiaalliizzeerr interface. ccrreeaatteeLLSSIInnppuutt(()) This function returns an object that implements the LLSSIInnppuutt interface. ccrreeaatteeLLSSOOuuttppuutt(()) This function returns an object that implements the LLSSOOuuttppuutt interface. Properties of the LLSSPPaarrsseerr Constructor function: LLSSPPaarrsseerr..AACCTTIIOONN__AAPPPPEENNDD__AASS__CCHHIILLDDRREENN The value of the constant LLSSPPaarrsseerr..AACCTTIIOONN__AAPPPPEENNDD__AASS__CCHHIILLDDRREENN is 11. LLSSPPaarrsseerr..AACCTTIIOONN__RREEPPLLAACCEE__CCHHIILLDDRREENN The value of the constant LLSSPPaarrsseerr..AACCTTIIOONN__RREEPPLLAACCEE__CCHHIILLDDRREENN is 22. LLSSPPaarrsseerr..AACCTTIIOONN__IINNSSEERRTT__BBEEFFOORREE The value of the constant LLSSPPaarrsseerr..AACCTTIIOONN__IINNSSEERRTT__BBEEFFOORREE is 33. LLSSPPaarrsseerr..AACCTTIIOONN__IINNSSEERRTT__AAFFTTEERR The value of the constant LLSSPPaarrsseerr..AACCTTIIOONN__IINNSSEERRTT__AAFFTTEERR is 44. LLSSPPaarrsseerr..AACCTTIIOONN__RREEPPLLAACCEE The value of the constant LLSSPPaarrsseerr..AACCTTIIOONN__RREEPPLLAACCEE is 55. Objects that implement the LLSSPPaarrsseerr interface: Properties of objects that implement the LLSSPPaarrsseerr interface: ddoommCCoonnffiigg This read-only property is an object that implements the DDOOMMCCoonnffiigguurraattiioonn interface. ffiilltteerr This property is an object that implements the LLSSPPaarrsseerrFFiilltteerr interface. aassyynncc This read-only property is a BBoooolleeaann. bbuussyy This read-only property is a BBoooolleeaann. Functions of objects that implement the LLSSPPaarrsseerr interface: ppaarrssee((iinnppuutt)) This function returns an object that implements the DDooccuummeenntt interface. The iinnppuutt parameter is an object that implements the LLSSIInnppuutt interface. This function can raise an object that implements the DDOOMMEExxcceeppttiioonn interface or the LLSSEExxcceeppttiioonn interface. ppaarrsseeUURRII((uurrii)) This function returns an object that implements the DDooccuummeenntt interface. The uurrii parameter is a SSttrriinngg. This function can raise an object that implements the DDOOMMEExxcceeppttiioonn interface or the LLSSEExxcceeppttiioonn interface. ppaarrsseeWWiitthhCCoonntteexxtt((iinnppuutt,, ccoonntteexxttAArrgg,, aaccttiioonn)) This function returns an object that implements the NNooddee interface. The iinnppuutt parameter is an object that implements the LLSSIInnppuutt interface. The ccoonntteexxttAArrgg parameter is an object that implements the NNooddee interface. The aaccttiioonn parameter is a NNuummbbeerr. This function can raise an object that implements the DDOOMMEExxcceeppttiioonn interface or the LLSSEExxcceeppttiioonn interface. aabboorrtt(()) This function has no return value. Objects that implement the LLSSIInnppuutt interface: Properties of objects that implement the LLSSIInnppuutt interface: bbyytteeSSttrreeaamm This property is an object that implements the OObbjjeecctt interface. ssttrriinnggDDaattaa This property is a SSttrriinngg. ssyysstteemmIIdd This property is a SSttrriinngg. ppuubblliiccIIdd This property is a SSttrriinngg. bbaasseeUURRII This property is a SSttrriinngg. eennccooddiinngg This property is a SSttrriinngg. cceerrttiiffiieeddTTeexxtt This property is a BBoooolleeaann. LLSSRReessoouurrcceeRReessoollvveerr function: This function returns an object that implements the LLSSIInnppuutt interface. The first parameter is a SSttrriinngg. The second parameter is a SSttrriinngg. The third parameter is a SSttrriinngg. The fourth parameter is a SSttrriinngg. The fifth parameter is a SSttrriinngg. Properties of the LLSSPPaarrsseerrFFiilltteerr Constructor function: LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__AACCCCEEPPTT The value of the constant LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__AACCCCEEPPTT is 11. LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__RREEJJEECCTT The value of the constant LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__RREEJJEECCTT is 22. LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__SSKKIIPP The value of the constant LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__SSKKIIPP is 33. LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__IINNTTEERRRRUUPPTT The value of the constant LLSSPPaarrsseerrFFiilltteerr..FFIILLTTEERR__IINNTTEERRRRUUPPTT is 44. Objects that implement the LLSSPPaarrsseerrFFiilltteerr interface: Properties of objects that implement the LLSSPPaarrsseerrFFiilltteerr interface: wwhhaattTTooSShhooww This read-only property is a NNuummbbeerr. Functions of objects that implement the LLSSPPaarrsseerrFFiilltteerr interface: ssttaarrttEElleemmeenntt((eelleemmeennttAArrgg)) This function returns a NNuummbbeerr. The eelleemmeennttAArrgg parameter is an object that implements the EElleemmeenntt interface. aacccceeppttNNooddee((nnooddeeAArrgg)) This function returns a NNuummbbeerr. The nnooddeeAArrgg parameter is an object that implements the NNooddee interface. Objects that implement the LLSSPPrrooggrreessssEEvveenntt interface: Objects that implement the LLSSPPrrooggrreessssEEvveenntt interface have all properties and functions of the EEvveenntt interface as well as the properties and functions defined below. Properties of objects that implement the LLSSPPrrooggrreessssEEvveenntt interface: iinnppuutt This read-only property is an object that implements the LLSSIInnppuutt interface. ppoossiittiioonn This read-only property is a NNuummbbeerr. ttoottaallSSiizzee This read-only property is a NNuummbbeerr. Objects that implement the LLSSLLooaaddEEvveenntt interface: Objects that implement the LLSSLLooaaddEEvveenntt interface have all properties and functions of the EEvveenntt interface as well as the properties and functions defined below. Properties of objects that implement the LLSSLLooaaddEEvveenntt interface: nneewwDDooccuummeenntt This read-only property is an object that implements the DDooccuummeenntt interface. iinnppuutt This read-only property is an object that implements the LLSSIInnppuutt interface. Objects that implement the LLSSSSeerriiaalliizzeerr interface: Properties of objects that implement the LLSSSSeerriiaalliizzeerr interface: ddoommCCoonnffiigg This read-only property is an object that implements the DDOOMMCCoonnffiigguurraattiioonn interface. nneewwLLiinnee This property is a SSttrriinngg. ffiilltteerr This property is an object that implements the LLSSSSeerriiaalliizzeerrFFiilltteerr interface. Functions of objects that implement the LLSSSSeerriiaalliizzeerr interface: wwrriittee((nnooddeeAArrgg,, ddeessttiinnaattiioonn)) This function returns a BBoooolleeaann. The nnooddeeAArrgg parameter is an object that implements the NNooddee interface. The ddeessttiinnaattiioonn parameter is an object that implements the LLSSOOuuttppuutt interface. This function can raise an object that implements the LLSSEExxcceeppttiioonn interface. wwrriitteeTTooUURRII((nnooddeeAArrgg,, uurrii)) This function returns a BBoooolleeaann. The nnooddeeAArrgg parameter is an object that implements the NNooddee interface. The uurrii parameter is a SSttrriinngg. This function can raise an object that implements the LLSSEExxcceeppttiioonn interface. wwrriitteeTTooSSttrriinngg((nnooddeeAArrgg)) This function returns a SSttrriinngg. The nnooddeeAArrgg parameter is an object that implements the NNooddee interface. This function can raise an object that implements the DDOOMMEExxcceeppttiioonn interface or the LLSSEExxcceeppttiioonn interface. Objects that implement the LLSSOOuuttppuutt interface: Properties of objects that implement the LLSSOOuuttppuutt interface: bbyytteeSSttrreeaamm This property is an object that implements the OObbjjeecctt interface. ssyysstteemmIIdd This property is a SSttrriinngg. eennccooddiinngg This property is a SSttrriinngg. Objects that implement the LLSSSSeerriiaalliizzeerrFFiilltteerr interface: Objects that implement the LLSSSSeerriiaalliizzeerrFFiilltteerr interface have all properties and functions of the NNooddeeFFiilltteerr interface as well as the properties and functions defined below. Properties of objects that implement the LLSSSSeerriiaalliizzeerrFFiilltteerr interface: wwhhaattTTooSShhooww This read-only property is a NNuummbbeerr. 07 April 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 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!). Many thanks to Elliotte Rusty Harold, Andrew Clover, Anjana Manian, Christian Parpart, Mikko Honkala, and François Yergeau for their review and comments of this document. 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: Fred Drake, Mary Brady (NIST), Rick Rivello (NIST), Robert Clary (Netscape), with a special mention to Curt Arnold. ********** 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. 07 April 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. 1166--bbiitt uunniitt The base unit of a DOMString. This indicates that indexing on a DOMString occurs in units of 16 bits. This must not be misunderstood to mean that a DOMString can store arbitrary 16-bit units. A DOMString is a character string encoded in UTF-16; this means that the restrictions of UTF-16 as well as the other relevant restrictions on character strings must be maintained. A single character, for example in the form of a numeric character reference, may correspond to one or two 16-bit units. AAPPII An API is an Application Programming Interface, a set of functions or methods used to access some functionality. nnaammeessppaaccee wweellll--ffoorrmmeedd A node is a namespace well-formed XML node if it is a _w_e_l_l_-_f_o_r_m_e_d node, and follows the productions and namespace constraints. If [_X_M_L_ _1_._0] is used, the constraints are defined in [_X_M_L_ _N_a_m_e_s_p_a_c_e_s]. If [_X_M_L_ _1_._1] is used, the constraints are defined in [_X_M_L_ _N_a_m_e_s_p_a_c_e_s_ _1_._1]. 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. sscchheemmaa A schema defines a set of structural and value constraints applicable to XML documents. Schemas can be expressed in schema languages, such as DTD, XML Schema, etc. wweellll--ffoorrmmeedd A node is a well-formed XML node if its serialized form, without doing any transformation during its serialization, matches its respective production in [_X_M_L_ _1_._0] or [_X_M_L_ _1_._1] (depending on the XML version in use) with all well-formedness constraints related to that production, and if the entities which are referenced within the node are also well- formed. If namespaces for XML are in use, the node must also be _n_a_m_e_s_p_a_c_e _w_e_l_l_-_f_o_r_m_e_d. 07 April 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. [[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, 7 April 2004. This version of the Document Object Model Level 3 Core Recommendation is http://www.w3.org/ TR/2004/REC-DOM-Level-3-Core-20040407. 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. [[DDOOMM LLeevveell 22 TTrraavveerrssaall aanndd RRaannggee]] _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_ _T_r_a_v_e_r_s_a_l_ _a_n_d_ _R_a_n_g_e_ _S_p_e_c_i_f_i_c_a_t_i_o_n, J. Kesselman, J. Robie, M. Champion, P. Sharpe, V. Apparao, L. Wood, Editors. World Wide Web Consortium, 13 November 2000. This version of the Document Object Model Level 2 Traversal and Range Recommendation is http: //www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113. The _l_a_t_e_s_t _v_e_r_s_i_o_n_ _o_f_ _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_ _T_r_a_v_e_r_s_a_l_ _a_n_d_ _R_a_n_g_e is available at http://www.w3.org/TR/DOM-Level-2-Traversal-Range. [[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/. [[IIAANNAA--CCHHAARRSSEETTSS]] _O_f_f_i_c_i_a_l_ _N_a_m_e_s_ _f_o_r_ _C_h_a_r_a_c_t_e_r_ _S_e_t_s, K. Simonsen, et al., Editors. Internet Assigned Numbers Authority. Available at ftp://ftp.isi.edu/in-notes/iana/ assignments/character-sets. [[IISSOO//IIEECC 1100664466]] ISO/IEC 10646-2000 (E). Information technology - Universal Multiple-Octet Coded Character Set (UCS) - Part 1: Architecture and Basic Multilingual Plane, as, from time to time, amended, replaced by a new edition or expanded by the addition of new parts. [Geneva]: International Organization for Standardization, 2000. See also _I_n_t_e_r_n_a_t_i_o_n_a_l _O_r_g_a_n_i_z_a_t_i_o_n_ _f_o_r_ _S_t_a_n_d_a_r_d_i_z_a_t_i_o_n, available at http://www.iso.ch, for the latest version. [[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. [[IIEETTFF RRFFCC 22339966]] _U_n_i_f_o_r_m_ _R_e_s_o_u_r_c_e_ _I_d_e_n_t_i_f_i_e_r_s_ _(_U_R_I_)_:_ _G_e_n_e_r_i_c_ _S_y_n_t_a_x, T. Berners-Lee, R. Fielding, L. Masinter, Authors. Internet Engineering Task Force, August 1998. Available at http://www.ietf.org/rfc/rfc2396.txt. [[IIEETTFF RRFFCC 33002233]] _X_M_L_ _M_e_d_i_a_ _T_y_p_e_s, M. Murata, S. St.Laurent, and D. Kohn, Editors. Internet Engineering Task Force, January 2001. Available at http://www.ietf.org/ rfc/rfc3023.txt. [[SSAAXX]] _S_i_m_p_l_e_ _A_P_I_ _f_o_r_ _X_M_L, D. Megginson and D. Brownell, Maintainers. Available at http://www.saxproject.org/. [[UUnniiccooddee]] The Unicode Standard, Version 4, ISBN 0-321-18578-1, as updated from time to time by the publication of new versions. The Unicode Consortium, 2000. See also _V_e_r_s_i_o_n_s_ _o_f_ _t_h_e_ _U_n_i_c_o_d_e_ _S_t_a_n_d_a_r_d, available at http:// www.unicode.org/unicode/standard/versions, for latest version and additional information on versions of the standard and of the Unicode Character Database. [[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 11..11]] _X_M_L_ _1_._1, T. Bray, and al., Editors. World Wide Web Consortium, 4 February 2004. This version of the XML 1.1 Recommendation is http://www.w3.org/TR/ 2004/REC-xml11-20040204. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _X_M_L_ _1_._1 is available at http://www.w3.org/TR/xml11. [[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. [[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. [[XXMMLL NNaammeessppaacceess 11..11]] _N_a_m_e_s_p_a_c_e_s_ _i_n_ _X_M_L_ _1_._1, T. Bray, D. Hollander, A. Layman, and R. Tobin, Editors. World Wide Web Consortium, 4 February 2004. This version of the Namespaces in XML 1.1 Recommendation is http://www.w3.org/TR/2004/REC- xml-names11-20040204. 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_ _1_._1 is available at http://www.w3.org/TR/xml-names11/. ********** FF..22 IInnffoorrmmaattiivvee RReeffeerreenncceess ********** [[CCaannoonniiccaall XXMMLL]] _C_a_n_o_n_i_c_a_l_ _X_M_L_ _V_e_r_s_i_o_n_ _1_._0, J. Boyer, Editor. World Wide Web Consortium, 15 March 2001. This version of the Canonical XML Recommendation is http:/ /www.w3.org/TR/2001/REC-xml-c14n-20010315. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f _C_a_n_o_n_i_c_a_l_ _X_M_L is available at http://www.w3.org/TR/xml-c14n. [[DDOOMM LLeevveell 33 EEvveennttss]] _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_ _E_v_e_n_t_s_ _S_p_e_c_i_f_i_c_a_t_i_o_n, P. Le Hégaret, T. Pixley, Editors. World Wide Web Consortium, November 2003. This version of the Document Object Model Level 3 Events specification is http:// www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n _o_f_ _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_ _E_v_e_n_t_s is available at http:// www.w3.org/TR/DOM-Level-3-Events. [[JJAAXXPP]] _J_a_v_a_ _A_P_I_ _f_o_r_ _X_M_L_ _P_r_o_c_e_s_s_i_n_g_ _(_J_A_X_P_). Sun Microsystems. Available at http:/ /java.sun.com/xml/jaxp/. [[IIEETTFF RRFFCC 22661166]] _H_y_p_e_r_t_e_x_t_ _T_r_a_n_s_f_e_r_ _P_r_o_t_o_c_o_l_ _-_-_ _H_T_T_P_/_1_._1, R. Fielding, et al., Authors. Internet Engineering Task Force, June 1999. Available at http:// www.ietf.org/rfc/rfc2616.txt. [[XXMMLL SScchheemmaa PPaarrtt 11]] _X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1_:_ _S_t_r_u_c_t_u_r_e_s, H. Thompson, D. Beech, M. Maloney, and N. Mendelsohn, Editors. World Wide Web Consortium, 2 May 2001. This version of the XML Part 1 Recommendation is http://www.w3.org/TR/2001/REC- xmlschema-1-20010502. The _l_a_t_e_s_t_ _v_e_r_s_i_o_n_ _o_f_ _X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1 is available at http://www.w3.org/TR/xmlschema-1. 07 April 2004 ************ IInnddeexx ************ _"_i_g_n_o_r_e_-_u_n_k_n_o_w_n_- _c_h_a_r_a_c_t_e_r_- _d_e_n_o_r_m_a_l_i_z_a_t_i_o_n_s_" _"_c_a_n_o_n_i_c_a_l_-_f_o_r_m_" _"_c_h_a_r_s_e_t_-_o_v_e_r_r_i_d_e_s_-_x_m_l_- _"_d_i_s_a_l_l_o_w_-_d_o_c_t_y_p_e_" _1, _2 _e_n_c_o_d_i_n_g_" _"_d_i_s_c_a_r_d_-_d_e_f_a_u_l_t_-_c_o_n_t_e_n_t_" _"_f_o_r_m_a_t_-_p_r_e_t_t_y_-_p_r_i_n_t_" _1, _2 _"_i_g_n_o_r_e_-_u_n_k_n_o_w_n_-_c_h_a_r_a_c_t_e_r_- _1, _2, _3, _4 _d_e_n_o_r_m_a_l_i_z_a_t_i_o_n_s_" _1, _2 _"_i_n_f_o_s_e_t_" _"_n_a_m_e_s_p_a_c_e_s_" _"_n_o_r_m_a_l_i_z_e_-_c_h_a_r_a_c_t_e_r_s_" _"_r_e_s_o_u_r_c_e_-_r_e_s_o_l_v_e_r_" _"_s_u_p_p_o_r_t_e_d_-_m_e_d_i_a_-_t_y_p_e_s_- _"_v_a_l_i_d_a_t_e_" _o_n_l_y_" _1, _2 _"_v_a_l_i_d_a_t_e_-_i_f_-_s_c_h_e_m_a_" _"_w_e_l_l_-_f_o_r_m_e_d_" _"_x_m_l_-_d_e_c_l_a_r_a_t_i_o_n_" _1, _2, _3 _1_6_-_b_i_t_ _u_n_i_t _1, _2, _3, _4, _5, _6 _[_a_t_t_r_i_b_u_t_e_s_] _a_b_o_r_t _a_c_c_e_p_t_N_o_d_e _A_C_T_I_O_N___A_P_P_E_N_D___A_S___C_H_I_L_D_R_E_N _A_C_T_I_O_N___I_N_S_E_R_T___A_F_T_E_R _A_C_T_I_O_N___I_N_S_E_R_T___B_E_F_O_R_E _A_C_T_I_O_N___R_E_P_L_A_C_E _A_C_T_I_O_N___R_E_P_L_A_C_E___C_H_I_L_D_R_E_N _A_P_I _1, _2 _a_s_y_n_c _b_a_s_e_U_R_I _b_u_s_y _b_y_t_e_S_t_r_e_a_m _1, _2 _C_a_n_o_n_i_c_a_l_ _X_M_L _1, _2 _c_e_r_t_i_f_i_e_d_T_e_x_t _c_h_a_r_a_c_t_e_r_S_t_r_e_a_m _1, _2 _c_r_e_a_t_e_L_S_I_n_p_u_t _c_r_e_a_t_e_L_S_O_u_t_p_u_t _c_r_e_a_t_e_L_S_P_a_r_s_e_r _c_r_e_a_t_e_L_S_S_e_r_i_a_l_i_z_e_r _D_O_M_ _L_e_v_e_l_ _2_ _C_o_r_e _1, _2, _3, _D_O_M_ _L_e_v_e_l_ _2_ _T_r_a_v_e_r_s_a_l_ _a_n_d _D_O_M_ _L_e_v_e_l_ _3_ _C_o_r_e _1, _2, _3, _4 _R_a_n_g_e _1, _2, _3, _4 _4, _5, _6, _7, _8 _D_O_M_ _L_e_v_e_l_ _3_ _E_v_e_n_t_s _1, _2 _d_o_m_C_o_n_f_i_g _1, _2 _D_O_M_I_m_p_l_e_m_e_n_t_a_t_i_o_n_L_S _E_C_M_A_S_c_r_i_p_t _e_n_c_o_d_i_n_g _1, _2 _f_i_l_t_e_r _1, _2 _F_I_L_T_E_R___A_C_C_E_P_T _F_I_L_T_E_R___I_N_T_E_R_R_U_P_T _F_I_L_T_E_R___R_E_J_E_C_T _F_I_L_T_E_R___S_K_I_P _I_A_N_A_-_C_H_A_R_S_E_T_S _1, _2 _I_E_T_F_ _R_F_C_ _2_3_9_6 _1, _2, _3, _4, _I_E_T_F_ _R_F_C_ _2_6_1_6 _1, _2, _3 _5, _6 _I_E_T_F_ _R_F_C_ _3_0_2_3 _1, _2 _i_n_p_u_t _1, _2 _I_S_O_/_I_E_C_ _1_0_6_4_6 _1, _2, _3, _4 _J_a_v_a _J_A_X_P _1, _2 _l_o_a_d _L_S_E_x_c_e_p_t_i_o_n _L_S_I_n_p_u_t _L_S_I_n_p_u_t_S_t_r_e_a_m _L_S_L_o_a_d_E_v_e_n_t _L_S_O_u_t_p_u_t _L_S_O_u_t_p_u_t_S_t_r_e_a_m _L_S_P_a_r_s_e_r _L_S_P_a_r_s_e_r_F_i_l_t_e_r _L_S_P_r_o_g_r_e_s_s_E_v_e_n_t _L_S_R_e_a_d_e_r _L_S_R_e_s_o_u_r_c_e_R_e_s_o_l_v_e_r _L_S_S_e_r_i_a_l_i_z_e_r _L_S_S_e_r_i_a_l_i_z_e_r_F_i_l_t_e_r _L_S_W_r_i_t_e_r _M_O_D_E___A_S_Y_N_C_H_R_O_N_O_U_S _M_O_D_E___S_Y_N_C_H_R_O_N_O_U_S _n_a_m_e_s_p_a_c_e_ _w_e_l_l_-_f_o_r_m_e_d _n_e_w_D_o_c_u_m_e_n_t _n_e_w_L_i_n_e _O_M_G_ _I_D_L _p_a_r_s_e _P_A_R_S_E___E_R_R _p_a_r_s_e_U_R_I _p_a_r_s_e_W_i_t_h_C_o_n_t_e_x_t _p_o_s_i_t_i_o_n _p_r_o_g_r_e_s_s _p_u_b_l_i_c_I_d _r_e_a_d_ _o_n_l_y_ _n_o_d_e _1, _2 _r_e_s_o_l_v_e_R_e_s_o_u_r_c_e _S_A_X _1, _2, _3 _s_c_h_e_m_a _1, _2 _S_E_R_I_A_L_I_Z_E___E_R_R _s_t_a_r_t_E_l_e_m_e_n_t _s_t_r_i_n_g_D_a_t_a _s_y_s_t_e_m_I_d _1, _2 _t_o_t_a_l_S_i_z_e _U_n_i_c_o_d_e _1, _2, _3, _4 _w_e_l_l_-_f_o_r_m_e_d _1, _2, _3, _4 _w_h_a_t_T_o_S_h_o_w _1, _2 _w_r_i_t_e _w_r_i_t_e_T_o_S_t_r_i_n_g _w_r_i_t_e_T_o_U_R_I _X_M_L_ _1_._0 _1, _2, _3, _4, _5, _6, _X_M_L_ _1_._1 _1, _2, _3, _4, _5, _6, _X_M_L_ _I_n_f_o_r_m_a_t_i_o_n_ _S_e_t _1, _2 _7, _8, _9, _1_0 _7, _8 _X_M_L_ _N_a_m_e_s_p_a_c_e_s _1, _2, _3 _X_M_L_ _N_a_m_e_s_p_a_c_e_s_ _1_._1 _1, _2, _3 _X_M_L_ _S_c_h_e_m_a_ _P_a_r_t_ _1 _1, _2, _3