[ Mr. Rejn @ 06.01.2006. 14:39 ] @
Zna li neko zasto ovaj primer ne radi kako treba,tj. ne izbacuje sadrzaj taga tipa
EXN_TEXT na standardni izlaz,a sadrzaj vrednosti atributa elemenata EXN_ELEMENT
izbacuje normalno,a posle toga pravi nekoliko slobodnih redova tamo gde bi trebao da
se nadje tekst iz tekstualnog taga.To je malo preradjeni primer iz irrXML help fajla
(ovo je sa BCB6):
Code:

#pragma hdrstop
#pragma argsused
#include <vcl.h>

#include "irrXML.h"
using namespace irr;
using namespace io;

#include <string> // we use STL strings to store data in this example
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    IrrXMLReader* xml = createIrrXMLReader("opcije.xml");

    // strings for storing the data we want to get out of the file
    std::string modelFile;
        std::string modelDir;
    std::string Text;
    std::string caption;

    // parse the file until end reached
    while(xml && xml->read())
    {
        switch(xml->getNodeType())
                        {
                        case EXN_TEXT:
       // in this xml file, the only text which occurs is the messageText
                                Text = xml->getNodeData(); //<- ?
                                break;
                        case EXN_ELEMENT:
                                {
                      if (!strcmp("model", xml->getNodeName())) {
                      modelFile = xml->getAttributeValue("file");
                      modelDir = xml->getAttributeValue("dir");
                      }
                      else  {
                      if (!strcmp("messageText", xml->getNodeName()))
                      caption = xml->getAttributeValue("caption");
                      }
                                }
                        break;
    }
                        }
    // delete the xml parser after usage
        std::cout << modelFile << std::endl;
        ShowMessage(AnsiString(modelFile.c_str()));
        std::cout << caption << std::endl;
        ShowMessage(AnsiString(caption.c_str()));
        std::cout << modelDir << std::endl;
        ShowMessage(AnsiString(modelDir.c_str()));

        std::cout << Text << std::endl;        //<-- OVDE JE PROBLEM
        ShowMessage(AnsiString(Text.c_str()));

    delete xml;
}



[Ovu poruku je menjao Mr. Rejn dana 06.01.2006. u 15:47 GMT+1]

[Ovu poruku je menjao Mr. Rejn dana 06.01.2006. u 15:48 GMT+1]