Please help me?

(4 posts) (2 voices)
  • Started 11 months ago by sunder3dvia
  • Latest reply from sunder3dvia

Tags:

No tags yet.

  1. sunder3dvia

    veteran
    Joined: May '13
    Posts: 275

    Hi,

    I am trying to read xml file using the following code


    m_Str="file:///C:/Documents and Settings/sunder/My Documents/3DVIA Studio Public Beta/SunderXML/My XML/sunder.xml";

    m_xmlPath.Create(m_Str);
    m_xmlDoc.Load(m_xmlPath);
    m_xmlNode = m_xmlDoc.GetRootElement();

    m_xmlAtom = m_xmlNode.GetChildren();

    I got all atom but I want to read one by one . Can anyone help me to do that?

    Awaiting for your help.

    Posted 11 months ago #
  2. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 378

    Hi,

    Well, then you need to use a loop.

    Have you read this ? http://www.3dvia.com/studio/resource/articles/everything-you-want-to-know-about-xml
    There is a downloadable project that is very helpful on this page.

    Basically you can do something like that :

    vkXMLReaderPtr xmlReader;
    vkXMLFactory& XMLFact = vkXMLFactory::Instance();
    
    XMLFact.CreateReader(iReader, yourURI);
    
    error err;
    
    while ((err = iReader.ReadNextAtom()) == errOk)
    {
    	if (iReader.IsElement())
    	{
    			if (iReader.HasID( "myId" ))
    				iReader.EnterNode();
    
    			if (iReader.HasID( "myChildId" ))
    				{
    					vkString uci, myAttribute;
    
    					iReader.GetAttribute("uci", uci);
    					iReader.GetAttribute("attribute", myAttribute);
    
                                            vkString myComponentUCI = uci;
                                            vkString myComponentName = myAttribute;
    				}
    		}
    }
    Posted 11 months ago #
  3. sunder3dvia

    veteran
    Joined: May '13
    Posts: 275

    Hi Hiddentux,

    Thanks a lot for your reply. Can I achieve my goal using my code? Is possible to read xml file using the method which I have done? Please help me?

    Awaiting for your reply!

    Posted 11 months ago #
  4. sunder3dvia

    veteran
    Joined: May '13
    Posts: 275

    Hi Hiddentux,

    Once again thanks for the link which u have given... I am going through it.

    Posted 11 months ago #

Reply

You must log in to post.