- From: Steven Pemberton <steven.pemberton@cwi.nl>
- Date: Tue, 28 Aug 2018 14:22:09 +0200
- To: public-xformsusers@w3.org
Hi gang,
Yesterday I received a mail from someone enquiring about the URI Functions.
https://www.w3.org/community/xformsusers/wiki/XPath_Expressions_Module#URI_Functions
4.9.1 The location-uri() Function
4.9.2 The location-param() Function
4.9.3 The uri-scheme() Function
4.9.4 The uri-scheme-specific-part() Function
4.9.5 The uri-authority() Function
4.9.6 The uri-user-info() Function
4.9.7 The uri-host() Function
4.9.8 The uri-port() Function
4.9.9 The uri-path() Function
4.9.10 The uri-query() Function
4.9.11 The uri-fragment() Function
4.9.12 The uri-param-names() Function
4.9.13 The uri-param-values() Function
which are there to be able to extract parts out of a URI (maybe we should
use IRI to make it clear that IRIs are covered as well).
While looking at them, it struck me that they were really un-XForms like.
Since we already have a parse() function,
https://www.w3.org/community/xformsusers/wiki/XPath_Expressions_Module#The_parse.28.29_Function
that takes a string and returns a document node, is it not better to have
a single parse-IRI() function, that takes a string and returns a document
node representing the parsed version of the IRI?
I played around for a while, and came up with some alternatives:
A call like
parse-IRI("https://username:password@example.org:8080/pages/order?id=42&n1=v11#content")
could produce one of the following document nodes:
<iri>
<scheme>https</scheme>
<user>username</user>
<password>password</password>
<host>example.org</host>
<port>8080</port>
<path>/pages/order</path>
<query><param name="id">42</param><param name="n1">v11</param></query>
<fragment>content</fragment>
</iri>
<iri>
<scheme>https</scheme>
<user>username:password</user>
<host>example.org</host>
<port>8080</port>
<path>/pages/order</path>
<query name="id">42</query>
<query name="n1">v11</query>
<fragment>content</fragment>
</iri>
<iri>
<scheme>https</scheme>
<user>username:password</user>
<host>example.org:8080</host> or <host port="8080">example.com</host>
<path>/pages/order</path>
<query name="id">42</query>
<query name="n1">v11</query>
<fragment>content</fragment>
</iri>
From the point of view of simplicity but sufficiency I think I prefer the
last.
Steven
Received on Tuesday, 28 August 2018 12:22:34 UTC