How is 'irr::io::IIrrXMLReader::getNodeData()' used?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
carlwryker
Posts: 22
Joined: Sun Jun 12, 2016 8:03 am

How is 'irr::io::IIrrXMLReader::getNodeData()' used?

Post by carlwryker »

I made an xml file that looks something like the following. The elements style was more suitable for my project than the attributes style.

Code: Select all

 
<?xml version="1.0"?>
<EdSpeciesVec>
    <EdSpecies>
        <id>1</id>
        <name>A</name>
        <desc>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</desc>
        <thumbTexId>-1</thumbTexId>
        <bloodTexId>-1</bloodTexId>
        <notes> </notes>
    </EdSpecies>
 
    /* more <EdSpecies></EdSpecies> blocks */
 
</EdSpeciesVec>
 
Is getNodeData() used to read the data between element tags? Where can I find an example of how it is used?
Code::Blocks
mingw
Windows 10 64-bit
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How is 'irr::io::IIrrXMLReader::getNodeData()' used?

Post by CuteAlien »

Yeah, getNodeData is used for that.I don't have time to write a real example right not, but should be something like:

Code: Select all

 
while(xml && xml->read())
{
    switch(xml->getNodeType())
    {
        case irr::io::EXN_CDATA:
        {
            const wchar_t * data = xml->getNodeData(); // data inside elements
        }
        break;
        case irr::io::EXN_ELEMENT:
        {
            const wchar_t * name=  xml->getNodeName();  // element node name
        }
        break;
        // not sure if you need other types - check docs which other types exist
    }
}
 
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
carlwryker
Posts: 22
Joined: Sun Jun 12, 2016 8:03 am

Re: How is 'irr::io::IIrrXMLReader::getNodeData()' used?

Post by carlwryker »

Thank you!
Code::Blocks
mingw
Windows 10 64-bit
Post Reply