################################################################################ Author: Ajith Kumar (Admar Ajith Kumar Somappa) Homepage: www.hib.no/ansatte/aaks Title : Tutorial to use xml as input file in MiXiM for superframe structure References: MiXiM, OMNET++ Weblink: Check Omnet User manual for detailed xml methods and usage ################################################################################ In this tutorial I would like to show steps to use external xml file as input to a source code in MiXiM. The obstacles or errors caused due to improper usage. An example xml file 0 1 1 0 In the NED file for MAC or any other NED file for source code //Getting the xml file from ini file xml xmlFile; In the ini file, since we use it in the MAC source file **.node[*].nic.mac.xmlFile = xmldoc("xmlFile.xml") In the header file, important data types required cXMLElement *xmlFile; cXMLElement *xmlBuffer; cXMLElementList nList; cXMLElementList::iterator xmlListIterator; short transmitSlots[n]; // To be used within transmitSlots In the initialize method of the main source file, to take input from the NED file xmlFile = par("xmlFile"); xmlBuffer = xmlFile->getFirstChild(); // Gets the transmitSlots part nList = xmlBuffer->getChildren(); // Gets all the children xmlListIterator = nList.begin(); // Use iterator to read all children values //Iterating on the nList or all childrens of transmitSlots for(int i=0;xmlListIterator!=nList.end();xmlListIterator++,i++) { xmlBuffer = (*xmlListIterator); transmitSlots[i] = atoi(xmlBuffer->getNodeValue()); // Storing all children values } !!Important Do not destruct the pointers, will give an exit code (139) of attempting to delete unexisting pointers Also you might need #include for use of atoi atoi - a method to convert charcter to integer value