Skip to main content

History: TinyXMLResource

Preview of version: 13

Author:' xadhoom'

Discussion: Ogre Forum

The following class shows an example implementation for TinyXML documents via Ogres resource system (current version: 1.6.1 Shoggoth).

Its subclasses allow to open XML files (with TinyXML) like you would do with .mesh files. You only have to call create and load as described and you will get a resource which contains the actual XML data of the file. This is useful for everything where you describe things in XML ...

  • TinyXMLResourceManager - The Ogre ResourceManager which creates new TinyXML resources
  • TinyXMLResource - The actual TinyXML document resource which supplies access to the TinyXMLDocument node



The source code can be found here.


Local copy here: No such attachment on this page


To use the code you have to add the additional TinyXML dependencies. If you encounter problems you may have to
adapt the Header files. You can then use it like this:

Copy to clipboard
// create our ResourceManager OGRE_NEW TinyXMLResourceManager(); // create a new resource for our xml file 'MyFile.xml' TinyXMLPtr myXMLFile = TinyXMLResourceManager::getSingleton().create("MyFile.xml", "MyResourceGroup"); // actually load our xml file myXMLFile->load(); // if there was no loading error we can now retrieve the TiniYML node below if(xml->getError()) { LogManager::getSingletonPtr()->logMessage("An error occured in file " + xml->getName() + " : " + String(xml->getErrorDesc())); } else { TiXmlNode* node = xml->getXMLData(); // perform operations on the xml structure }


The class supports cloning:

Copy to clipboard
TinyXMLPtr myXMLFile2 = myXMLFile->clone("myXMLFile2Name");


And the creation of manual XML resources.

Copy to clipboard
// create a manual xml resource (normally you should add a ManualResourceLoader in case of a reload) TinyXMLPtr myXMLFile3 = TinyXMLResourceManager::getSingleton().createManual("myXMLFile3Name", "MyGroup"); // retrieve the xml root node TiXmlNode* node = xml->getXMLData(); // add attributes and elements to node as you like...

History

Information Version
Sun 28 of Jun, 2020 15:44 GMT-0000 paroj 14
Sat 20 of Jun, 2020 03:23 GMT-0000 sercero 13
Fri 21 of May, 2010 00:44 GMT-0000 jacmoe 12
Fri 21 of May, 2010 00:44 GMT-0000 jacmoe 11
Fri 21 of May, 2010 00:43 GMT-0000 jacmoe 10
Fri 21 of May, 2010 00:42 GMT-0000 jacmoe 9
Sun 03 of Jan, 2010 00:33 GMT-0000 jacmoe 8
Fri 25 of Dec, 2009 22:02 GMT-0000 jacmoe 7
Fri 25 of Dec, 2009 21:58 GMT-0000 jacmoe 6
Fri 25 of Dec, 2009 21:57 GMT-0000 jacmoe 5
Fri 25 of Dec, 2009 21:54 GMT-0000 jacmoe 4
Fri 25 of Dec, 2009 21:50 GMT-0000 jacmoe 3
Fri 25 of Dec, 2009 21:49 GMT-0000 jacmoe 2
Thu 26 of Mar, 2009 22:58 GMT-0000 Beauty description update 1