| 2280 | |
| 2281 | |
| 2282 | XMLError XMLDocument::Parse( const char* p, size_t len ) |
| 2283 | { |
| 2284 | Clear(); |
| 2285 | |
| 2286 | if ( len == 0 || !p || !*p ) { |
| 2287 | SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); |
| 2288 | return _errorID; |
| 2289 | } |
| 2290 | if ( len == (size_t)(-1) ) { |
| 2291 | len = strlen( p ); |
| 2292 | } |
| 2293 | TIXMLASSERT( _charBuffer == 0 ); |
| 2294 | _charBuffer = new char[ len+1 ]; |
| 2295 | memcpy( _charBuffer, p, len ); |
| 2296 | _charBuffer[len] = 0; |
| 2297 | |
| 2298 | Parse(); |
| 2299 | if ( Error() ) { |
| 2300 | // clean up now essentially dangling memory. |
| 2301 | // and the parse fail can put objects in the |
| 2302 | // pools that are dead and inaccessible. |
| 2303 | DeleteChildren(); |
| 2304 | _elementPool.Clear(); |
| 2305 | _attributePool.Clear(); |
| 2306 | _textPool.Clear(); |
| 2307 | _commentPool.Clear(); |
| 2308 | } |
| 2309 | return _errorID; |
| 2310 | } |
| 2311 | |
| 2312 | |
| 2313 | void XMLDocument::Print( XMLPrinter* streamer ) const |
nothing calls this directly
no test coverage detected