cpdf

High-level PDF tools based on CamlPDF
Module type Cpdfxmlm . S

Basic types and values

type string
type encoding = [
| `UTF_8
| `UTF_16
| `UTF_16BE
| `UTF_16LE
| `ISO_8859_1
| `US_ASCII
]
type dtd = string option
type name = string * string
type attribute = name * string
type tag = name * attribute list
type signal = [
| `Dtd of dtd
| `El_start of tag
| `El_end
| `Data of string
]
val ns_xml : string
val ns_xmlns : string

Input

type pos = int * int
type error = [
| `Max_buffer_size
| `Unexpected_eoi
| `Malformed_char_stream
| `Unknown_encoding of string
| `Unknown_entity_ref of string
| `Unknown_ns_prefix of string
| `Illegal_char_ref of string
| `Illegal_char_seq of string
| `Expected_char_seqs of string list * string
| `Expected_root_element
]
exception Error of pos * error
val error_message : error -> string
type source = [
| `Channel of in_channel
| `String of int * std_string
| `Fun of unit -> int
]
type input
val make_input : ?enc:encoding option -> ?strip:bool -> ?ns:( string -> string option ) -> ?entity:( string -> string option ) -> source -> input
val input : input -> signal
val input_tree : el:( tag -> 'a list -> 'a ) -> data:( string -> 'a ) -> input -> 'a
val input_doc_tree : el:( tag -> 'a list -> 'a ) -> data:( string -> 'a ) -> input -> dtd * 'a
val peek : input -> signal
val eoi : input -> bool
val pos : input -> pos

Output

type 'a frag = [
| `El of tag * 'a list
| `Data of string
]
type dest = [
| `Channel of out_channel
| `Buffer of std_buffer
| `Fun of int -> unit
]
type output
val make_output : ?decl:bool -> ?nl:bool -> ?indent:int option -> ?ns_prefix:( string -> string option ) -> dest -> output
val output_depth : output -> int
val output : output -> signal -> unit
val output_tree : ( 'a -> 'a frag ) -> output -> 'a -> unit
val output_doc_tree : ( 'a -> 'a frag ) -> output -> (dtd * 'a) -> unit