Esempio n. 1
0
EngineDescription readEngine(Element &engineElem)
{
    //Check for illegal elements here
    Iterator< Node > c;
    for ( c = c.begin(&engineElem); c != c.end(); c++ )
    {
        if(c->Type() == TiXmlNode::ELEMENT)
        {
            string s = c->Value();
            if(s != "component")
            {
                LOG(LFATAL) << "Illegal element in xml file: " << s;
                throw XmlParsingException("Illegal element in xml file: " + s);
            }
        }
    }

    EngineDescription theEngine;
    theEngine.name = engineElem.GetAttribute("name");
    theEngine.type = engineElem.GetAttribute("class");
    boost::to_lower(theEngine.name);
    boost::to_lower(theEngine.type);
    LOG(LINFO) << "Parsed engine: " << theEngine.name;

    //Parse all the components and add to the engine description
    Iterator< Element > child("component");
    for ( child = child.begin(&engineElem); child != child.end(); child++ )
    {
        ComponentDescription comp = readComponent(*child);
        comp.engineName = theEngine.name;
        theEngine.components.push_back(comp);
    }

    return theEngine;
}
Esempio n. 2
0
void Fidelity::Engine::SimulationXmlReader::readComponents()
{
	while(!atEnd()) {
		readNext();

		// Stop here if components tag completed
		if(isEndElement() && name() == "components") {
			break;
		}

		// Evaluate child tags
		if (isStartElement()) {
			// We expect component tags only
			if (name() == "component") {
				readComponent();
			}
			else {
				unknownElement();
			}
		}
	}
}