| 1738 | |
| 1739 | |
| 1740 | XMLError XMLDocument::Parse( const char* p, size_t len ) { |
| 1741 | Clear(); |
| 1742 | |
| 1743 | if ( len == 0 || !p || !*p ) { |
| 1744 | SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); |
| 1745 | return _errorID; |
| 1746 | } |
| 1747 | if ( len == (size_t)(-1) ) { |
| 1748 | len = strlen( p ); |
| 1749 | } |
| 1750 | _charBuffer = new char[ len+1 ]; |
| 1751 | memcpy( _charBuffer, p, len ); |
| 1752 | _charBuffer[len] = 0; |
| 1753 | |
| 1754 | Parse(); |
| 1755 | if ( Error() ) { |
| 1756 | // clean up now essentially dangling memory. |
| 1757 | // and the parse fail can put objects in the |
| 1758 | // pools that are dead and inaccessible. |
| 1759 | DeleteChildren(); |
| 1760 | _elementPool.Clear(); |
| 1761 | _attributePool.Clear(); |
| 1762 | _textPool.Clear(); |
| 1763 | _commentPool.Clear(); |
| 1764 | } |
| 1765 | return _errorID; |
| 1766 | } |
| 1767 | |
| 1768 | |
| 1769 | void XMLDocument::Print( XMLPrinter* streamer ) const { |
nothing calls this directly
no test coverage detected