uri.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * Summary: library of generic URI related routines
  3. * Description: library of generic URI related routines
  4. * Implements RFC 2396
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Daniel Veillard
  9. */
  10. #ifndef __XML_URI_H__
  11. #define __XML_URI_H__
  12. #include <stdio.h>
  13. #include <libxml/xmlversion.h>
  14. #include <libxml/xmlstring.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /**
  19. * xmlURI:
  20. *
  21. * A parsed URI reference. This is a struct containing the various fields
  22. * as described in RFC 2396 but separated for further processing.
  23. *
  24. * Note: query is a deprecated field which is incorrectly unescaped.
  25. * query_raw takes precedence over query if the former is set.
  26. * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
  27. */
  28. typedef struct _xmlURI xmlURI;
  29. typedef xmlURI *xmlURIPtr;
  30. struct _xmlURI {
  31. char *scheme; /* the URI scheme */
  32. char *opaque; /* opaque part */
  33. char *authority; /* the authority part */
  34. char *server; /* the server part */
  35. char *user; /* the user part */
  36. int port; /* the port number */
  37. char *path; /* the path string */
  38. char *query; /* the query string (deprecated - use with caution) */
  39. char *fragment; /* the fragment identifier */
  40. int cleanup; /* parsing potentially unclean URI */
  41. char *query_raw; /* the query string (as it appears in the URI) */
  42. };
  43. /*
  44. * This function is in tree.h:
  45. * xmlChar * xmlNodeGetBase (xmlDocPtr doc,
  46. * xmlNodePtr cur);
  47. */
  48. XMLPUBFUN xmlURIPtr
  49. xmlCreateURI (void);
  50. XMLPUBFUN int
  51. xmlBuildURISafe (const xmlChar *URI,
  52. const xmlChar *base,
  53. xmlChar **out);
  54. XMLPUBFUN xmlChar *
  55. xmlBuildURI (const xmlChar *URI,
  56. const xmlChar *base);
  57. XMLPUBFUN int
  58. xmlBuildRelativeURISafe (const xmlChar *URI,
  59. const xmlChar *base,
  60. xmlChar **out);
  61. XMLPUBFUN xmlChar *
  62. xmlBuildRelativeURI (const xmlChar *URI,
  63. const xmlChar *base);
  64. XMLPUBFUN xmlURIPtr
  65. xmlParseURI (const char *str);
  66. XMLPUBFUN int
  67. xmlParseURISafe (const char *str,
  68. xmlURIPtr *uri);
  69. XMLPUBFUN xmlURIPtr
  70. xmlParseURIRaw (const char *str,
  71. int raw);
  72. XMLPUBFUN int
  73. xmlParseURIReference (xmlURIPtr uri,
  74. const char *str);
  75. XMLPUBFUN xmlChar *
  76. xmlSaveUri (xmlURIPtr uri);
  77. XMLPUBFUN void
  78. xmlPrintURI (FILE *stream,
  79. xmlURIPtr uri);
  80. XMLPUBFUN xmlChar *
  81. xmlURIEscapeStr (const xmlChar *str,
  82. const xmlChar *list);
  83. XMLPUBFUN char *
  84. xmlURIUnescapeString (const char *str,
  85. int len,
  86. char *target);
  87. XMLPUBFUN int
  88. xmlNormalizeURIPath (char *path);
  89. XMLPUBFUN xmlChar *
  90. xmlURIEscape (const xmlChar *str);
  91. XMLPUBFUN void
  92. xmlFreeURI (xmlURIPtr uri);
  93. XMLPUBFUN xmlChar*
  94. xmlCanonicPath (const xmlChar *path);
  95. XMLPUBFUN xmlChar*
  96. xmlPathToURI (const xmlChar *path);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* __XML_URI_H__ */