  
    
    
    
    
    
    
    
  
  
    
      
        
          
libxml2-tree.html            
Prev          
        
        
          
general.html            
Up          
        
        
          
index.html            
Home          
        
        
          
libxml2-valid.html            
Next          
        
        
libxml2 Reference Manual      
    
    
      
uri    
    
uri - library of generic URI related routines
    
library of generic URI related routines Implements RFC 2396 
    
Author(s): Daniel Veillard 
    
      
Synopsis
      
typedef struct _xmlURI #xmlURIxmlURI ;
typedef 
libxml2-uri.html#xmlURIxmlURI  * #xmlURIPtrxmlURIPtr ;
int	
#xmlNormalizeURIPathxmlNormalizeURIPath 		(char * path);
void	
#xmlPrintURIxmlPrintURI 			(FILE * stream, 					 libxml2-uri.html#xmlURIPtrxmlURIPtr  uri);
libxml2-uri.html#xmlURIPtrxmlURIPtr 	#xmlParseURIRawxmlParseURIRaw 		(const char * str, 					 int raw);
char *	
#xmlURIUnescapeStringxmlURIUnescapeString 		(const char * str, 					 int len, 					 char * target);
libxml2-uri.html#xmlURIPtrxmlURIPtr 	#xmlParseURIxmlParseURI 		(const char * str);
libxml2-uri.html#xmlURIPtrxmlURIPtr 	#xmlCreateURIxmlCreateURI 		(void);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlURIEscapeStrxmlURIEscapeStr 		(const libxml2-xmlstring.html#xmlCharxmlChar  * str, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * list);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlCanonicPathxmlCanonicPath 		(const libxml2-xmlstring.html#xmlCharxmlChar  * path);
void	
#xmlFreeURIxmlFreeURI 			( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri);
int	
#xmlParseURIReferencexmlParseURIReference 		( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri, 					 const char * str);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlBuildRelativeURIxmlBuildRelativeURI 	(const libxml2-xmlstring.html#xmlCharxmlChar  * URI, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * base);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlSaveUrixmlSaveUri 		( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlURIEscapexmlURIEscape 		(const libxml2-xmlstring.html#xmlCharxmlChar  * str);
libxml2-xmlstring.html#xmlCharxmlChar  *	#xmlBuildURIxmlBuildURI 		(const libxml2-xmlstring.html#xmlCharxmlChar  * URI, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * base);
    
    
      
Description
    
    
      
