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 -> propertyThe 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 : propertyval propname_displayname : propertyval propname_getcontentlanguage : propertyval propname_getcontentlength : propertyval propname_getcontenttype : propertyval propname_getetag : propertyval propname_getlastmodified : propertyval propname_resourcetype : propertyval decode_string : property -> stringval decode_creationdate : property -> floatval decode_displayname : property -> stringval decode_getcontentlanguage : property -> stringval decode_getcontentlength : property -> int64val decode_getcontenttype : property -> string * (string * string) listval decode_getetag : property -> Nethttp.etagval decode_getlastmodified : property -> floatval decode_resourcetype : property -> boolval encode_string : string -> string -> propertyencode_string name value: Creates a property with name that
includes the value as stringval encode_creationdate : float -> propertyval encode_displayname : string -> propertyval encode_getcontentlanguage : string -> propertyval encode_getcontentlength : int64 -> propertyval encode_getcontenttype : string * (string * string) list -> propertyval encode_getetag : Nethttp.etag -> propertyval encode_getlastmodified : float -> propertyval encode_resourcetype : bool -> propertytypeprepost_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_codeThe 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_codeNot_found if unknownval emit_prepost_code : known_prepost_code -> prepost_codeval namespace_manager : unit -> Pxp_dtd.namespace_manager"DAV": This is the prefix for WebDAV requestsval check_dtd : Pxp_dtd.dtd -> unitval dtd : unit -> Pxp_dtd.dtdval url_path : ?strip_prefix:string -> string -> string
It is checked, however, whether the resulting string is UTF-8.
propstatclass 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_tpropstat_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 itresponseclass 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_tresponse_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_tresponse_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.
multistatusclass type multistatus_t =object..end
val create_multistatus : responses:response_t list ->
?responsedescription:string -> unit -> multistatus_tval 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 -> unitPROPFINDtypepropfind_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_requestpropfind 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).
PROPPATCHtypeproppatch_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_requestproppatch 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).