blob: 1e743d0402a97d7375c887f80a2e1fcec813ce79 [file] [log] [blame]
William M. Brackc6e07552003-08-16 12:44:47 +00001<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>uri</title><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><meta xmlns="http://www.w3.org/TR/xhtml1/transitional" name="generator" content="GTK-Doc V1.0 (XML mode)"></meta><style xmlns="http://www.w3.org/TR/xhtml1/transitional" type="text/css">
Daniel Veillardd4330462003-04-29 12:40:16 +00002 .synopsis, .classsynopsis {
3 background: #eeeeee;
4 border: solid 1px #aaaaaa;
5 padding: 0.5em;
6 }
7 .programlisting {
8 background: #eeeeff;
9 border: solid 1px #aaaaff;
10 padding: 0.5em;
11 }
12 .variablelist {
13 padding: 4px;
14 margin-left: 3em;
15 }
16 .navigation {
17 background: #ffeeee;
18 border: solid 1px #ffaaaa;
19 margin-top: 0.5em;
20 margin-bottom: 0.5em;
21 }
22 .navigation a {
23 color: #770000;
24 }
25 .navigation a:visited {
26 color: #550000;
27 }
28 .navigation .title {
29 font-size: 200%;
30 }
William M. Brackc6e07552003-08-16 12:44:47 +000031 </style><link rel="home" href="index.html" title="[Insert name here] Reference Manual"><link rel="up" href="ch01.html" title="[Insert title here]"><link rel="previous" href="libxml-SAX.html" title="SAX"><link rel="next" href="libxml-nanoftp.html" title="nanoftp"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-SAX.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td><td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td><th width="100%" align="center">[Insert name here] Reference Manual</th><td><a accesskey="n" href="libxml-nanoftp.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td></tr></table><div class="refentry" lang="en"><a name="libxml-uri"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">uri</span></h2><p>uri &#8212; </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
Daniel Veillardb732a0e2000-10-15 11:27:01 +000032
Daniel Veillardd4330462003-04-29 12:40:16 +000033
34
35struct <a href="libxml-uri.html#xmlURI">xmlURI</a>;
36typedef <a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a>;
37<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> <a href="libxml-uri.html#xmlCreateURI">xmlCreateURI</a> (void);
38<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-uri.html#xmlBuildURI">xmlBuildURI</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI,
39 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *base);
40<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> <a href="libxml-uri.html#xmlParseURI">xmlParseURI</a> (const char *str);
41int <a href="libxml-uri.html#xmlParseURIReference">xmlParseURIReference</a> (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri,
Daniel Veillardb732a0e2000-10-15 11:27:01 +000042 const char *str);
Daniel Veillardd4330462003-04-29 12:40:16 +000043<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-uri.html#xmlSaveUri">xmlSaveUri</a> (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);
44void <a href="libxml-uri.html#xmlPrintURI">xmlPrintURI</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *stream,
45 <a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);
46<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-uri.html#xmlURIEscapeStr">xmlURIEscapeStr</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *str,
47 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *list);
48char* <a href="libxml-uri.html#xmlURIUnescapeString">xmlURIUnescapeString</a> (const char *str,
Daniel Veillardb732a0e2000-10-15 11:27:01 +000049 int len,
50 char *target);
Daniel Veillardd4330462003-04-29 12:40:16 +000051int <a href="libxml-uri.html#xmlNormalizeURIPath">xmlNormalizeURIPath</a> (char *path);
52<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-uri.html#xmlURIEscape">xmlURIEscape</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *str);
53void <a href="libxml-uri.html#xmlFreeURI">xmlFreeURI</a> (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);
54<a href="libxml-tree.html#xmlChar">xmlChar</a>* <a href="libxml-uri.html#xmlCanonicPath">xmlCanonicPath</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *path);
55</pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
56
57</p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="xmlURI"></a>struct xmlURI</h3><pre class="programlisting">struct xmlURI {
William M. Brackc6e07552003-08-16 12:44:47 +000058
Daniel Veillardef90ba72001-12-07 14:24:22 +000059 char *scheme; /* the URI scheme */
60 char *opaque; /* opaque part */
61 char *authority; /* the authority part */
62 char *server; /* the server part */
63 char *user; /* the user part */
64 int port; /* the port number */
65 char *path; /* the path string */
66 char *query; /* the query string */
67 char *fragment; /* the fragment identifier */
68 int cleanup; /* parsing potentially unclean URI */
Daniel Veillardd4330462003-04-29 12:40:16 +000069};
70</pre><p>
71A parsed URI reference. This is a struct containing the various fields
72as described in RFC 2396 but separated for further processing.</p><p>
73
Daniel Veillardd7cec922003-06-13 12:30:10 +000074</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlURIPtr"></a>xmlURIPtr</h3><pre class="programlisting">typedef xmlURI *xmlURIPtr;
75</pre><p>
Daniel Veillardd4330462003-04-29 12:40:16 +000076
77</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCreateURI"></a>xmlCreateURI ()</h3><pre class="programlisting"><a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> xmlCreateURI (void);</pre><p>
78Simply creates an empty xmlURI</p><p>
79
Daniel Veillardd7cec922003-06-13 12:30:10 +000080</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new structure or NULL in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +000081</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlBuildURI"></a>xmlBuildURI ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlBuildURI (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI,
82 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *base);</pre><p>
83Computes he final URI of the reference done by checking that
Daniel Veillardb732a0e2000-10-15 11:27:01 +000084the given URI is valid, and building the final URI using the
85base URI. This is processed according to section 5.2 of the
Daniel Veillardd4330462003-04-29 12:40:16 +000086RFC 2396
87</p><p>
885.2. Resolving Relative References to Absolute Form</p><p>
89
William M. Brackc6e07552003-08-16 12:44:47 +000090</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>URI</tt></i> :</span></td><td> the URI instance found in the document
91</td></tr><tr><td><span class="term"><i class="parameter"><tt>base</tt></i> :</span></td><td> the base value
Daniel Veillardd7cec922003-06-13 12:30:10 +000092</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new URI string (to be freed by the caller) or NULL in case
93 of error.
Daniel Veillardd4330462003-04-29 12:40:16 +000094</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlParseURI"></a>xmlParseURI ()</h3><pre class="programlisting"><a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> xmlParseURI (const char *str);</pre><p>
95Parse an URI
96</p><p>
Daniel Veillardcfba2fe2003-08-15 00:33:43 +000097URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]</p><p>
Daniel Veillardd4330462003-04-29 12:40:16 +000098
William M. Brackc6e07552003-08-16 12:44:47 +000099</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>str</tt></i> :</span></td><td> the URI string to analyze
Daniel Veillardd7cec922003-06-13 12:30:10 +0000100</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a newly build xmlURIPtr or NULL in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000101</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlParseURIReference"></a>xmlParseURIReference ()</h3><pre class="programlisting">int xmlParseURIReference (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri,
102 const char *str);</pre><p>
103Parse an URI reference string and fills in the appropriate fields
William M. Brackc6e07552003-08-16 12:44:47 +0000104of the <i class="parameter"><tt>uri</tt></i> structure
Daniel Veillardd4330462003-04-29 12:40:16 +0000105</p><p>
Daniel Veillardcfba2fe2003-08-15 00:33:43 +0000106URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]</p><p>
Daniel Veillardd4330462003-04-29 12:40:16 +0000107
William M. Brackc6e07552003-08-16 12:44:47 +0000108</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> pointer to an URI structure
109</td></tr><tr><td><span class="term"><i class="parameter"><tt>str</tt></i> :</span></td><td> the string to analyze
Daniel Veillardd7cec922003-06-13 12:30:10 +0000110</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 or the error code
Daniel Veillardd4330462003-04-29 12:40:16 +0000111</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlSaveUri"></a>xmlSaveUri ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlSaveUri (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);</pre><p>
112Save the URI as an escaped string</p><p>
113
William M. Brackc6e07552003-08-16 12:44:47 +0000114</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> pointer to an xmlURI
Daniel Veillardd7cec922003-06-13 12:30:10 +0000115</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new string (to be deallocated by caller)
Daniel Veillardd4330462003-04-29 12:40:16 +0000116</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlPrintURI"></a>xmlPrintURI ()</h3><pre class="programlisting">void xmlPrintURI (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *stream,
117 <a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);</pre><p>
William M. Brackc6e07552003-08-16 12:44:47 +0000118Prints the URI in the stream <i class="parameter"><tt>steam</tt></i>.</p><p>
Daniel Veillardd4330462003-04-29 12:40:16 +0000119
William M. Brackc6e07552003-08-16 12:44:47 +0000120</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>stream</tt></i> :</span></td><td> a FILE* for the output
121</td></tr><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> pointer to an xmlURI
Daniel Veillardd4330462003-04-29 12:40:16 +0000122</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlURIEscapeStr"></a>xmlURIEscapeStr ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlURIEscapeStr (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *str,
123 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *list);</pre><p>
124This routine escapes a string to hex, ignoring reserved characters (a-z)
125and the characters in the exception list.</p><p>
126
William M. Brackc6e07552003-08-16 12:44:47 +0000127</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>str</tt></i> :</span></td><td> string to escape
128</td></tr><tr><td><span class="term"><i class="parameter"><tt>list</tt></i> :</span></td><td> exception list string of chars not to escape
Daniel Veillardd7cec922003-06-13 12:30:10 +0000129</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new escaped string or NULL in case of error.
Daniel Veillardd4330462003-04-29 12:40:16 +0000130</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlURIUnescapeString"></a>xmlURIUnescapeString ()</h3><pre class="programlisting">char* xmlURIUnescapeString (const char *str,
Daniel Veillardb732a0e2000-10-15 11:27:01 +0000131 int len,
Daniel Veillardd4330462003-04-29 12:40:16 +0000132 char *target);</pre><p>
133Unescaping routine, does not do validity checks !
William M. Brackc6e07552003-08-16 12:44:47 +0000134Output is direct unsigned char translation of <tt class="literal">XX</tt> values (no encoding)</p><p>
Daniel Veillardd4330462003-04-29 12:40:16 +0000135
William M. Brackc6e07552003-08-16 12:44:47 +0000136</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>str</tt></i> :</span></td><td> the string to unescape
137</td></tr><tr><td><span class="term"><i class="parameter"><tt>len</tt></i> :</span></td><td> the length in bytes to unescape (or &lt;= 0 to indicate full string)
138</td></tr><tr><td><span class="term"><i class="parameter"><tt>target</tt></i> :</span></td><td> optional destination buffer
Daniel Veillardd7cec922003-06-13 12:30:10 +0000139</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>an copy of the string, but unescaped
Daniel Veillardd4330462003-04-29 12:40:16 +0000140</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlNormalizeURIPath"></a>xmlNormalizeURIPath ()</h3><pre class="programlisting">int xmlNormalizeURIPath (char *path);</pre><p>
141Applies the 5 normalization steps to a path string--that is, RFC 2396
142Section 5.2, steps 6.c through 6.g.
143</p><p>
144Normalization occurs directly on the string, no new allocation is done</p><p>
145
William M. Brackc6e07552003-08-16 12:44:47 +0000146</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> pointer to the path string
Daniel Veillardd7cec922003-06-13 12:30:10 +0000147</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 or an error code
Daniel Veillardd4330462003-04-29 12:40:16 +0000148</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlURIEscape"></a>xmlURIEscape ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlURIEscape (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *str);</pre><p>
149Escaping routine, does not do validity checks !
Daniel Veillard28929b22000-11-13 18:22:49 +0000150It will try to escape the chars needing this, but this is heuristic
Daniel Veillardd4330462003-04-29 12:40:16 +0000151based it's impossible to be sure.</p><p>
152
William M. Brackc6e07552003-08-16 12:44:47 +0000153</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>str</tt></i> :</span></td><td> the string of the URI to escape
Daniel Veillardd7cec922003-06-13 12:30:10 +0000154</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>an copy of the string, but escaped
Daniel Veillardd4330462003-04-29 12:40:16 +0000155
Daniel Veillardd7cec922003-06-13 12:30:10 +000015625 May 2001
157Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly
158according to RFC2396.
159 - Carl Douglas
Daniel Veillardd4330462003-04-29 12:40:16 +0000160</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlFreeURI"></a>xmlFreeURI ()</h3><pre class="programlisting">void xmlFreeURI (<a href="libxml-uri.html#xmlURIPtr">xmlURIPtr</a> uri);</pre><p>
161Free up the xmlURI struct</p><p>
162
William M. Brackc6e07552003-08-16 12:44:47 +0000163</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> pointer to an xmlURI
Daniel Veillardd4330462003-04-29 12:40:16 +0000164</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlCanonicPath"></a>xmlCanonicPath ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlChar">xmlChar</a>* xmlCanonicPath (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *path);</pre><p>
165Constructs a canonic path from the specified path.</p><p>
166
William M. Brackc6e07552003-08-16 12:44:47 +0000167</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> the resource locator in a filesystem notation
Daniel Veillardd7cec922003-06-13 12:30:10 +0000168</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new canonic path, or a duplicate of the path parameter if the
169construction fails. The caller is responsible for freeing the memory occupied
170by the returned string. If there is insufficient memory available, or the
171argument is NULL, the function returns NULL.
William M. Brackc6e07552003-08-16 12:44:47 +0000172</td></tr></tbody></table></div></div></div></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-SAX.html"><b>&lt;&lt; SAX</b></a></td><td align="right"><a accesskey="n" href="libxml-nanoftp.html"><b>nanoftp &gt;&gt;</b></a></td></tr></table></body></html>