OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: TinyXMLResource
View page
Source of version: 14
(current)
__Author__:' ((User:xadhoom|xadhoom))' __Discussion__: [http://www.ogre3d.org/forums/viewtopic.php?f=10&t=48867|Ogre Forum] The following class shows an example implementation for [http://en.wikipedia.org/wiki/TinyXML|TinyXML] documents via Ogres resource system (current version: 1.6.1 ((Shoggoth))). Its subclasses allow to open ((-XML|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 {toc} {DIV(class="Layout_box13")}The source code can be found [http://www.mediafire.com/file/m2nzu11woh1/TinyXMLResource.zip|here]. {DIV} 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: {CODE(wrap="1", colors="c++")}// 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 }{CODE} The class supports cloning: {CODE(wrap="1", colors="c++")}TinyXMLPtr myXMLFile2 = myXMLFile->clone("myXMLFile2Name");{CODE} And the creation of manual XML resources. {CODE(wrap="1", colors="c++")}// 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...{CODE}
Search by Tags
Search Wiki by Freetags
Latest Changes
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
Critter AI
Mogre Add-ons
MOGRE
Mogre MyGUI wrapper
...more
Search
Find
Advanced
Search Help
Online Users
129 online users