Changeset 32565 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Sep 16, 2010 2:39:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/xml.cpp
r30746 r32565 1340 1340 //////////////////////////////////////////////////////////////////////////////// 1341 1341 // 1342 // XmlMemParser class 1343 // 1344 //////////////////////////////////////////////////////////////////////////////// 1345 1346 XmlMemParser::XmlMemParser() 1347 : XmlParserBase() 1348 { 1349 } 1350 1351 XmlMemParser::~XmlMemParser() 1352 { 1353 } 1354 1355 /** 1356 * Parse the given buffer and fills the given Document object with its contents. 1357 * Throws XmlError on parsing errors. 1358 * 1359 * The document that is passed in will be reset before being filled if not empty. 1360 * 1361 * @param pvBuf in: memory buffer to parse. 1362 * @param cbSize in: size of the memory buffer. 1363 * @param strFilename in: name fo file to parse. 1364 * @param doc out: document to be reset and filled with data according to file contents. 1365 */ 1366 void XmlMemParser::read(const void* pvBuf, int cbSize, 1367 const iprt::MiniString &strFilename, 1368 Document &doc) 1369 { 1370 GlobalLock lock; 1371 // global.setExternalEntityLoader(ExternalEntityLoader); 1372 1373 const char *pcszFilename = strFilename.c_str(); 1374 1375 doc.m->reset(); 1376 if (!(doc.m->plibDocument = xmlCtxtReadMemory(m_ctxt, 1377 (const char*)pvBuf, 1378 cbSize, 1379 pcszFilename, 1380 NULL, // encoding = auto 1381 XML_PARSE_NOBLANKS))) 1382 throw XmlError(xmlCtxtGetLastError(m_ctxt)); 1383 1384 doc.refreshInternals(); 1385 } 1386 1387 //////////////////////////////////////////////////////////////////////////////// 1388 // 1342 1389 // XmlFileParser class 1343 1390 // … … 1346 1393 struct XmlFileParser::Data 1347 1394 { 1348 xmlParserCtxtPtr ctxt;1349 1395 iprt::MiniString strXmlFilename; 1350 1396 1351 1397 Data() 1352 1398 { 1353 if (!(ctxt = xmlNewParserCtxt()))1354 throw std::bad_alloc();1355 1399 } 1356 1400 1357 1401 ~Data() 1358 1402 { 1359 xmlFreeParserCtxt(ctxt);1360 ctxt = NULL;1361 1403 } 1362 1404 }; … … 1431 1473 ReadContext context(pcszFilename); 1432 1474 doc.m->reset(); 1433 if (!(doc.m->plibDocument = xmlCtxtReadIO(m ->ctxt,1475 if (!(doc.m->plibDocument = xmlCtxtReadIO(m_ctxt, 1434 1476 ReadCallback, 1435 1477 CloseCallback, … … 1438 1480 NULL, // encoding = auto 1439 1481 XML_PARSE_NOBLANKS))) 1440 throw XmlError(xmlCtxtGetLastError(m ->ctxt));1482 throw XmlError(xmlCtxtGetLastError(m_ctxt)); 1441 1483 1442 1484 doc.refreshInternals();
Note:
See TracChangeset
for help on using the changeset viewer.