W3C home > Mailing lists > Public > public-xformsusers@w3.org > August 2018

Re: URI Functions

From: Philip Fennell <Philip.Fennell@marklogic.com>
Date: Tue, 28 Aug 2018 12:43:30 +0000
To: Steven Pemberton <steven.pemberton@cwi.nl>, "public-xformsusers@w3.org" <public-xformsusers@w3.org>
Message-ID: <941EAE44-CE4A-4FDE-94E3-84C55FD1EC6A@marklogic.com>
Hello Steven,

I think I agree with your comment on the last example but I can imagine those who'd argue that the first, with separation of username and password, is a more complete parsing.


Philip



´╗┐On 28/08/2018, 13:22, "Steven Pemberton" <steven.pemberton@cwi.nl> wrote:

    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:43:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:37:50 UTC