Merge the getURLcontent function in getURL
[scilab.git] / scilab / modules / fileio / help / en_US / splitURL.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) - S/E - Sylvestre Ledru
5  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry xml:id="splitURL" xml:lang="en"
14           xmlns="http://docbook.org/ns/docbook"
15           xmlns:xlink="http://www.w3.org/1999/xlink"
16           xmlns:svg="http://www.w3.org/2000/svg"
17           xmlns:ns3="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML"
19           xmlns:scilab="http://www.scilab.org"
20           xmlns:db="http://docbook.org/ns/docbook">
21     
22     <refnamediv>
23         <refname>splitURL</refname>
24         
25         <refpurpose>Split an URL (HTTP, HTTPS, FTP...) </refpurpose>
26     </refnamediv>
27     
28     <refsynopsisdiv>
29         <title>Calling Sequence</title>
30         
31         <synopsis>[proto, server, path, query, username, port, fragment] = splitURL(URL);
32         </synopsis>
33     </refsynopsisdiv>
34     
35     <refsection>
36         <title>Arguments</title>
37         <variablelist>
38             <varlistentry>
39                 <term>URL</term>
40                 <listitem>
41                     <para>String: An URL. Supported and tested: HTTP, HTTPS, FTP (IPv4 and IPv6)</para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>proto</term>
46                 <listitem>
47                     <para>
48                         String: the protocol (ex: <emphasis role="italic">http, ftp, etc</emphasis>)
49                     </para>
50                 </listitem>
51             </varlistentry>
52             <varlistentry>
53                 <term>server</term>
54                 <listitem>
55                     <para>
56                         String: the server (ex: <emphasis role="italic">www.scilab.org</emphasis>)
57                     </para>
58                 </listitem>
59             </varlistentry>
60             <varlistentry>
61                 <term>path</term>
62                 <listitem>
63                     <para>
64                         String: the path (ex: <emphasis role="italic">/products/scilab</emphasis>)
65                     </para>
66                 </listitem>
67             </varlistentry>
68             <varlistentry>
69                 <term>query</term>
70                 <listitem>
71                     <para>
72                         String: query (ex: <emphasis role="italic">?SearchText=plot3d</emphasis>)
73                     </para>
74                 </listitem>
75             </varlistentry>
76             <varlistentry>
77                 <term>username</term>
78                 <listitem>
79                     <para>
80                         String: username (ex: <emphasis role="italic">username:pass</emphasis>)
81                     </para>
82                 </listitem>
83             </varlistentry>
84             <varlistentry>
85                 <term>port</term>
86                 <listitem>
87                     <para>
88                         int: port (ex: <emphasis role="italic">80</emphasis>)
89                     </para>
90                     <para>Note that if the port is not provided in the URL, the value will be 0.</para>
91                 </listitem>
92             </varlistentry>
93             <varlistentry>
94                 <term>fragment</term>
95                 <listitem>
96                     <para>
97                         String: fragment (ex: <emphasis role="italic">#chapter1</emphasis>)
98                     </para>
99                     <para>The fragment is also called anchor and it is used to create a bookmark inside an HTML document.</para>
100                 </listitem>
101             </varlistentry>
102         </variablelist>
103     </refsection>
104     
105     <refsection>
106         <title>Description</title>
107         
108         <para>Split an URL by component </para>
109         
110         <para>
111             This function is based on the <ulink url="http://xmlsoft.org/html/libxml-uri.html#xmlParseURI">libxml2 library (in particular, the function xmlParseURI)</ulink>.
112         </para>
113         
114     </refsection>
115     
116     <refsection>
117         <title>Examples</title>
118         
119         <programlisting role="example">
120             [proto, server, path, query, username, port, fragment] = splitURL("http://xmlsoft.org/html/libxml-uri.html#xmlParseURI")
121             
122             [proto, server, path] = splitURL("ftp://ftp.free.fr/pub/Distributions_Linux/debian/README")
123             
124             [a,b,c,d]=splitURL("http://www.scilab.org/content/search?SearchText=plot")
125             
126         </programlisting>
127         <!-- 
128 // This example fails for now (probably a bug on evstr)
129 // Retrieve the content and execute it
130 [f,content]=getURL("http://fileexchange.scilab.org/toolboxes/161000/1.0/files/cshift.sci")
131 evstr(content);
132 M = grand(3,4,"uin",0,9);
133 cshift(M,1);
134 -->
135         
136     </refsection>
137     
138     <refsection role="see also">
139         <title>See Also</title>
140         <simplelist type="inline">
141             <member>
142                 <link linkend="getURL">getURL</link>
143             </member>
144         </simplelist>
145     </refsection>
146 </refentry>