15 #pragma warning(disable : 4251)
61 XmlNode(
const string &tag,
const map<string, string> &attrs,
size_t numChildrenHint = 0);
62 XmlNode(
const string &tag,
size_t numChildrenHint = 0);
65 virtual XmlNode *
Construct(
const string &tag,
const map<string, string> &attrs,
size_t numChildrenHint = 0) {
return (
new XmlNode(tag, attrs, numChildrenHint)); }
91 string &
Tag() {
return (_tag); }
93 string GetTag()
const {
return (_tag); }
95 void SetTag(
string tag) { _tag = tag; }
101 map<string, string> &
Attrs() {
return (_attrmap); }
122 virtual void SetElementLong(
const vector<string> &tags,
const vector<long> &values);
125 vector<long> values(1, value);
126 XmlNode::SetElementLong(tags, values);
143 vector<long> values(1, value);
144 XmlNode::SetElementLong(tag, values);
180 vector<double> values(1, value);
181 XmlNode::SetElementDouble(tag, values);
198 vector<double> values(1, value);
199 XmlNode::SetElementDouble(tags, values);
334 virtual XmlNode *
NewChild(
const string &tag,
const map<string, string> &attrs,
size_t numChildrenHint = 0);
338 map<string, string> attrs;
339 return (NewChild(tag, attrs, numChildrenHint));
360#ifdef VAPOR3_0_0_ALPHA
474 virtual bool IsRoot()
const {
return (GetParent() == NULL); }
508 static vector<long> _emptyLongVec;
509 static vector<double> _emptyDoubleVec;
510 static vector<string> _emptyStringVec;
511 static string _emptyString;
513 static std::vector<XmlNode *> _allocatedNodes;
515 map<string, vector<long>> _longmap;
516 map<string, vector<double>> _doublemap;
517 map<string, string> _stringmap;
518 map<string, string> _attrmap;
520 vector<XmlNode *> _children;
537 enum type { UNKNOWN, PARENT, LONG_DATA, DOUBLE_DATA, STRING_DATA };
541 std::stack<XmlNode *> _nodeStack;
544 void _startElementHandler(
string tag, map<string, string> &myattrs);
545 void _endElementHandler(
string tag);
546 void _charDataHandler(
string s);
548 bool _isParentElement(
string tag, map<string, string> myattrs)
const;
549 bool _isDataElement(
string tag, map<string, string> myattrs, type &dtype)
const;
virtual XmlNode * GetChild(size_t index) const
virtual void SetElementLong(const vector< string > &tags, long value)
virtual void SetElementDouble(const vector< string > &tags, double value)
virtual void SetElementDouble(const string &tag, const vector< double > &values)
XmlNode & operator=(const XmlNode &rhs)
Assignment operator.
virtual std::vector< string > GetPathVec() const
virtual void SetElementDouble(const string &tag, double value)
static bool IsValidXMLElement(const string &s, int *badIdx=nullptr)
virtual XmlNode * GetRoot() const
static const std::vector< XmlNode * > & GetAllocatedNodes()
virtual const vector< long > & GetElementLong(const string &tag) const
bool operator==(const XmlNode &rhs) const
Equivalence operator.
virtual XmlNode * Construct(const string &tag, const map< string, string > &attrs, size_t numChildrenHint=0)
virtual bool HasChild(const string &tag) const
virtual const string & GetElementString(const string &tag) const
virtual bool HasElementDouble(const string &tag) const
virtual XmlNode * Clone()
virtual int DeleteChild(size_t index)
XmlNode(const string &tag, const map< string, string > &attrs, size_t numChildrenHint=0)
static ostream & streamOut(ostream &os, const XmlNode &node)
virtual XmlNode * GetNode(std::vector< string > path, bool absolute) const
XmlNode(const string &tag, size_t numChildrenHint=0)
XmlNode * AddChild(const XmlNode *child)
virtual bool HasChild(size_t index) const
virtual XmlNode * NewChild(const string &tag, const map< string, string > &attrs, size_t numChildrenHint=0)
virtual void SetElementLong(const string &tag, const vector< long > &values)
virtual XmlNode * GetParent() const
virtual XmlNode * NewChild(const string &tag, size_t numChildrenHint=0)
virtual void GetElementStringVec(const string &tag, vector< string > &vec) const
virtual bool HasElementString(const string &tag) const
virtual void SetElementLong(const string &tag, long value)
static string SanitizeXMLTag(string s)
virtual XmlNode * GetChild(const string &tag) const
map< string, string > & Attrs()
XmlNode(const XmlNode &node)
void SetParent(XmlNode *parent)
virtual void SetElementLong(const vector< string > &tags, const vector< long > &values)
virtual const vector< double > & GetElementDouble(const string &tag) const
virtual bool IsRoot() const
virtual bool HasElementLong(const string &tag) const
XmlNode * AddChild(const XmlNode &child)
bool operator!=(const XmlNode &rhs) const
virtual int GetNumChildren() const
virtual string GetPath() const
friend ostream & operator<<(ostream &s, const XmlNode &node)
Write the XML tree, rooted at this node, to a file in XML format.
virtual void SetElementStringVec(const string &tag, const vector< string > &values)
virtual void SetElementStringVec(const vector< string > &tagpath, const vector< string > &values)
virtual int DeleteChild(const string &tag)
virtual void SetElementDouble(const vector< string > &tags, const vector< double > &values)
virtual XmlNode * GetNode(string path) const
virtual void SetElementString(const string &tag, const string &values)
int LoadFromFile(XmlNode *root, istream &in)
friend void _EndElementHandler(void *userData, const char *tag)
int LoadFromFile(XmlNode *root, string path)
friend void _StartElementHandler(void *userData, const char *tag, const char **attrs)
friend void _CharDataHandler(void *userData, const char *s, int len)