QMCPACK
XMLParsingString.cpp File Reference
+ Include dependency graph for XMLParsingString.cpp:

Go to the source code of this file.

Functions

std::string getXMLAttributeValue (const xmlNodePtr cur, const std::string_view name)
 get the value string for attribute name if name is unfound in cur you get an empty string back this is the same behavior XMLAttrString provides. More...
 

Function Documentation

◆ getXMLAttributeValue()

std::string getXMLAttributeValue ( const xmlNodePtr  cur,
const std::string_view  name 
)

get the value string for attribute name if name is unfound in cur you get an empty string back this is the same behavior XMLAttrString provides.

Without the complication of a composite type you don't need.

Definition at line 19 of file XMLParsingString.cpp.

References castCharToXMLChar(), and castXMLCharToChar().

Referenced by ECPComponentBuilder::addSemiLocal(), HamiltonianFactory::build(), eeI_JastrowBuilder::buildComponent(), ECPComponentBuilder::buildLocal(), AOBasisBuilder< COT >::createAOSet(), RadialJastrowBuilder::createJ1(), RadialJastrowBuilder::createJ2(), SlaterDetBuilder::createMSDFast(), QMCDriverFactory::createQMCDriver(), CompositeSPOSetBuilder::createSPOSetFromXML(), qmcplusplus::extractCoefficientsID(), PWOrbitalSetBuilder::getH5(), QMCDriver::getQMCNode(), LCAOrbitalBuilder::LCAOrbitalBuilder(), ECPComponentBuilder::parse(), QMCFixedSampleLinearOptimizeBatched::process(), HybridEngine::processXML(), LatticeParser::put(), SpinDensity::put(), ParameterSet::put(), ECPComponentBuilder::put(), QMCFixedSampleLinearOptimize::put(), ProjectData::put(), RadialOrbitalSetBuilder< SoaAtomicBasisSet< MultiFunctorAdapter< FN >, SH > >::put(), OrbitalImages::put(), GaussianTimesRN< T >::putBasisGroup(), LCAOrbitalBuilder::putOccupation(), WFOptDriverInput::readXML(), SpinDensityInput::readXML(), EstimatorManagerInput::readXML(), XMLParticleParser::readXML(), InputSection::readXML(), DensityMatrices1B::set_state(), qmcplusplus::TEST_CASE(), TEST_CASE(), QMCCostFunctionBase::updateXmlNodes(), and QMCMain::validateXML().

20 {
21  std::string attr_value;
22  xmlChar* attr_char = xmlGetProp(cur, castCharToXMLChar(name.data()));
23  if (attr_char)
24  {
25  attr_value.assign(castXMLCharToChar(attr_char));
26  xmlFree(attr_char);
27  }
28  return attr_value;
29 }
char * castXMLCharToChar(xmlChar *c)
assign a value from a node. Use specialization for classes.
Definition: libxmldefs.h:62
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70