1 exception IllFormedXml of int;;
3 (* Utility functions that transform a Pxp attribute into something useful *)
6 let module T = Pxp_types in
9 | _ -> raise (IllFormedXml 0)
12 let module D = Pxp_document in
13 let module T = Theory in
14 let rec get_theory_elem n =
15 let ntype = n # node_type in
17 D.T_element "THEOREM" ->
18 let uri = string_of_attr (n # attribute "uri") in
20 | D.T_element "DEFINITION" ->
21 let uri = string_of_attr (n # attribute "uri") in
23 | D.T_element "AXIOM" ->
24 let uri = string_of_attr (n # attribute "uri") in
26 | D.T_element "VARIABLE" ->
27 let uri = string_of_attr (n # attribute "uri") in
29 | D.T_element "SECTION" ->
30 let uri = string_of_attr (n # attribute "uri")
31 and subtheory = List.map get_theory_elem (n # sub_nodes) in
32 T.Section (uri, subtheory)
33 | D.T_element _ | D.T_data | _ ->
34 raise (IllFormedXml 1)
36 match n # node_type with
37 D.T_element "Theory" ->
38 let uri = string_of_attr (n # attribute "uri") in
39 (uri, List.map get_theory_elem (n # sub_nodes))
40 | _ -> raise (IllFormedXml 2)