summaryrefslogtreecommitdiff
path: root/indra/llxml/llxmltree.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-05-22 09:30:04 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-05-22 09:30:04 -0400
commiteb81d5f23fc725f53857d7a62923e273a057c455 (patch)
tree5c1ba76e722d9630fa597023a1e6c196a04f758c /indra/llxml/llxmltree.cpp
parentf8ccb39b8d944f9d2bf4308f909273cd5a35cbe7 (diff)
parent47985e5822ce9fdebb7443e13b3c1a781a842ecd (diff)
Merge remote-tracking branch 'DRTVWR-600-maint-A' into nat/kwds
Diffstat (limited to 'indra/llxml/llxmltree.cpp')
-rw-r--r--indra/llxml/llxmltree.cpp51
1 files changed, 6 insertions, 45 deletions
diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp
index 38321847c3..a9c702f552 100644
--- a/indra/llxml/llxmltree.cpp
+++ b/indra/llxml/llxmltree.cpp
@@ -35,7 +35,6 @@
#include "v4math.h"
#include "llquaternion.h"
#include "lluuid.h"
-#include "lldir.h"
//////////////////////////////////////////////////////////////
// LLXmlTree
@@ -61,37 +60,20 @@ void LLXmlTree::cleanup()
mNodeNames.cleanup();
}
-bool LLXmlTree::parseFile(const std::string & filename, bool keep_contents)
-{
- delete mRoot;
- mRoot = NULL;
-
- std::string xml = gDirUtilp->getFileContents(filename);
- if (xml.empty())
- {
- LL_WARNS() << "LLXmlTree parse failed. No XML file: " << filename << LL_ENDL;
- return false;
- }
-
- bool success = parseString(xml, keep_contents);
- return success;
-}
-
-bool LLXmlTree::parseString(const std::string &xml, bool keep_contents)
+bool LLXmlTree::parseFile(const std::string &path, bool keep_contents)
{
delete mRoot;
mRoot = NULL;
LLXmlTreeParser parser(this);
- bool success = parser.parseString(xml, &mRoot, keep_contents);
- if (!success)
+ bool success = parser.parseFile( path, &mRoot, keep_contents );
+ if( !success )
{
S32 line_number = parser.getCurrentLineNumber();
const char* error = parser.getErrorString();
LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL;
}
-
return success;
}
@@ -155,14 +137,14 @@ void LLXmlTreeNode::dump( const std::string& prefix )
bool LLXmlTreeNode::hasAttribute(const std::string& name)
{
- LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
+ LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
attribute_map_t::iterator iter = mAttributes.find(canonical_name);
- return (iter == mAttributes.end()) ? false : true;
+ return iter != mAttributes.end();
}
void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value)
{
- LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
+ LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name);
const std::string *newstr = new std::string(value);
mAttributes[canonical_name] = newstr; // insert + copy
}
@@ -554,27 +536,6 @@ bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, b
return success;
}
-bool LLXmlTreeParser::parseString(const std::string& xml, LLXmlTreeNode** root, bool keep_contents)
-{
- llassert( !mRoot );
- llassert( !mCurrent );
-
- mKeepContents = keep_contents;
-
- bool success = LLXmlParser::parse(xml.data(), (int)xml.size(), true);
-
- *root = mRoot;
- mRoot = NULL;
-
- if (success)
- {
- llassert(!mCurrent);
- }
-
- mCurrent = NULL;
-
- return success;
-}
const std::string& LLXmlTreeParser::tabs()
{