Commit 149fc662 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-20 21:22:39 by cvscast] Empty log message

Original author: cvscast
Date: 2003-05-20 21:22:39+00:00
parent 413e7dc9
...@@ -12,7 +12,7 @@ open Encodings ...@@ -12,7 +12,7 @@ open Encodings
let is_ws s = let is_ws s =
let rec check i = let rec check i =
(i < 0) || (i < 0) ||
(match s.[i] with (match (String.unsafe_get s i) with
| ' ' | '\t' | '\n' | '\r' -> check (i - 1) | ' ' | '\t' | '\n' | '\r' -> check (i - 1)
| _ -> false) in | _ -> false) in
check (String.length s - 1) check (String.length s - 1)
...@@ -70,17 +70,20 @@ let load_xml_aux s = ...@@ -70,17 +70,20 @@ let load_xml_aux s =
match !curr with match !curr with
| E_start_tag (name,att,_) -> | E_start_tag (name,att,_) ->
get (); get ();
dump_txt (fun () -> let data = Buffer.contents txt in
Buffer.clear txt;
let e1 = parse_elt name att in let e1 = parse_elt name att in
let rest = parse_seq () in let rest = parse_seq () in
Pair (e1, rest) let q = Pair (e1,rest) in
) if (is_ws data) then q else string data q
| E_char_data data -> | E_char_data data ->
get(); get();
Buffer.add_string txt data; Buffer.add_string txt data;
parse_seq () parse_seq ()
| E_end_tag (_,_) -> | E_end_tag (_,_) ->
dump_txt (fun () -> nil) let data = Buffer.contents txt in
Buffer.clear txt;
if (is_ws data) then nil else string data nil
| _ -> failwith "Expect start_tag, char_data, or end_tag" | _ -> failwith "Expect start_tag, char_data, or end_tag"
and parse_doc () = and parse_doc () =
......
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