ne_xml_parse_response.3 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. '\" t
  2. .\" Title: ne_xml_parse_response
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 23 November 2025
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.36.0
  8. .\" Language: English
  9. .\"
  10. .TH "NE_XML_PARSE_RESPONS" "3" "23 November 2025" "neon 0.36.0" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_xml_parse_response, ne_xml_dispatch_request, ne_xml_dispatchif_request \- helper functions for parsing XML responses
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_xmlreq\&.h>
  37. .fi
  38. .ft
  39. .HP \w'int\ ne_xml_parse_response('u
  40. .BI "int ne_xml_parse_response(ne_request\ *" "req" ", ne_xml_parser\ *" "parser" ");"
  41. .HP \w'int\ ne_xml_dispatch_request('u
  42. .BI "int ne_xml_dispatch_request(ne_request\ *" "req" ", ne_xml_parser\ *" "parser" ");"
  43. .HP \w'int\ ne_xml_dispatchif_request('u
  44. .BI "int ne_xml_dispatchif_request(ne_request\ *" "req" ", ne_xml_parser\ *" "parser" ", ne_accept_response\ " "acceptor" ", void\ *" "userdata" ");"
  45. .SH "DESCRIPTION"
  46. .PP
  47. The
  48. \fBne_xml_parse_response\fR
  49. function reads an HTTP response body and processes it using the given XML parser\&. The function must be called
  50. \fBne_begin_request\fR
  51. has returned successfully for the request, and then invokes
  52. \fBne_read_response_block\fR
  53. until the entire response body has been read\&. On successful return,
  54. \fBne_end_request\fR
  55. must be called to finalise response processing\&.
  56. .PP
  57. The
  58. \fBne_xml_dispatch_request\fR
  59. and
  60. \fBne_xml_dispatchif_request\fR
  61. functions is equivalent to calling
  62. ne_request_dispatch
  63. to dispatch an HTTP request and process the response, parsing the response body using the given XML parser under certain conditions:
  64. .sp
  65. .RS 4
  66. .ie n \{\
  67. \h'-04'\(bu\h'+03'\c
  68. .\}
  69. .el \{\
  70. .sp -1
  71. .IP \(bu 2.3
  72. .\}
  73. For
  74. \fBne_xml_dispatch_request\fR, any
  75. 2xx
  76. class response with an XML content\-type\&.
  77. .RE
  78. .sp
  79. .RS 4
  80. .ie n \{\
  81. \h'-04'\(bu\h'+03'\c
  82. .\}
  83. .el \{\
  84. .sp -1
  85. .IP \(bu 2.3
  86. .\}
  87. For
  88. \fBne_xml_dispatchif_request\fR, if the
  89. \fIacceptor\fR
  90. callback returns non\-zero, and the response uses an XML content\-type\&.
  91. .RE
  92. .sp
  93. In both cases, the rules in
  94. \m[blue]\fBRFC 7303\fR\m[]\&\s-2\u[1]\d\s+2
  95. are followed to identify XML content\-types, that is
  96. text/xml,
  97. application/xml, or any other content\-type ending in a
  98. +xml
  99. suffix\&. The
  100. \fIuserdata\fR
  101. parameter is passed to the
  102. \fIacceptor\fR
  103. function\&.
  104. .PP
  105. For all three functions:
  106. .sp
  107. .RS 4
  108. .ie n \{\
  109. \h'-04'\(bu\h'+03'\c
  110. .\}
  111. .el \{\
  112. .sp -1
  113. .IP \(bu 2.3
  114. .\}
  115. the XML parser is invoked repeatedly until the end of the document is reached\&.
  116. .RE
  117. .sp
  118. .RS 4
  119. .ie n \{\
  120. \h'-04'\(bu\h'+03'\c
  121. .\}
  122. .el \{\
  123. .sp -1
  124. .IP \(bu 2.3
  125. .\}
  126. if an error occurs during XML parsing, the session error string is set to describe the parse error, and the connection is terminated without continuing to process the response\&.\&.
  127. .RE
  128. .sp
  129. .SH "RETURN VALUE"
  130. .PP
  131. All functions documented here return zero on success, or an
  132. NE_* error code
  133. on failure\&.
  134. .SH "HISTORY"
  135. .PP
  136. \fBne_xml_dispatchif_request\fR
  137. is available in neon 0\&.36\&.0 and later\&.
  138. .SH "SEE ALSO"
  139. .PP
  140. ne_xml_create,
  141. ne_request_dispatch
  142. .SH "COPYRIGHT"
  143. .br
  144. Copyright \(co 2001-2025 Joe Orton
  145. .br
  146. .SH "REFERENCES"
  147. .IP " 1." 4
  148. RFC 7303
  149. .RS 4
  150. \%https://www.rfc-editor.org/rfc/rfc7303
  151. .RE