module Webdav_xml:Parsing and printing XML for WebDAV messagessig
..end
typeproperty =
'a Pxp_document.extension Pxp_document.node as 'a
`Enc_utf8
).
The root node of the property tree must be an XML element. Namespace processing is done as in PXP, i.e. namespace prefixes are normalized. For checking that a property has a certain name, one should either:
(localname, namespace_uri)
as compound nameT_element
)p
is a property
):
p#localname = "notes" &&
p#namespace_uri = "http://www.w3.org/1999/xhtml"
Example for the second method:
let m = namespace_manager()
m # add_namespace "h" "http://www.w3.org/1999/xhtml";
let r = parse_multistatus_body ~namespace_manager:m ...
let p = List.hd ((List.hd r) # propstat) (* p : property *)
match p # node_type with
| T_element "h:notes" -> true
| _ -> false
The values of the properties are also normalized in this way, and
must be handled accordingly. There is no guarantee that the prefixes
are presented in the same way as they come from the server.
val create_propname : ?namespace_manager:Pxp_dtd.namespace_manager -> string -> property
The passed string must have the form "prefix:localname", and the prefix must be declared in the namespace manager. The default namespace manager only defines the prefix "DAV".
Example:
create_propname "DAV:creationdate"
val propname_creationdate : property
val propname_displayname : property
val propname_getcontentlanguage : property
val propname_getcontentlength : property
val propname_getcontenttype : property
val propname_getetag : property
val propname_getlastmodified : property
val propname_resourcetype : property
val decode_string : property -> string
val decode_creationdate : property -> float
val decode_displayname : property -> string
val decode_getcontentlanguage : property -> string
val decode_getcontentlength : property -> int64
val decode_getcontenttype : property -> string * (string * string) list
val decode_getetag : property -> Nethttp.etag
val decode_getlastmodified : property -> float
val decode_resourcetype : property -> bool
val encode_string : string -> string -> property
encode_string name value
: Creates a property with name
that
includes the value
as stringval encode_creationdate : float -> property
val encode_displayname : string -> property
val encode_getcontentlanguage : string -> property
val encode_getcontentlength : int64 -> property
val encode_getcontenttype : string * (string * string) list -> property
val encode_getetag : Nethttp.etag -> property
val encode_getlastmodified : float -> property
val encode_resourcetype : bool -> property
typeprepost_code =
'a Pxp_document.extension Pxp_document.node as 'a
property
.typeknown_prepost_code =
[ `Cannot_modify_protected_property
| `No_external_entities
| `Preserved_live_properties
| `Propfind_finite_depth ]
val create_prepost_code : ?namespace_manager:Pxp_dtd.namespace_manager ->
string -> prepost_code
The passed string must have the form "prefix:localname", and the prefix must be declared in the namespace manager. The default namespace manager only defines the prefix "DAV".
Example:
create_propname "DAV:no-external-entities"
val parse_prepost_code : prepost_code -> known_prepost_code
Not_found
if unknownval emit_prepost_code : known_prepost_code -> prepost_code
val namespace_manager : unit -> Pxp_dtd.namespace_manager
"DAV"
: This is the prefix for WebDAV requestsval check_dtd : Pxp_dtd.dtd -> unit
val dtd : unit -> Pxp_dtd.dtd
val url_path : ?strip_prefix:string -> string -> string
It is checked, however, whether the resulting string is UTF-8.
propstat
class type propstat_t =object
..end
Webdav_client_methods.propstat_t
val create_propstat : properties:property list ->
status:Webdav_http.webdav_status ->
?status_code:int ->
?status_text:string ->
?status_protocol:string ->
?error:prepost_code list ->
?responsedescription:string -> unit -> propstat_t
propstat_t
.
status_code
method will return the code corresponding to the
status
argument unless the status_code
argument overrides itstatus_text
method will return the text corresponding to the
status
argument unless the status_text
argument overrides itstatus_protocol
method will return Webdav_http.webdav_proto
unless the status_protocol
argument overrides itresponse
class type response_t =object
..end
Webdav_client_methods.response_t
val create_status_response : href:string list ->
status:Webdav_http.webdav_status ->
?status_code:int ->
?status_text:string ->
?status_protocol:string ->
?error:prepost_code list ->
?responsedescription:string ->
?location:string -> ?strip_prefix:string -> unit -> response_t
response_t
that includes a status
element,
but no propstat
elements. In the returned object, the propstat
method returns the empty list.
The href
list must contain at least one element.
status
, status_code
, status_text
, and status_protocol
are
handled as in Webdav_xml.create_propstat
.
If strip_prefix
is passed, this prefix is removed from all paths
that are returned via the paths
method.
val create_propstat_response : href:string ->
propstat:propstat_t list ->
?error:prepost_code list ->
?responsedescription:string ->
?location:string -> ?strip_prefix:string -> unit -> response_t
response_t
that includes propstat
elements but
no status
element. In the returned object, the status
method
returns `Ok
.
The propstat
list must contain at least one element.
If strip_prefix
is passed, this prefix is removed from the single path
returned via the paths
method.
multistatus
class type multistatus_t =object
..end
val create_multistatus : responses:response_t list ->
?responsedescription:string -> unit -> multistatus_t
val parse_multistatus_body : ?strip_prefix:string ->
?namespace_manager:Pxp_dtd.namespace_manager ->
content_type:string -> Netchannels.in_obj_channel -> multistatus_t
`Multi_status
response. It is required to
pass the content_type
from the HTTP header (for extracting the
character encoding). Optionally, one can pass an initialized namespace
manager. This is useful to enforce that certain XML prefixes are
used for the expected namespaces. It is expected that the prefix
"DAV" is bound to the namespace URI "DAV:". There is no guarantee
that the display prefixes are preserved.
strip_prefix
: If passed, this path prefix is removed from the
paths returned by the paths
method. Also, it is considered an
error if a path is found not within this prefix.
val write_multistatus_body : ?namespace_manager:Pxp_dtd.namespace_manager ->
Netchannels.out_obj_channel -> multistatus_t -> unit
PROPFIND
typepropfind_request =
[ `Allprop of property list
| `Prop of property list
| `Propname ]
val parse_propfind_request : ?namespace_manager:Pxp_dtd.namespace_manager ->
content_type:string ->
Netchannels.in_obj_channel -> propfind_request
propfind
request body. See also
Webdav_xml.parse_multistatus_body
for the meaning of
namespace_manager
and content_type
.val write_propfind_request : ?namespace_manager:Pxp_dtd.namespace_manager ->
Netchannels.out_obj_channel -> propfind_request -> unit
The passed properties (i.e. XML trees) can use any DTD and any
namespace manager. In the generated XML text namespace prefixes are
preserved (the prefix as returned by the display_prefix
method of
the property nodes).
PROPPATCH
typeproppatch_instruction =
[ `Remove of property list | `Set of property list ]
typeproppatch_request =
proppatch_instruction list
val parse_proppatch_request : ?namespace_manager:Pxp_dtd.namespace_manager ->
content_type:string ->
Netchannels.in_obj_channel -> proppatch_request
proppatch
request body. See also
Webdav_xml.parse_multistatus_body
for the meaning of
namespace_manager
and content_type
.val write_proppatch_request : ?namespace_manager:Pxp_dtd.namespace_manager ->
Netchannels.out_obj_channel -> proppatch_request -> unit
The passed properties (i.e. XML trees) can use any DTD and any
namespace manager. In the generated XML text namespace prefixes are
preserved (the prefix as returned by the display_prefix
method of
the property nodes).