GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Six — File Functions (continued)
Overview
The GetURIComponents function parses a URI and returns the authority or domain name.
Syntax/Parameters
Syntax
string[] = GetURIComponents ( string uri );
Parameters
uri
A string containing a URI with a scheme.
Return Value
Returns a string array containing components of a cracked URI. On failure a formatted error code will be set but the array will still be returned. See Remarks below. Use the GetLastError function to retrieve error information.
Remarks
Internal limits have been set on the sizes of various items which can result in an overflow error. In addition, certain parsing errors will stop the cracking process. However, an array of items will still be returned which will contain what ever information can be garnered from the cracking process. Use the IsError and GetLastError to determine if an error occurred and the nature of the error.
Sub error codes are as follows (mask off ERROR_OVERFLOW or ERROR_SYNTAX using ERROR_CODE_MASK):
Code | Description | |||
0x0101 | Name overflow. | |||
0x0201 | Authority overflow. | |||
0x0301 | User overflow. | |||
0x0302 | Password overflow. | |||
0x0303 | Host overflow. | |||
0x0401 | Port number syntax (must be valid decimal). Does not check for range. | |||
0x0501 | Path overflow. | |||
0x0601 | Query overflow. |
The base URI is disassembled as follows;
authority path +-------------------------------++--------+ abc://username:password@example.com:123/path/data?key=value#name1 +-+ +---------------+ +---------+ +-+ +-------+ +-----+ scheme user information host port query fragment
(portions courtesy Wikipedia.org)
The following key names and data components are returned:
Key Name | Description | |||
scheme | Text of the specified scheme. | |||
authority | Combined user, password, domain (host) and port. | |||
host | Domain name or host name. | |||
path | Path component which may contain a filename. | |||
port | Port number of specified, | |||
scheme_code | A string as a decimal value specifying a code for a common scheme. See URI_SCHEME_ codes in the default SDK. For example: URI_SCHEME_HTTP. If the scheme is not known, the field will be URI_SCHEME_UNKNOWN 0. | |||
name | Name or namespace also referred to a fragment. | |||
query | Query portion of URI. Note that the size of this component is limited to 1,024 characters. If the size is larger, use the GetURIQuery function or the query can be manually be parsed using the q_x value. | |||
user | Username if specified. For mailto: this will be the recipient. | |||
password | Password if specified. | |||
a_x | Zero based index of the start of the authority. -1 if no index is available. | |||
p_x | Zero based index of the start of the path. -1 if no index is available. | |||
n_x | Zero based index of the start of the name. -1 if no index is available. | |||
q_x | Zero based index of the start of the query. -1 if no index is available. | |||
d_x | Zero based index of the start of the data. -1 if no index is available. Data only applies to non-URI schemes such as ‘data:’. |
The authority includes the subdomain (for example, “www”), username and password, and port number. The URI contained in the uri parameter must have a scheme. URIs with the “mailto” scheme will return the entire email address (name@domain name).
If the any internal buffer is exceeded, the GetLastError function will return ERROR_OVERFLOW.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.