MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlTextWriterStartAttribute

Function xmlTextWriterStartAttribute

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:1754–1807  ·  view source on GitHub ↗

* xmlTextWriterStartAttribute: * @writer: the xmlTextWriterPtr * @name: element name * * Start an xml attribute. * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */

Source from the content-addressed store, hash-verified

1752 * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
1753 */
1754int
1755xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name)
1756{
1757 int count;
1758 int sum;
1759 xmlLinkPtr lk;
1760 xmlTextWriterStackEntry *p;
1761
1762 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1763 return -1;
1764
1765 sum = 0;
1766 lk = xmlListFront(writer->nodes);
1767 if (lk == 0)
1768 return -1;
1769
1770 p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk);
1771 if (p == 0)
1772 return -1;
1773
1774 switch (p->state) {
1775 case XML_TEXTWRITER_ATTRIBUTE:
1776 count = xmlTextWriterEndAttribute(writer);
1777 if (count < 0)
1778 return -1;
1779 sum += count;
1780 /* fallthrough */
1781 case XML_TEXTWRITER_NAME:
1782 count = xmlOutputBufferWriteString(writer->out, " ");
1783 if (count < 0)
1784 return -1;
1785 sum += count;
1786 count =
1787 xmlOutputBufferWriteString(writer->out,
1788 (const char *) name);
1789 if (count < 0)
1790 return -1;
1791 sum += count;
1792 count = xmlOutputBufferWriteString(writer->out, "=");
1793 if (count < 0)
1794 return -1;
1795 sum += count;
1796 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1797 if (count < 0)
1798 return -1;
1799 sum += count;
1800 p->state = XML_TEXTWRITER_ATTRIBUTE;
1801 break;
1802 default:
1803 return -1;
1804 }
1805
1806 return sum;
1807}
1808
1809/**
1810 * xmlTextWriterStartAttributeNS:

Callers 2

Calls 5

xmlListFrontFunction · 0.85
xmlLinkGetDataFunction · 0.85
xmlOutputBufferWriteFunction · 0.85

Tested by

no test coverage detected