* xmlTextWriterEndAttribute: * @writer: the xmlTextWriterPtr * * End the current xml element. * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */
| 1907 | * Returns the bytes written (may be 0 because of buffering) or -1 in case of error |
| 1908 | */ |
| 1909 | int |
| 1910 | xmlTextWriterEndAttribute(xmlTextWriterPtr writer) |
| 1911 | { |
| 1912 | int count; |
| 1913 | int sum; |
| 1914 | xmlLinkPtr lk; |
| 1915 | xmlTextWriterStackEntry *p; |
| 1916 | |
| 1917 | if (writer == NULL) |
| 1918 | return -1; |
| 1919 | |
| 1920 | lk = xmlListFront(writer->nodes); |
| 1921 | if (lk == 0) { |
| 1922 | return -1; |
| 1923 | } |
| 1924 | |
| 1925 | p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); |
| 1926 | if (p == 0) { |
| 1927 | return -1; |
| 1928 | } |
| 1929 | |
| 1930 | sum = 0; |
| 1931 | switch (p->state) { |
| 1932 | case XML_TEXTWRITER_ATTRIBUTE: |
| 1933 | p->state = XML_TEXTWRITER_NAME; |
| 1934 | |
| 1935 | count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar); |
| 1936 | if (count < 0) { |
| 1937 | return -1; |
| 1938 | } |
| 1939 | sum += count; |
| 1940 | break; |
| 1941 | default: |
| 1942 | return -1; |
| 1943 | } |
| 1944 | |
| 1945 | return sum; |
| 1946 | } |
| 1947 | |
| 1948 | /** |
| 1949 | * xmlTextWriterWriteFormatAttribute: |
no test coverage detected