1 (* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
3 * This file is part of mlminidom, the Ocaml binding for minidom.
5 * mlminidom is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * mlminidom is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with mlminidom; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * For details, send a mail to the author.
28 external string_of_mDOMString : mDOMString -> string = "ml_string_of_mDOMString"
29 external mDOMString_of_string : string -> mDOMString = "ml_mDOMString_of_string"
30 external mDOMString_eq : string -> string -> bool = "ml_mDOMString_eq"
32 external doc_load : string -> mDOMDoc = "ml_doc_load"
33 external doc_new : mDOMString -> mDOMDoc = "ml_doc_new"
34 external doc_get_root_node : mDOMDoc -> mDOMNode = "ml_doc_get_root_node"
36 external doc_add_entity : doc:mDOMDoc -> name:mDOMString -> content:mDOMString -> mDOMEntity = "ml_doc_add_entity"
37 external doc_get_entity : doc:mDOMDoc -> name:mDOMString -> mDOMEntity option = "ml_doc_get_entity"
38 external doc_get_predefined_entity : doc:mDOMDoc -> name:mDOMString -> mDOMEntity option = "ml_doc_get_predefined_entity"
39 external entity_get_content : mDOMEntity -> mDOMString = "ml_entity_get_content"
41 external node_is_text : mDOMNode -> bool = "ml_node_is_text"
42 external node_is_element : mDOMNode -> bool = "ml_node_is_element"
43 external node_is_blank : mDOMNode -> bool = "ml_node_is_blank"
44 external node_is_entity_ref : mDOMNode -> bool = "ml_node_is_entity_ref"
45 external node_get_type : mDOMNode -> int = "ml_node_get_type"
46 external node_get_name : mDOMNode -> mDOMString option = "ml_node_get_name"
47 external node_get_ns_uri : mDOMNode -> mDOMString option = "ml_node_get_ns_uri"
48 external node_get_attribute : node:mDOMNode -> name:mDOMString -> mDOMString option = "ml_node_get_attribute"
49 external node_get_attribute_ns : node:mDOMNode -> name:mDOMString -> ns_uri:mDOMString -> mDOMString option = "ml_node_get_attribute_ns"
50 external node_has_attribute : node:mDOMNode -> name:mDOMString -> bool = "ml_node_has_attribute"
51 external node_has_attribute_ns : node:mDOMNode -> name:mDOMString -> ns_uri:mDOMString -> bool = "ml_node_has_attribute_ns"
52 external node_get_content : mDOMNode -> mDOMString option = "ml_node_get_content"
53 external node_get_parent : mDOMNode -> mDOMNode option = "ml_node_get_parent"
54 external node_get_prev_sibling : mDOMNode -> mDOMNode option = "ml_node_get_prev_sibling"
55 external node_get_next_sibling : mDOMNode -> mDOMNode option = "ml_node_get_next_sibling"
56 external node_get_first_child : mDOMNode -> mDOMNode option = "ml_node_get_first_child"
57 external node_get_first_attribute : mDOMNode -> mDOMAttr option = "ml_node_get_first_attribute"
58 external node_is_first : mDOMNode -> bool = "ml_node_is_first"
59 external node_is_last : mDOMNode -> bool = "ml_node_is_last"
61 external attr_get_name : mDOMAttr -> mDOMString option = "ml_attr_get_name"
62 external attr_get_ns_uri : mDOMAttr -> mDOMString option = "ml_attr_get_ns_uri"
63 external attr_get_value : mDOMAttr -> mDOMString option = "ml_attr_get_value"
64 external attr_get_prev_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_prev_sibling"
65 external attr_get_next_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_next_sibling"
66 external attr_get_parent : mDOMAttr -> mDOMNode option = "ml_attr_get_parent"
68 let rec node_list_of_node_first =
70 | Some node -> node :: (node_list_of_node_first (node_get_next_sibling node))
72 let rec attr_list_of_attr_first =
74 | Some attr -> attr :: (attr_list_of_attr_first (attr_get_next_sibling attr))
76 let node_get_children node =
77 (node_list_of_node_first (node_get_first_child node))
79 let node_get_attributes node =
80 (attr_list_of_attr_first (node_get_first_attribute node))