Logo
Reference manual - version ored_version
Static Public Member Functions | List of all members
XMLUtils Class Reference

XML Utilities Class. More...

#include <ored/utilities/xmlutils.hpp>

Static Public Member Functions

static void checkNode (XMLNode *n, const string &expectedName)
 
static XMLNodeaddChild (XMLDocument &doc, XMLNode *n, const string &name)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const string &value)
 
static void addChildAsCdata (XMLDocument &doc, XMLNode *n, const string &name, const string &value)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const string &value, const string &attrName, const string &attr)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const string &value, const vector< string > &attrNames, const vector< string > &attrs)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const char *value)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, Real value)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, int value)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, bool value)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const Period &value)
 
template<class T >
static void addGenericChild (XMLDocument &doc, XMLNode *n, const char *name, const T &value)
 Adds <Name>p1,p2,p3</Name>
 
template<class T >
static void addGenericChildAsList (XMLDocument &doc, XMLNode *n, const string &name, const vector< T > &values, const string &attrName="", const string &attr="")
 
template<class T = string>
static void addChildren (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
 
static void addChild (XMLDocument &doc, XMLNode *n, const string &name, const vector< Real > &values)
 Adds <Name>v1,v2,v3</Name> - the inverse of getChildrenValuesAsDoublesCompact.
 
template<class T = string>
static void addChildrenWithAttributes (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
 
template<class T = string>
static void addChildrenWithAttributes (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const vector< string > &attrNames, const vector< vector< string >> &attrs)
 
template<class T = string>
static void addChildrenWithOptionalAttributes (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
 
template<class T = string>
static void addChildrenWithOptionalAttributes (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const vector< string > &attrNames, const vector< vector< string >> &attrs)
 
static void addChildren (XMLDocument &doc, XMLNode *n, const string &names, const string &name, const string &firstName, const string &secondName, const map< string, string > &values)
 
static string getChildValue (XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
 
static Real getChildValueAsDouble (XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
 
static int getChildValueAsInt (XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
 
static bool getChildValueAsBool (XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
 
static Period getChildValueAsPeriod (XMLNode *node, const string &name, bool mandatory=false, const QuantLib::Period &defaultValue=0 *QuantLib::Days)
 
static vector< string > getChildrenValues (XMLNode *node, const string &names, const string &name, bool mandatory=false)
 
static vector< string > getChildrenValuesWithAttributes (XMLNode *node, const string &names, const string &name, const string &attrName, vector< string > &attrs, bool mandatory=false)
 
static vector< string > getChildrenValuesWithAttributes (XMLNode *node, const string &names, const string &name, const vector< string > &attrNames, const vector< std::reference_wrapper< vector< string >>> &attrs, bool mandatory=false)
 
template<class T >
static vector< T > getChildrenValuesWithAttributes (XMLNode *node, const string &names, const string &name, const string &attrName, vector< string > &attrs, const std::function< T(string)> parser, bool mandatory=false)
 
template<class T >
static vector< T > getChildrenValuesWithAttributes (XMLNode *node, const string &names, const string &name, const vector< string > &attrNames, const vector< std::reference_wrapper< vector< string >>> &attrs, const std::function< T(string)> parser, bool mandatory=false)
 
static vector< Real > getChildrenValuesAsDoubles (XMLNode *node, const string &names, const string &name, bool mandatory=false)
 
static vector< Real > getChildrenValuesAsDoublesCompact (XMLNode *node, const string &name, bool mandatory=false)
 
static vector< Period > getChildrenValuesAsPeriods (XMLNode *node, const string &name, bool mandatory=false)
 
static vector< string > getChildrenValuesAsStrings (XMLNode *node, const string &name, bool mandatory=false)
 
static map< string, string > getChildrenValues (XMLNode *node, const string &names, const string &name, const string &firstName, const string &secondName, bool mandatory=false)
 
static map< string, string > getChildrenAttributesAndValues (XMLNode *parent, const string &names, const string &attributeName, bool mandatory=false)
 
static XMLNodegetChildNode (XMLNode *n, const string &name="")
 
static XMLNodelocateNode (XMLNode *n, const string &name="")
 
static void appendNode (XMLNode *parent, XMLNode *child)
 
static void addAttribute (XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
 
static string getAttribute (XMLNode *node, const string &attrName)
 
static vector< XMLNode * > getChildrenNodes (XMLNode *node, const string &name)
 Returns all the children with a given name.
 
static vector< XMLNode * > getChildrenNodesWithAttributes (XMLNode *node, const string &names, const string &name, const string &attrName, vector< string > &attrs, bool mandatory=false)
 
static vector< XMLNode * > getChildrenNodesWithAttributes (XMLNode *node, const string &names, const string &name, const vector< string > &attrNames, const vector< std::reference_wrapper< vector< string >>> &attrs, bool mandatory=false)
 
static string getNodeName (XMLNode *n)
 Get and set a node's name.
 
static void setNodeName (XMLDocument &doc, XMLNode *node, const string &name)
 
static XMLNodegetNextSibling (XMLNode *node, const string &name="")
 Get a node's next sibling node.
 
static string getNodeValue (XMLNode *node)
 Get a node's value.
 
static vector< Real > getNodeValueAsDoublesCompact (XMLNode *node)
 Get a node's compact values as vector of doubles.
 
static string toString (XMLNode *node)
 Write a node out as a string.
 

Detailed Description

XML Utilities Class.