2 * ----------------------------------------------------------------------
6 (* NOTE: Currently, this module is *identical* to Pxp_lex_aux_utf8 *)
11 let get_name_end s k =
12 (* Get the index of the end+1 of the name beginning at position k *)
13 let l = String.length s in
17 | ('\009'|'\010'|'\013'|'\032') -> j
25 let l = String.length s in
29 (' '|'\t'|'\r'|'\n') -> find (j+1)
36 let scan_pi pi xml_scanner =
37 let s = String.sub pi 2 (String.length pi - 4) in
38 (* the PI without the leading "<?" and the trailing "?>" *)
39 let xml_lexbuf = Lexing.from_string (s ^ " ") in
40 (* Add space because the lexer expects whitespace after every
41 * clause; by adding a space there is always whitespace at the
45 (* The first word of a PI must be a name: Extract it. *)
48 match xml_scanner xml_lexbuf with
50 let ltok = String.length (Lexing.lexeme xml_lexbuf) in
51 if String.length n = ltok then
52 (* No whitespace after the name *)
53 raise (WF_error ("Bad processing instruction"));
55 | _ -> raise (WF_error ("Bad processing instruction"))
58 (* Note: s_len is the length of s_name + the whitespace following s_name *)
62 (* It is a <?xml ...?> PI: Get the other tokens *)
64 let t = xml_scanner xml_lexbuf in
65 (* prerr_endline (string_of_int (Lexing.lexeme_end xml_lexbuf)); *)
74 let len_param = String.length s - s_len in
75 (* It is possible that len_param = -1 *)
76 if len_param >= 1 then
77 PI(s_name, String.sub s s_len len_param)
83 (* ======================================================================
87 * Revision 1.1 2000/11/17 09:57:32 lpadovan
90 * Revision 1.2 2000/05/29 23:53:12 gerd
91 * Updated because Markup_* modules have been renamed to Pxp_*.
93 * Revision 1.1 2000/05/20 20:33:25 gerd