67 void parseTag(
const std::string& tag, std::string& name,
68 std::map<std::string, std::string>& attribs)
const;
77 std::string
readTag(std::map<std::string, std::string>& attribs);
156 XML_Node& addChild(
const std::string& sname);
187 const std::string&
fmt=
"%g");
212 void addValue(
const std::string& val);
223 void addValue(
const doublereal val,
const std::string&
fmt=
"%g");
229 std::string
value()
const;
236 std::string
value(
const std::string& cname)
const;
244 std::string
operator()(
const std::string& cname)
const;
281 const std::string&
fmt=
"%g");
311 std::string
operator[](
const std::string& attr)
const;
323 std::string
attrib(
const std::string& attr)
const;
331 std::map<std::string,std::string>&
attribs();
335 const std::map<std::string,std::string>&
attribsConst()
const;
361 bool hasChild(
const std::string& ch)
const;
368 bool hasAttrib(
const std::string& a)
const;
387 std::string
id()
const;
400 const std::vector<XML_Node*>&
children()
const;
407 size_t nChildren(
bool discardComments =
false)
const;
421 void _require(
const std::string& a,
const std::string& v)
const;
442 const std::string& idTarget)
const;
462 const std::string& idTarget,
const int index)
const;
478 XML_Node*
findID(
const std::string&
id,
const int depth=100)
const;
494 int depth = 100000)
const;
558 void write(std::ostream& s,
const int level = 0,
int numRecursivesAllowed = 60000)
const;
573 void build(
const std::string& filename);
584 void build(std::istream& f,
const std::string& filename=
"[unknown]");
624 void write_int(std::ostream& s,
int level = 0,
int numRecursivesAllowed = 60000)
const;
Class XML_Node is a tree-based representation of the contents of an XML file.
void removeChild(const XML_Node *const node)
Remove a child from this node's list of children.
std::map< std::string, std::string > m_attribs
Storage of attributes for a node.
XML_Node * findByAttr(const std::string &attr, const std::string &val, int depth=100000) const
This routine carries out a recursive search for an XML node based on an attribute of each XML node.
void setName(const std::string &name_)
Sets the name of the XML node.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
XML_Node(const std::string &nm="--", XML_Node *const parent=0)
Constructor for XML_Node, representing a tree structure.
void copy(XML_Node *const node_dest) const
Copy all of the information in the current XML_Node tree into the destination XML_Node tree,...
std::string name() const
Returns the name of the XML node.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
int lineNumber() const
Return the line number.
void build(const std::string &filename)
Populate the XML tree from an input file.
std::string operator()(const std::string &cname) const
The Overloaded parenthesis operator with one augment returns the value of an XML child node as a stri...
XML_Node * m_root
Pointer to the root XML_Node for the current node.
XML_Node & mergeAsChild(XML_Node &node)
Merge an existing node as a child node to the current node.
void write_int(std::ostream &s, int level=0, int numRecursivesAllowed=60000) const
Write an XML subtree to an output stream.
std::string id() const
Return the id attribute, if present.
XML_Node & root() const
Return the root of the current XML_Node tree.
void addValue(const std::string &val)
Modify the value for the current node.
std::map< std::string, std::string > & attribs()
Returns a changeable value of the attributes map for the current node.
int m_linenum
The member data m_linenum.
XML_Node * m_parent
Pointer to the parent XML_Node for the current node.
void addAttribute(const std::string &attrib, const std::string &value)
Add or modify an attribute of the current node.
bool m_locked
Lock for this node.
void copyUnion(XML_Node *const node_dest) const
Copy all of the information in the current XML_Node tree into the destination XML_Node tree,...
bool m_iscomment
True if the current node is a comment node.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node.
integer int_value() const
Return the value of an XML node as a single int.
void unlock()
Unset the lock for this node and all of its children.
void write(std::ostream &s, const int level=0, int numRecursivesAllowed=60000) const
Write an XML subtree to an output stream.
void _require(const std::string &a, const std::string &v) const
Require that the current XML node has an attribute named by the first argument, a,...
doublereal fp_value() const
Return the value of an XML node as a single double.
void writeHeader(std::ostream &s)
Write the header to the XML file to the specified ostream.
void lock()
Set the lock for this node and all of its children.
XML_Node * findID(const std::string &id, const int depth=100) const
This routine carries out a recursive search for an XML node based on the XML element attribute "id".
std::multimap< std::string, XML_Node * > m_childindex
Map containing an index between the node name and the pointer to the node.
const std::vector< XML_Node * > & children() const
Return an unchangeable reference to the vector of children of the current node.
XML_Node * findNameIDIndex(const std::string &nameTarget, const std::string &idTarget, const int index) const
This routine carries out a search for an XML node based on the XML element name, the attribute ID and...
void setLineNumber(const int n)
Set the line number.
XML_Node * parent() const
Returns a pointer to the parent node of the current node.
std::string m_filename
Name of the file from which this XML node was read.
void clear()
Clear the current node and everything under it.
void addComment(const std::string &comment)
Add a child node to the current node containing a comment.
const std::map< std::string, std::string > & attribsConst() const
Returns an unchangeable value of the attributes map for the current node.
std::vector< XML_Node * > getChildren(const std::string &name) const
Get a vector of pointers to XML_Node containing all of the children of the current node which match t...
std::string value() const
Return the value of an XML node as a string.
XML_Node * findNameID(const std::string &nameTarget, const std::string &idTarget) const
This routine carries out a recursive search for an XML node based on both the XML element name and th...
std::string operator[](const std::string &attr) const
The operator[] is overloaded to provide a lookup capability on attributes for the current XML element...
std::string m_value
Value of the XML node.
size_t nChildren(bool discardComments=false) const
Return the number of children.
XML_Node * setParent(XML_Node *const p)
Sets the pointer for the parent node of the current node.
std::string m_name
XML node name of the node.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
void setRoot(const XML_Node &root)
Set the root XML_Node value within the current node.
std::vector< XML_Node * > m_children
Vector of pointers to child nodes.
bool isComment() const
Boolean function indicating whether a comment.
bool hasAttrib(const std::string &a) const
Tests whether the current node has an attribute with a particular name.
Class XML_Reader reads an XML file into an XML_Node object.
std::string readTag(std::map< std::string, std::string > &attribs)
Reads an XML tag into a string.
void getchr(char &ch)
Read a single character from the input stream and returns it.
int findQuotedString(const std::string &aline, std::string &rstring) const
Searches a string for the first occurrence of a valid quoted string.
void parseTag(const std::string &tag, std::string &name, std::map< std::string, std::string > &attribs) const
parseTag parses XML tags, i.e., the XML elements that are in between angle brackets.
XML_Reader(std::istream &input)
Sole Constructor for the XML_Reader class.
std::istream & m_s
Input stream containing the XML file.
std::string readValue()
Return the value portion of an XML element.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
XML_Node * findXMLPhase(XML_Node *root, const std::string &phaseId)
Search an XML_Node tree for a named phase XML_Node.
Versions 6.2.0 and 6.2.1 of fmtlib do not include this define before they include windows....