* xmlTextWriterWriteElement: * @writer: the xmlTextWriterPtr * @name: element name * @content: element content * * Write an xml element. * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */
| 2218 | * Returns the bytes written (may be 0 because of buffering) or -1 in case of error |
| 2219 | */ |
| 2220 | int |
| 2221 | xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name, |
| 2222 | const xmlChar * content) |
| 2223 | { |
| 2224 | int count; |
| 2225 | int sum; |
| 2226 | |
| 2227 | sum = 0; |
| 2228 | count = xmlTextWriterStartElement(writer, name); |
| 2229 | if (count == -1) |
| 2230 | return -1; |
| 2231 | sum += count; |
| 2232 | if (content != NULL) { |
| 2233 | count = xmlTextWriterWriteString(writer, content); |
| 2234 | if (count == -1) |
| 2235 | return -1; |
| 2236 | sum += count; |
| 2237 | } |
| 2238 | count = xmlTextWriterEndElement(writer); |
| 2239 | if (count == -1) |
| 2240 | return -1; |
| 2241 | sum += count; |
| 2242 | |
| 2243 | return sum; |
| 2244 | } |
| 2245 | |
| 2246 | /** |
| 2247 | * xmlTextWriterWriteFormatElementNS: |
no test coverage detected