Difference between revisions of "URL Basics"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m (File Names in URL Notation: code -> source, + cat "Basic:Tutorials")
Line 5: Line 5:
 
Since OpenOffice.org is a platform-independent application, it uses URL notation (which is independent of any operating system), as defined in the Internet Standard RFC 1738 for file names. Standard file names using this system begin with the prefix file:/// followed by the local path. If the file name contains sub-directories, then these are separated by a single forward slash., not with a backslash usually used under Windows. The following path references the test.sxw file in the doc directory on the C drive:.  
 
Since OpenOffice.org is a platform-independent application, it uses URL notation (which is independent of any operating system), as defined in the Internet Standard RFC 1738 for file names. Standard file names using this system begin with the prefix file:/// followed by the local path. If the file name contains sub-directories, then these are separated by a single forward slash., not with a backslash usually used under Windows. The following path references the test.sxw file in the doc directory on the C drive:.  
  
<code>[oobas]
+
file:///C:/doc/test.sxw
file:///C:/doc/test.sxw
+
</code>
+
 
To covert local file names into an URL, OpenOffice.org provides the ConvertToUrl function. To convert an URL into a local file name, OpenOffice.org provides the ConvertFromUrl function:  
 
To covert local file names into an URL, OpenOffice.org provides the ConvertToUrl function. To convert an URL into a local file name, OpenOffice.org provides the ConvertFromUrl function:  
  
<code>[oobas]
+
<source lang="oobas">
 
MsgBox ConvertToUrl("C:\doc\test.sxw") ' supplies file:///C:/doc/test.sxw
 
MsgBox ConvertToUrl("C:\doc\test.sxw") ' supplies file:///C:/doc/test.sxw
 
MsgBox ConvertFromUrl("file:///C:/doc/test.sxw") ' supplies (under Windows) c:\doc\test.sxw
 
MsgBox ConvertFromUrl("file:///C:/doc/test.sxw") ' supplies (under Windows) c:\doc\test.sxw
</code>
+
</source>
 
The example converts a local file name into a URL and displays it in a message box. It then converts a URL into a local file name and also displays this.  
 
The example converts a local file name into a URL and displays it in a message box. It then converts a URL into a local file name and also displays this.  
  
The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and A-Z characters. All other characters are inserted as escape coding in the URLs. To do this, they are converted into their hexadecimal value in the ISO 8859-1 (ISO-Latin) set of characters and are preceded by a percent sign. A space in a local file name therefore, for example, becomes a %20 in the URL.
+
The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and A-Z characters. All other characters are inserted as escape coding in the URLs. To do this, they are converted into their hexadecimal value in the ISO 8859-1 (ISO-Latin) set of characters and are preceded by a percent sign. For example, a space in a local file name therefore becomes a <tt>%20</tt> in the URL.
 +
 
 +
[[Category:Basic:Tutorials]]

Revision as of 09:36, 28 February 2010

The following information is based on material found in:
StarOffice™ 7 Office Suite
A Sun™ ONE Software Offering
Basic Programmer's Guide
Page 74. See http://docs.sun.com/app/docs/doc/817-1826?q=StarOffice.


File Names in URL Notation

Since OpenOffice.org is a platform-independent application, it uses URL notation (which is independent of any operating system), as defined in the Internet Standard RFC 1738 for file names. Standard file names using this system begin with the prefix file:/// followed by the local path. If the file name contains sub-directories, then these are separated by a single forward slash., not with a backslash usually used under Windows. The following path references the test.sxw file in the doc directory on the C drive:.

file:///C:/doc/test.sxw

To covert local file names into an URL, OpenOffice.org provides the ConvertToUrl function. To convert an URL into a local file name, OpenOffice.org provides the ConvertFromUrl function:

MsgBox ConvertToUrl("C:\doc\test.sxw") ' supplies file:///C:/doc/test.sxw
MsgBox ConvertFromUrl("file:///C:/doc/test.sxw") ' supplies (under Windows) c:\doc\test.sxw

The example converts a local file name into a URL and displays it in a message box. It then converts a URL into a local file name and also displays this.

The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and A-Z characters. All other characters are inserted as escape coding in the URLs. To do this, they are converted into their hexadecimal value in the ISO 8859-1 (ISO-Latin) set of characters and are preceded by a percent sign. For example, a space in a local file name therefore becomes a %20 in the URL.

Personal tools