Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I need to parse the xml file and store the values in the local
but i am able to read the main node but inside items are listing
need to parse the below file i am able to load the file correctly
<?xml version="1.0" encoding="UTF-8"?>

<layouts>
    <lay pos="15" bold="true"/>
    <layoff pos="12"/>
    <layin pos="17"/>
  </layouts>


What I have tried:

TElem elays = eroot.subnode(L"layouts");
   for (TElem e = elays.begin(); (e.elem && (e != eroot.end())); e++)
   {
       int pos = e.attrInt(L"pos", -1);
       bool bold = e.attrBool(L"bold", false);
       // we suggest defaults, in case the attribute is missing
       wstring id = e.name();
       // returns "lay" or "layoff" or "layin"
   }


the control is not going to inside for loop
could you please help me here,if anything is wrong
Posted
Updated 21-Dec-17 1:54am
v2
Comments
Jochen Arndt 21-Dec-17 8:02am    
What does "ini=side" mean?

It looks like you have copied the example code from https://www.codeproject.com/Articles/4285/Using-MSXML-to-read-XML-documents. That is a rather old article and I suggest to use a more recent one about MSXML or use a different XML library.
Member 13089825 21-Dec-17 8:05am    
What does "ini=side" mean?
sorry,its typo error
yeah i have copied,because my requirement is similar in that one its not going inside for loop
Jochen Arndt 21-Dec-17 8:19am    
There is a difference between your code and the code from the article. You have added an additional loop condition. When that is false / NULL, the loop will never be executed.
Member 13089825 21-Dec-17 10:23am    
i have modified like below its going inside but values are not returning.(returning empty)

for (TElem e = elays.begin(); ( (e != elays.end())); e++)
Member 13089825 21-Dec-17 12:50pm    
i have found the issue and its working fine now ,thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900