From 4e791ee754d14ccd6d73efe04c6f65b6d2f61644 Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Mon, 11 Nov 2024 15:33:48 +0100 Subject: [PATCH] Formally define XML elements with RELAX NG; validate XML samples (#52) --- content.mkd | 51 ++------ ...sample-propfind-multistatus-with-vapid.xml | 13 ++ xml/sample-propfind-multistatus.xml | 17 +++ xml/sample-registration.xml | 1 - xml/sample-web-push-subscription.xml | 3 + xml/validate-samples.rng | 31 +++++ xml/validate.sh | 3 +- xml/webdav-push.rng | 114 ++++++++++++++++++ xml/webdav-push.xsd | 46 ------- 9 files changed, 191 insertions(+), 88 deletions(-) create mode 100644 xml/sample-propfind-multistatus-with-vapid.xml create mode 100644 xml/sample-propfind-multistatus.xml create mode 100644 xml/sample-web-push-subscription.xml create mode 100644 xml/validate-samples.rng create mode 100644 xml/webdav-push.rng delete mode 100644 xml/webdav-push.xsd diff --git a/content.mkd b/content.mkd index 6d5f998..3aec24e 100644 --- a/content.mkd +++ b/content.mkd @@ -143,20 +143,7 @@ PROPFIND https://example.com/webdav/collection/ HTTP/1.1 207 Multi-Status - - - /webdav/collection/ - - - - - ... - - - O7M1nQ7cKkKTKsoS_j6Z3w - - - +{::include xml/sample-propfind-multistatus.xml} ~~~ In this case, the requested collection supports WebDAV-Push in general (because it has a push topic). Two push transports can be used: @@ -170,13 +157,11 @@ In this case, the requested collection supports WebDAV-Push in general (because Name: `transports` Namespace: `DAV:Push` Purpose: Indicates which push transports are supported by the server. -Definition: ` {::include xml/sample-registration.xml} HTTP/1.1 201 Created @@ -294,18 +280,14 @@ Description: This element specifies details about a subscription that shall be notified when the collection is updated. Besides the optional expiration, there must be exactly one `subscription` element that defines the subscription details. -Definition: `Sun, 06 Nov 1994 08:49:37 GMT` @@ -357,7 +339,6 @@ A server MAY use some logic like remembering the last successful delivery plus s Name: `push-message` Namespace: `DAV:Push` Purpose: Contains information of a push message / notification. -Definition: `` element, for instance in a list of supported transports. -Definition: `` Name: `web-push-subscription` Purpose: Public information of a Web Push subscription that is shared with the WebDAV-Push server (Web Push application server). Description: Used to specify a Web Push subscription in the context of a `` element, for instance to register a subscription. -Definition: ` - https://push.example.net/push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV - +{::include xml/sample-web-push-subscription.xml} ~~~ @@ -500,19 +476,7 @@ Example service detection of a WebDAV server that supports VAPID: ~~~ - - - /webdav/collection/ - - - - BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs - - - O7M1nQ7cKkKTKsoS_j6Z3w - - - +{::include xml/sample-propfind-multistatus-with-vapid.xml} ~~~ If available, the client SHOULD use this key to create a restricted subscription at the push service. @@ -538,3 +502,10 @@ Example for a subscription registration requesting message encryption: ~~~ The server uses these data to encrypt the payload and send it to the push service. The client then decrypts the payload again. + + +# XML Schema + +~~~ +{::include xml/webdav-push.rng} +~~~ diff --git a/xml/sample-propfind-multistatus-with-vapid.xml b/xml/sample-propfind-multistatus-with-vapid.xml new file mode 100644 index 0000000..7f65d00 --- /dev/null +++ b/xml/sample-propfind-multistatus-with-vapid.xml @@ -0,0 +1,13 @@ + + + /webdav/collection/ + + + + BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs + + + O7M1nQ7cKkKTKsoS_j6Z3w + + + diff --git a/xml/sample-propfind-multistatus.xml b/xml/sample-propfind-multistatus.xml new file mode 100644 index 0000000..4fae513 --- /dev/null +++ b/xml/sample-propfind-multistatus.xml @@ -0,0 +1,17 @@ + + + /webdav/collection/ + + + + + + + O7M1nQ7cKkKTKsoS_j6Z3w + + + diff --git a/xml/sample-registration.xml b/xml/sample-registration.xml index f63bb1d..fed9c1d 100644 --- a/xml/sample-registration.xml +++ b/xml/sample-registration.xml @@ -1,4 +1,3 @@ - diff --git a/xml/sample-web-push-subscription.xml b/xml/sample-web-push-subscription.xml new file mode 100644 index 0000000..4958c88 --- /dev/null +++ b/xml/sample-web-push-subscription.xml @@ -0,0 +1,3 @@ + + https://push.example.net/push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV + diff --git a/xml/validate-samples.rng b/xml/validate-samples.rng new file mode 100644 index 0000000..503e220 --- /dev/null +++ b/xml/validate-samples.rng @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/validate.sh b/xml/validate.sh index 2e7a24a..6849924 100755 --- a/xml/validate.sh +++ b/xml/validate.sh @@ -1,2 +1,3 @@ #!/bin/sh -xmllint --schema webdav-push.xsd --noout *.xml + +xmlstarlet val -e -r validate-samples.rng *.xml diff --git a/xml/webdav-push.rng b/xml/webdav-push.rng new file mode 100644 index 0000000..86078ee --- /dev/null +++ b/xml/webdav-push.rng @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + p256dh + + + + + + + + + + + + + + + + + + + + + p256dh + + + + + + + + + + + + + + diff --git a/xml/webdav-push.xsd b/xml/webdav-push.xsd deleted file mode 100644 index 4ee8a0a..0000000 --- a/xml/webdav-push.xsd +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -