Commit 5a86586c authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-02-17 14:46:44 by afrisch] Rework schema

Original author: afrisch
Date: 2005-02-17 14:46:44+00:00
parent d597e4ae
This diff is collapsed.
......@@ -75,6 +75,11 @@ let _may_elem e (n: node) =
try Some (Pxp_document.find_element e n) with Not_found -> None
let _elems e n = Pxp_document.find_all_elements e n
let _filter_elems p n =
Pxp_document.find_all (fun n -> match n#node_type with
| Pxp_document.T_element s -> List.mem s p
| _ -> false) n
let _line n = match n#position with (_,l,_) -> l
......@@ -86,6 +91,16 @@ let _iter_elems n f = n#iter_nodes
| Pxp_document.T_element s -> f n s
| _ -> ()
)
let _fold_elems n x f =
let x = ref x in
n#iter_nodes
(fun n ->
match n#node_type with
| Pxp_document.T_element s -> x := f !x n s
| _ -> ()
);
!x
let _tag n =
match n#node_type with
......
......@@ -11,11 +11,13 @@ val _is_attr: string -> node -> string -> bool
val _attr: string -> node -> Utf8.t
val _may_elem: string -> node -> node option
val _elems: string -> node -> node list
val _filter_elems: string list -> node -> node list
val _line: node -> int
val _iter_nodes: node -> (node -> unit) -> unit
val _iter_elems: node -> (node -> string -> unit) -> unit
val _fold_elems: node -> 'a -> ('a -> node -> string -> 'a) -> 'a
val _tag: node -> string
val _has_tag: node -> (string -> bool) -> bool
val _namespaces: node -> (string * string) list
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment