XMLInternalDocument-class        package:XML        R Documentation

_C_l_a_s_s _t_o _r_e_p_r_e_s_e_n_t _r_e_f_e_r_e_n_c_e _t_o _C-_l_e_v_e_l _d_a_t_a _s_t_r_u_c_t_u_r_e _f_o_r _a_n _X_M_L
_d_o_c_u_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     This class is used to provide a handle/reference to a C-level data
     structure that contains the information from parsing  parsing XML
     content. This leaves the nodes in the DOM or tree as C-level nodes
     rather than converting them to explicit R 'XMLNode' objects.  One
     can then operate on this tree in much the same way as one can the
     'XMLNode' representations, but we a) avoid copying the nodes to R,
     and b) can navigate the tree both down and up using 'xmlParent'
     giving greater flexibility. Most importantly, one can use an
     'XMLInternalDocument' class object with an XPath expression to
     easily and relatively efficiently find nodes within a document
     that satisfy some criterion. See 'getNodeSet'.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects of this type are created via 'xmlTreeParse' and  
     'htmlTreeParse' with the argument  'useInternalNodes' given as
     'TRUE'.

_E_x_t_e_n_d_s:

     Class 'oldClass', directly.

_M_e_t_h_o_d_s:

     There are methods to serialize (dump) a document to a file or as a
     string, and to coerce it to a node by finding the top-level node
     of the document. There are functions to search the document for
     nodes specified by an XPath expression.

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.w3.org/TR/xpath>{XPath}

_S_e_e _A_l_s_o:

     'xmlTreeParse' 'htmlTreeParse' 'getNodeSet'

_E_x_a_m_p_l_e_s:

      f = system.file("exampleData", "mtcars.xml", package="XML")
      doc = xmlTreeParse(f, useInternalNodes = TRUE)
      getNodeSet(doc, "//variables[@count]")
      getNodeSet(doc, "//record")

      getNodeSet(doc, "//record[@id='Mazda RX4']")

      # free(doc)

