Help on casting vkString* to vkString to store iXMLReader.GetElementID()

(4 posts) (3 voices)

Tags:

No tags yet.

  1. DJ

    member
    Joined: May '13
    Posts: 37

    I need help on casting vkString* to vkString to store iXMLReader.GetElementID() in a variable of type vkString. Any help on this will be highly appreciated.

    I am reading data from a XML file and need to compare node tag names before taking any action for which I need to store iXMLReader.GetElementID() in a variable. However iXMLReader.GetElementID() return vkString* type that can not be compared with string constant e.g. “Title”.

    Below is the code snippet for your reference.

    else if(xmlRead.IsLeafElement())
                                                    {
                                                                    Print("LeafNode");
                                                                    //Print(xmlRead.GetElementID()); //throws an error
                                                                    //strTemp = xmlRead.GetElementID();//throws an error
                                                                    if (xmlRead.GetElementID() == "Instructions")  //throws an error
                                                                    {
                                                                                    //Print("Instructions");
                                                                                    xmlRead.GetData(out);
                                                                                    Print(out);
                                                                    }
    
                                                                    errMsg = xmlRead.ReadNextAtom();
                                                    }
    Posted 9 months ago #
  2. alonezhby

    enthusiast
    Joined: Mar '09
    Posts: 78

    Best Answer

    Hi,
    you can compare the string like this:

    if(xmlReader.GetElementID().Match("Title"))
    {
    .........
    }

    Posted 9 months ago #
  3. sunder3dvia

    veteran
    Joined: May '13
    Posts: 276

    Hi,

    you can refer the following link

    http://www.3dvia.com/studio/resource/articles/everything-you-want-to-know-about-xml

    This will help you how to read and write xml data.

    Posted 9 months ago #
  4. DJ

    member
    Joined: May '13
    Posts: 37

    Thanks alonezhby! It works

    Posted 9 months ago #

Reply

You must log in to post.