Esempio n. 1
0
/**
 * Generates new Values in the ValueManager for configuration parameters in the configuration 
 * file if they do not exist or change their value if they exist. 
 *
 * @return TRUE if the load process was successfully, otherwhise FALSE.
 */
bool XMLConfigLoader::loadFromXML() 
{ 
  QDomElement descrStartElem  = mConfigDescrFile->getDocumentElement().firstChildElement();
  QDomElement configStartElem = mConfigFile->getDocumentElement();
  
  if(descrStartElem.isNull()){
    Core::log( "XMLConfigLoader: ERROR - In file config description file [" + mConfigDescrFile->getFileName() + "]. " +
        "No elements found!" ); 
    return false;
  }
    
  if(configStartElem.isNull()){
    Core::log( "XMLConfigLoader: ERROR - In file config file [" + mConfigFile->getFileName() + 
        "]. " + "No elements found!" ); 
    return false;
  }
  
  QString orcsPath = "";
  
  return loadElement(descrStartElem, configStartElem, orcsPath, true);
}
Esempio n. 2
0
bool CAnm2DXml::load(const QDomDocument &xml)
{
	if ( xml.doctype().name() != kAnmXML_ID_Anm2D ) {
		return false ;
	}

	QDomElement root = xml.documentElement() ;
	if ( root.isNull() ) {
		return false ;
	}
	if ( root.nodeName() != kAnmXML_ID_Root ) {
		return false ;
	}

	QDomNamedNodeMap nodeMap = root.attributes() ;
	if ( nodeMap.isEmpty() ) {
		return false ;
	}
	if ( nodeMap.namedItem(kAnmXML_Attr_Version).isNull() ) {
		return false ;
	}
	int version = nodeMap.namedItem(kAnmXML_Attr_Version).toAttr().value().toInt() ;
	if ( version != kAnmXML_Version ) {
		return false ;
	}

	if ( nodeMap.namedItem(kAnmXML_Attr_ObjNum).isNull() ) {
		return false ;
	}
	if ( nodeMap.namedItem(kAnmXML_Attr_ImageNum).isNull() ) {
		return false ;
	}
	int objNum = nodeMap.namedItem(kAnmXML_Attr_ObjNum).toAttr().value().toInt() ;
	int imageNum = nodeMap.namedItem(kAnmXML_Attr_ImageNum).toAttr().value().toInt() ;

	QDomNode n = root.firstChild() ;
	return loadElement(n, objNum, imageNum) ;
}