llxmltree.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. /**
  2. * @file llxmltree.cpp
  3. * @brief LLXmlTree implementation
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #include "linden_common.h"
  33. #include "llxmltree.h"
  34. #include "llcolor3.h"
  35. #include "llcolor4.h"
  36. #include "llcolor4u.h"
  37. #include "llquaternion.h"
  38. #include "llvector3.h"
  39. #include "llvector3d.h"
  40. #include "llvector4.h"
  41. ///////////////////////////////////////////////////////////////////////////////
  42. // LLXmlTree class
  43. ///////////////////////////////////////////////////////////////////////////////
  44. //static
  45. LLStdStringTable LLXmlTree::sAttributeKeys(1024);
  46. LLXmlTree::LLXmlTree()
  47. : mRoot(NULL),
  48. mNodeNames(512)
  49. {
  50. }
  51. LLXmlTree::~LLXmlTree()
  52. {
  53. cleanup();
  54. }
  55. void LLXmlTree::cleanup()
  56. {
  57. delete mRoot;
  58. mRoot = NULL;
  59. mNodeNames.cleanup();
  60. }
  61. bool LLXmlTree::parseFile(const std::string& path, bool keep_contents)
  62. {
  63. delete mRoot;
  64. mRoot = NULL;
  65. LLXmlTreeParser parser(this);
  66. bool success = parser.parseFile(path, &mRoot, keep_contents);
  67. if (!success)
  68. {
  69. S32 line_number = parser.getCurrentLineNumber();
  70. const char* error = parser.getErrorString();
  71. llwarns << "Parse file failed line " << line_number << " with error: "
  72. << error << llendl;
  73. }
  74. return success;
  75. }
  76. void LLXmlTree::dump()
  77. {
  78. if (mRoot)
  79. {
  80. dumpNode(mRoot, " ");
  81. }
  82. }
  83. void LLXmlTree::dumpNode(LLXmlTreeNode* node, const std::string& prefix)
  84. {
  85. node->dump(prefix);
  86. std::string new_prefix = prefix + " ";
  87. for (LLXmlTreeNode* child = node->getFirstChild(); child;
  88. child = node->getNextChild())
  89. {
  90. dumpNode(child, new_prefix);
  91. }
  92. }
  93. ///////////////////////////////////////////////////////////////////////////////
  94. // LLXmlTreeNode class
  95. ///////////////////////////////////////////////////////////////////////////////
  96. LLXmlTreeNode::LLXmlTreeNode(const char* name, LLXmlTreeNode* parent,
  97. LLXmlTree* tree)
  98. : mName(name),
  99. mParent(parent),
  100. mTree(tree)
  101. {
  102. }
  103. LLXmlTreeNode::~LLXmlTreeNode()
  104. {
  105. for (attribute_map_t::iterator it = mAttributes.begin(),
  106. end = mAttributes.end();
  107. it != end; ++it)
  108. {
  109. delete it->second;
  110. }
  111. for (S32 i = 0, count = mChildren.size(); i < count; ++i)
  112. {
  113. delete mChildren[i];
  114. }
  115. mChildren.clear();
  116. }
  117. void LLXmlTreeNode::dump(const std::string& prefix)
  118. {
  119. llinfos << prefix << mName;
  120. if (!mContents.empty())
  121. {
  122. llcont << " contents = \"" << mContents << "\"";
  123. }
  124. attribute_map_t::iterator iter;
  125. for (iter = mAttributes.begin(); iter != mAttributes.end(); ++iter)
  126. {
  127. LLStdStringHandle key = iter->first;
  128. const std::string* value = iter->second;
  129. llcont << prefix << " " << key << "="
  130. << (value->empty() ? "NULL" : *value);
  131. }
  132. llcont << llendl;
  133. }
  134. bool LLXmlTreeNode::hasAttribute(const std::string& name)
  135. {
  136. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  137. attribute_map_t::iterator iter = mAttributes.find(canonical_name);
  138. return iter != mAttributes.end();
  139. }
  140. void LLXmlTreeNode::addAttribute(const char* name, const std::string& value)
  141. {
  142. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  143. const std::string* newstr = new std::string(value);
  144. mAttributes[canonical_name] = newstr; // insert + copy
  145. }
  146. LLXmlTreeNode* LLXmlTreeNode::getFirstChild()
  147. {
  148. mChildrenIter = mChildren.begin();
  149. return getNextChild();
  150. }
  151. LLXmlTreeNode* LLXmlTreeNode::getNextChild()
  152. {
  153. return mChildrenIter == mChildren.end() ? 0 : *mChildrenIter++;
  154. }
  155. LLXmlTreeNode* LLXmlTreeNode::getChildByName(const std::string& name)
  156. {
  157. LLStdStringHandle tableptr = mTree->mNodeNames.checkString(name);
  158. mChildMapIter = mChildMap.lower_bound(tableptr);
  159. mChildMapEndIter = mChildMap.upper_bound(tableptr);
  160. return getNextNamedChild();
  161. }
  162. LLXmlTreeNode* LLXmlTreeNode::getNextNamedChild()
  163. {
  164. if (mChildMapIter == mChildMapEndIter)
  165. {
  166. return NULL;
  167. }
  168. else
  169. {
  170. return (mChildMapIter++)->second;
  171. }
  172. }
  173. void LLXmlTreeNode::appendContents(const std::string& str)
  174. {
  175. mContents.append(str);
  176. }
  177. void LLXmlTreeNode::addChild(LLXmlTreeNode* child)
  178. {
  179. llassert(child);
  180. mChildren.push_back(child);
  181. // Add a name mapping to this node
  182. LLStdStringHandle tableptr = mTree->mNodeNames.insert(child->mName);
  183. mChildMap.emplace(tableptr, child);
  184. child->mParent = this;
  185. }
  186. ///////////////////////////////////////////////////////////////////////////////
  187. // These functions assume that name is already in mAttritrubteKeys
  188. bool LLXmlTreeNode::getFastAttributeBool(LLStdStringHandle canonical_name,
  189. bool& value)
  190. {
  191. const std::string* s = getAttribute(canonical_name);
  192. return s && LLStringUtil::convertToBool(*s, value);
  193. }
  194. bool LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name,
  195. U8& value)
  196. {
  197. const std::string* s = getAttribute(canonical_name);
  198. return s && LLStringUtil::convertToU8(*s, value);
  199. }
  200. bool LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name,
  201. S8& value)
  202. {
  203. const std::string* s = getAttribute(canonical_name);
  204. return s && LLStringUtil::convertToS8(*s, value);
  205. }
  206. bool LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name,
  207. S16& value)
  208. {
  209. const std::string* s = getAttribute(canonical_name);
  210. return s && LLStringUtil::convertToS16(*s, value);
  211. }
  212. bool LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name,
  213. U16& value)
  214. {
  215. const std::string* s = getAttribute(canonical_name);
  216. return s && LLStringUtil::convertToU16(*s, value);
  217. }
  218. bool LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name,
  219. U32& value)
  220. {
  221. const std::string* s = getAttribute(canonical_name);
  222. return s && LLStringUtil::convertToU32(*s, value);
  223. }
  224. bool LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name,
  225. S32& value)
  226. {
  227. const std::string* s = getAttribute(canonical_name);
  228. return s && LLStringUtil::convertToS32(*s, value);
  229. }
  230. bool LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name,
  231. F32& value)
  232. {
  233. const std::string* s = getAttribute(canonical_name);
  234. return s && LLStringUtil::convertToF32(*s, value);
  235. }
  236. bool LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name,
  237. F64& value)
  238. {
  239. const std::string* s = getAttribute(canonical_name);
  240. return s && LLStringUtil::convertToF64(*s, value);
  241. }
  242. bool LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name,
  243. LLColor4& value)
  244. {
  245. const std::string* s = getAttribute(canonical_name);
  246. return s && LLColor4::parseColor(*s, &value);
  247. }
  248. bool LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name,
  249. LLColor4& value)
  250. {
  251. const std::string* s = getAttribute(canonical_name);
  252. return s && LLColor4::parseColor4(*s, &value);
  253. }
  254. bool LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name,
  255. LLColor4U& value)
  256. {
  257. const std::string* s = getAttribute(canonical_name);
  258. return s && LLColor4U::parseColor4U(*s, &value);
  259. }
  260. bool LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name,
  261. LLVector3& value)
  262. {
  263. const std::string* s = getAttribute(canonical_name);
  264. return s && LLVector3::parseVector3(*s, &value);
  265. }
  266. bool LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name,
  267. LLVector3d& value)
  268. {
  269. const std::string* s = getAttribute(canonical_name);
  270. return s && LLVector3d::parseVector3d(*s, &value);
  271. }
  272. bool LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name,
  273. LLQuaternion& value)
  274. {
  275. const std::string* s = getAttribute(canonical_name);
  276. return s && LLQuaternion::parseQuat(*s, &value);
  277. }
  278. bool LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name,
  279. LLUUID& value)
  280. {
  281. const std::string* s = getAttribute(canonical_name);
  282. return s && LLUUID::parseUUID(*s, &value);
  283. }
  284. bool LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name,
  285. std::string& value)
  286. {
  287. const std::string* s = getAttribute(canonical_name);
  288. if (s)
  289. {
  290. value = *s;
  291. return true;
  292. }
  293. else
  294. {
  295. return false;
  296. }
  297. }
  298. ///////////////////////////////////////////////////////////////////////////////
  299. bool LLXmlTreeNode::getAttributeBool(const char* name, bool& value)
  300. {
  301. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  302. return getFastAttributeBool(canonical_name, value);
  303. }
  304. bool LLXmlTreeNode::getAttributeU8(const char* name, U8& value)
  305. {
  306. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  307. return getFastAttributeU8(canonical_name, value);
  308. }
  309. bool LLXmlTreeNode::getAttributeS8(const char* name, S8& value)
  310. {
  311. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  312. return getFastAttributeS8(canonical_name, value);
  313. }
  314. bool LLXmlTreeNode::getAttributeS16(const char* name, S16& value)
  315. {
  316. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  317. return getFastAttributeS16(canonical_name, value);
  318. }
  319. bool LLXmlTreeNode::getAttributeU16(const char* name, U16& value)
  320. {
  321. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  322. return getFastAttributeU16(canonical_name, value);
  323. }
  324. bool LLXmlTreeNode::getAttributeU32(const char* name, U32& value)
  325. {
  326. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  327. return getFastAttributeU32(canonical_name, value);
  328. }
  329. bool LLXmlTreeNode::getAttributeS32(const char* name, S32& value)
  330. {
  331. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  332. return getFastAttributeS32(canonical_name, value);
  333. }
  334. bool LLXmlTreeNode::getAttributeF32(const char* name, F32& value)
  335. {
  336. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  337. return getFastAttributeF32(canonical_name, value);
  338. }
  339. bool LLXmlTreeNode::getAttributeF64(const char* name, F64& value)
  340. {
  341. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  342. return getFastAttributeF64(canonical_name, value);
  343. }
  344. bool LLXmlTreeNode::getAttributeColor(const char* name, LLColor4& value)
  345. {
  346. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  347. return getFastAttributeColor(canonical_name, value);
  348. }
  349. bool LLXmlTreeNode::getAttributeColor4(const char* name, LLColor4& value)
  350. {
  351. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  352. return getFastAttributeColor4(canonical_name, value);
  353. }
  354. bool LLXmlTreeNode::getAttributeColor4U(const char* name, LLColor4U& value)
  355. {
  356. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  357. return getFastAttributeColor4U(canonical_name, value);
  358. }
  359. bool LLXmlTreeNode::getAttributeVector3(const char* name, LLVector3& value)
  360. {
  361. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  362. return getFastAttributeVector3(canonical_name, value);
  363. }
  364. bool LLXmlTreeNode::getAttributeVector3d(const char* name, LLVector3d& value)
  365. {
  366. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  367. return getFastAttributeVector3d(canonical_name, value);
  368. }
  369. bool LLXmlTreeNode::getAttributeQuat(const char* name, LLQuaternion& value)
  370. {
  371. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  372. return getFastAttributeQuat(canonical_name, value);
  373. }
  374. bool LLXmlTreeNode::getAttributeUUID(const char* name, LLUUID& value)
  375. {
  376. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  377. return getFastAttributeUUID(canonical_name, value);
  378. }
  379. bool LLXmlTreeNode::getAttributeString(const char* name, std::string& value)
  380. {
  381. LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
  382. return getFastAttributeString(canonical_name, value);
  383. }
  384. // The following xml <message> nodes will all return the string from
  385. // getTextContents():
  386. // "The quick brown fox\n Jumps over the lazy dog"
  387. //
  388. // 1. HTML paragraph format:
  389. // <message>
  390. // <p>The quick brown fox</p>
  391. // <p> Jumps over the lazy dog</p>
  392. // </message>
  393. // 2. Each quoted section -> paragraph:
  394. // <message>
  395. // "The quick brown fox"
  396. // " Jumps over the lazy dog"
  397. // </message>
  398. // 3. Literal text with beginning and trailing whitespace removed:
  399. // <message>
  400. // The quick brown fox
  401. // Jumps over the lazy dog
  402. // </message>
  403. std::string LLXmlTreeNode::getTextContents()
  404. {
  405. std::string msg;
  406. LLXmlTreeNode* p = getChildByName("p");
  407. if (p)
  408. {
  409. // Case 1: node has <p>text</p> tags
  410. while (p)
  411. {
  412. msg += p->getContents() + "\n";
  413. p = getNextNamedChild();
  414. }
  415. }
  416. else
  417. {
  418. std::string::size_type n = mContents.find_first_not_of(" \t\n");
  419. if (n != std::string::npos && mContents[n] == '\"')
  420. {
  421. // Case 2: node has quoted text
  422. S32 num_lines = 0;
  423. while (true)
  424. {
  425. // mContents[n] == '"'
  426. std::string::size_type t = ++n;
  427. std::string::size_type m = 0;
  428. // fix-up escaped characters
  429. while (true)
  430. {
  431. // Find first of \ or "
  432. m = mContents.find_first_of("\\\"", t);
  433. if (m == std::string::npos || mContents[m] == '\"')
  434. {
  435. break;
  436. }
  437. mContents.erase(m, 1);
  438. t = m + 1;
  439. }
  440. if (m == std::string::npos)
  441. {
  442. break;
  443. }
  444. // mContents[m] == '"'
  445. ++num_lines;
  446. msg += mContents.substr(n, m - n) + "\n";
  447. n = mContents.find_first_of("\"", m + 1);
  448. if (n == std::string::npos)
  449. {
  450. if (num_lines == 1)
  451. {
  452. // Remove "\n" if only 1 line
  453. msg.erase(msg.size() - 1);
  454. }
  455. break;
  456. }
  457. }
  458. }
  459. else
  460. {
  461. // Case 3: node has embedded text (beginning and trailing
  462. // whitespace trimmed)
  463. msg = mContents;
  464. }
  465. }
  466. return msg;
  467. }
  468. ///////////////////////////////////////////////////////////////////////////////
  469. // LLXmlTreeParser class
  470. ///////////////////////////////////////////////////////////////////////////////
  471. LLXmlTreeParser::LLXmlTreeParser(LLXmlTree* tree)
  472. : mTree(tree),
  473. mRoot(NULL),
  474. mCurrent(NULL),
  475. mDump(false),
  476. mKeepContents(false)
  477. {
  478. }
  479. bool LLXmlTreeParser::parseFile(const std::string& path, LLXmlTreeNode** root,
  480. bool keep_contents)
  481. {
  482. llassert(!mRoot);
  483. llassert(!mCurrent);
  484. mKeepContents = keep_contents;
  485. bool success = LLXmlParser::parseFile(path);
  486. *root = mRoot;
  487. mRoot = NULL;
  488. if (success && mCurrent)
  489. {
  490. llwarns << "mCurrent not null after parsing: " << path << llendl;
  491. llassert(false);
  492. }
  493. mCurrent = NULL;
  494. return success;
  495. }
  496. const std::string& LLXmlTreeParser::tabs()
  497. {
  498. static std::string s;
  499. s.clear();
  500. S32 num_tabs = getDepth() - 1;
  501. for (S32 i = 0; i < num_tabs; ++i)
  502. {
  503. s += " ";
  504. }
  505. return s;
  506. }
  507. void LLXmlTreeParser::startElement(const char* name, const char** atts)
  508. {
  509. if (mDump)
  510. {
  511. llinfos << tabs() << "startElement " << name << llendl;
  512. for (S32 i = 0; atts[i] && atts[i + 1]; i += 2)
  513. {
  514. llinfos << tabs() << "attribute: " << atts[i] << "="
  515. << atts[i + 1] << llendl;
  516. }
  517. }
  518. LLXmlTreeNode* child = createXmlTreeNode(name, mCurrent);
  519. for (S32 i = 0; atts[i] && atts[i + 1]; i += 2)
  520. {
  521. child->addAttribute(atts[i], atts[i + 1]);
  522. }
  523. if (mCurrent)
  524. {
  525. mCurrent->addChild(child);
  526. }
  527. else
  528. {
  529. llassert(!mRoot);
  530. mRoot = child;
  531. }
  532. mCurrent = child;
  533. }
  534. LLXmlTreeNode* LLXmlTreeParser::createXmlTreeNode(const char* name,
  535. LLXmlTreeNode* parent)
  536. {
  537. return new LLXmlTreeNode(name, parent, mTree);
  538. }
  539. void LLXmlTreeParser::endElement(const char* name)
  540. {
  541. if (mDump)
  542. {
  543. llinfos << tabs() << "endElement " << name << llendl;
  544. }
  545. if (mCurrent && !mCurrent->mContents.empty())
  546. {
  547. LLStringUtil::trim(mCurrent->mContents);
  548. LLStringUtil::removeCRLF(mCurrent->mContents);
  549. }
  550. mCurrent = mCurrent->getParent();
  551. }
  552. void LLXmlTreeParser::characterData(const char* s, int len)
  553. {
  554. std::string str;
  555. if (s)
  556. {
  557. str = std::string(s, len);
  558. }
  559. if (mDump)
  560. {
  561. llinfos << tabs() << "CharacterData " << str << llendl;
  562. }
  563. if (mKeepContents)
  564. {
  565. mCurrent->appendContents(str);
  566. }
  567. }
  568. void LLXmlTreeParser::processingInstruction(const char* target,
  569. const char* data)
  570. {
  571. if (mDump)
  572. {
  573. llinfos << tabs() << "processingInstruction " << data << llendl;
  574. }
  575. }
  576. void LLXmlTreeParser::comment(const char* data)
  577. {
  578. if (mDump)
  579. {
  580. llinfos << tabs() << "comment " << data << llendl;
  581. }
  582. }
  583. void LLXmlTreeParser::startCdataSection()
  584. {
  585. if (mDump)
  586. {
  587. llinfos << tabs() << "startCdataSection" << llendl;
  588. }
  589. }
  590. void LLXmlTreeParser::endCdataSection()
  591. {
  592. if (mDump)
  593. {
  594. llinfos << tabs() << "endCdataSection" << llendl;
  595. }
  596. }
  597. void LLXmlTreeParser::defaultData(const char* s, int len)
  598. {
  599. if (mDump)
  600. {
  601. std::string str;
  602. if (s)
  603. {
  604. str = std::string(s, len);
  605. }
  606. llinfos << tabs() << "defaultData " << str << llendl;
  607. }
  608. }
  609. void LLXmlTreeParser::unparsedEntityDecl(const char* entity_name,
  610. const char* base,
  611. const char* system_id,
  612. const char* public_id,
  613. const char* notation_name)
  614. {
  615. if (mDump)
  616. {
  617. llinfos << tabs() << "Unparsed entity:" << llendl;
  618. llinfos << tabs() << " entityName " << entity_name << llendl;
  619. llinfos << tabs() << " base " << base << llendl;
  620. llinfos << tabs() << " systemId " << system_id << llendl;
  621. llinfos << tabs() << " publicId " << public_id << llendl;
  622. llinfos << tabs() << " notationName " << notation_name << llendl;
  623. }
  624. }