Details
      
        
Structure xmlURI
struct _xmlURI {
    char *	scheme	: the URI scheme
    char *	opaque	: opaque part
    char *	authority	: the authority part
    char *	server	: the server part
    char *	user	: the user part
    int	port	: the port number
    char *	path	: the path string
    char *	query	: the query string
    char *	fragment	: the fragment identifier
    int	cleanup	: parsing potentially unclean URI
} xmlURI;
        
        
Typedef xmlURIPtr
libxml2-uri.html#xmlURIxmlURI  * xmlURIPtr;
        
        
xmlBuildRelativeURI ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlBuildRelativeURI	(const libxml2-xmlstring.html#xmlCharxmlChar  * URI, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * base)Expresses the URI of the libxml2-SAX.html#referencereference  in terms relative to the base. Some examples of this operation include: base = "http://site1.com/docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif http://site2.com/docs/pic1.gif http://site2.com/docs/pic1.gif base = "docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif Note: if the URI libxml2-SAX.html#referencereference  is really wierd or complicated, it may be worthwhile to first convert it into a "nice" one by calling libxml2-uri.html#xmlBuildURIxmlBuildURI  (using 'base') before calling this routine, since this routine (for reasonable efficiency) assumes URI has already been through some validation.
URI: the URI libxml2-SAX.html#referencereference  under consideration base: the base value Returns: a new URI string (to be freed by the caller) or NULL in case error.         
        
xmlBuildURI ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlBuildURI		(const libxml2-xmlstring.html#xmlCharxmlChar  * URI, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * base)Computes he final URI of the libxml2-SAX.html#referencereference  done by checking that the given URI is valid, and building the final URI using the base URI. This is processed according to section 5.2 of the RFC 2396 5.2. Resolving Relative References to Absolute Form
URI: the URI instance found in the document base: the base value Returns: a new URI string (to be freed by the caller) or NULL in case of error.         
        
xmlCanonicPath ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlCanonicPath		(const libxml2-xmlstring.html#xmlCharxmlChar  * path)Constructs a canonic path from the specified path.
path: the resource locator in a filesystem notation Returns: a new canonic path, or a duplicate of the path parameter if the construction fails. The caller is responsible for freeing the memory occupied by the returned string. If there is insufficient memory available, or the argument is NULL, the function returns NULL.         
        
xmlCreateURI ()
libxml2-uri.html#xmlURIPtrxmlURIPtr 	xmlCreateURI		(void)Simply creates an empty libxml2-uri.html#xmlURIxmlURI 
Returns: the new structure or NULL in case of error         
        
xmlFreeURI ()
void	xmlFreeURI			( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri)Free up the libxml2-uri.html#xmlURIxmlURI  struct
uri: pointer to an libxml2-uri.html#xmlURIxmlURI         
        
xmlNormalizeURIPath ()
int	xmlNormalizeURIPath		(char * path)Applies the 5 normalization steps to a path string--that is, RFC 2396 Section 5.2, steps 6.c through 6.g. Normalization occurs directly on the string, no new allocation is done
path: pointer to the path string Returns: 0 or an error code         
        
xmlParseURI ()
libxml2-uri.html#xmlURIPtrxmlURIPtr 	xmlParseURI		(const char * str)Parse an URI URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
str: the URI string to analyze Returns: a newly built libxml2-uri.html#xmlURIPtrxmlURIPtr  or NULL in case of error         
        
xmlParseURIRaw ()
libxml2-uri.html#xmlURIPtrxmlURIPtr 	xmlParseURIRaw		(const char * str, 					 int raw)Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
str: the URI string to analyze raw: if 1 unescaping of URI pieces are disabled Returns: a newly built libxml2-uri.html#xmlURIPtrxmlURIPtr  or NULL in case of error         
        
xmlParseURIReference ()
int	xmlParseURIReference		( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri, 					 const char * str)Parse an URI libxml2-SAX.html#referencereference  string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
uri: pointer to an URI structure str: the string to analyze Returns: 0 or the error code         
        
xmlPrintURI ()
void	xmlPrintURI			(FILE * stream, 					 libxml2-uri.html#xmlURIPtrxmlURIPtr  uri)Prints the URI in the stream @stream.
stream: a FILE* for the output uri: pointer to an libxml2-uri.html#xmlURIxmlURI         
        
xmlSaveUri ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlSaveUri		( libxml2-uri.html#xmlURIPtrxmlURIPtr  uri)Save the URI as an escaped string
uri: pointer to an libxml2-uri.html#xmlURIxmlURI Returns: a new string (to be deallocated by caller)         
        
xmlURIEscape ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlURIEscape		(const libxml2-xmlstring.html#xmlCharxmlChar  * str)Escaping routine, does not do validity checks ! It will try to escape the chars needing this, but this is heuristic based it's impossible to be sure.
str: the string of the URI to escape Returns: an copy of the string, but escaped 25 May 2001 Uses libxml2-uri.html#xmlParseURIxmlParseURI  and libxml2-uri.html#xmlURIEscapeStrxmlURIEscapeStr  to try to escape correctly according to RFC2396. - Carl Douglas         
        
xmlURIEscapeStr ()
libxml2-xmlstring.html#xmlCharxmlChar  *	xmlURIEscapeStr		(const libxml2-xmlstring.html#xmlCharxmlChar  * str, 					 const libxml2-xmlstring.html#xmlCharxmlChar  * list)This routine escapes a string to hex, ignoring reserved libxml2-SAX.html#characterscharacters  (a-z) and the libxml2-SAX.html#characterscharacters  in the exception list.
str: string to escape list: exception list string of chars not to escape Returns: a new escaped string or NULL in case of error.         
        
xmlURIUnescapeString ()
char *	xmlURIUnescapeString		(const char * str, 					 int len, 					 char * target)Unescaping routine, does not do validity checks ! Output is direct unsigned char translation of %XX values (no encoding)
str: the string to unescape len: the length in bytes to unescape (or <= 0 to indicate full string) target: optional destination buffer Returns: an copy of the string, but unescaped         
      
    
  
