| 2264 | |
| 2265 | |
| 2266 | XMLError XMLDocument::Parse( const char* p, size_t len ) |
| 2267 | { |
| 2268 | Clear(); |
| 2269 | |
| 2270 | if ( len == 0 || !p || !*p ) { |
| 2271 | SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0, 0 ); |
| 2272 | return _errorID; |
| 2273 | } |
| 2274 | if ( len == (size_t)(-1) ) { |
| 2275 | len = strlen( p ); |
| 2276 | } |
| 2277 | TIXMLASSERT( _charBuffer == 0 ); |
| 2278 | _charBuffer = new char[ len+1 ]; |
| 2279 | memcpy( _charBuffer, p, len ); |
| 2280 | _charBuffer[len] = 0; |
| 2281 | |
| 2282 | Parse(); |
| 2283 | if ( Error() ) { |
| 2284 | // clean up now essentially dangling memory. |
| 2285 | // and the parse fail can put objects in the |
| 2286 | // pools that are dead and inaccessible. |
| 2287 | DeleteChildren(); |
| 2288 | _elementPool.Clear(); |
| 2289 | _attributePool.Clear(); |
| 2290 | _textPool.Clear(); |
| 2291 | _commentPool.Clear(); |
| 2292 | } |
| 2293 | return _errorID; |
| 2294 | } |
| 2295 | |
| 2296 | |
| 2297 | void XMLDocument::Print( XMLPrinter* streamer ) const |
nothing calls this directly
no test coverage detected