Click here to Skip to main content
15,892,927 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: getting element Pin
George L. Jackson25-Oct-07 13:15
George L. Jackson25-Oct-07 13:15 
GeneralRe: getting element Pin
RussBus26-Oct-07 4:32
RussBus26-Oct-07 4:32 
AnswerRe: getting element Pin
pmarfleet26-Oct-07 7:48
pmarfleet26-Oct-07 7:48 
GeneralRe: getting element Pin
RussBus26-Oct-07 7:54
RussBus26-Oct-07 7:54 
AnswerRe: getting element Pin
George L. Jackson26-Oct-07 9:30
George L. Jackson26-Oct-07 9:30 
Questionxml with crystal reports Pin
sreenivasaraok25-Oct-07 2:09
sreenivasaraok25-Oct-07 2:09 
Questionxml values to database Pin
KarthikMano24-Oct-07 19:40
KarthikMano24-Oct-07 19:40 
QuestionHow to extract specific data values from xml using VC++ [modified] Pin
zxc8924-Oct-07 1:31
zxc8924-Oct-07 1:31 
Hi..

Can some one please help me how to extract the data values from the following XML file using C++ code.

From the following example, we can observe two types of "CfgType"(Ane Justin and Jessica Sis). Under each "CfgType" there are different "MachineModel" and under that "ModelNo" and followed by "ScreenResolution".
<code>
<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!-- Configuration Type -->
<CfgType>
<Name>Ane Justin</Name>
<MachineModels>
<MachineModel>
<ModelNo>2345678</ModelNo>
<MonitorTypes>
<MonitorType>
<MonitorName>17" LCD</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
<MonitorType>
<MonitorName>19" LCD</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
</MonitorTypes>
</MachineModel>
<MachineModel>
<ModelNo>0789456</ModelNo>
<MonitorTypes>
<MonitorType>
<MonitorName>17" CRT</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
<MonitorType>
<MonitorName>19" CRT</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
</MonitorTypes>
</MachineModel>
</MachineModels>
</CfgType>

<CfgType>
<Name>Jessica Sis</Name>
<MachineModels>
<MachineModel>
<ModelNo>456789</ModelNo>
<MonitorTypes>
<MonitorType>
<MonitorName>17" LCD</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
<MonitorType>
<MonitorName>19" LCD</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
</MonitorTypes>
</MachineModel>
<MachineModel>
<ModelNo>345678</ModelNo>
<MonitorTypes>
<MonitorType>
<MonitorName>17" CRT</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
<MonitorType>
<MonitorName>19" CRT</MonitorName>
<ScreenResolution>
<Resolution>1024*768</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
<ScreenResolution>
<Resolution>800*600</Resolution>
<RefreshRate>60</RefreshRate>
</ScreenResolution>
</MonitorType>
</MonitorTypes>
</MachineModel>
</MachineModels>
</CfgType>
</Settings>

</code>

Now, the output should be shown as follows on the console window:

Ane Justin

2345678
17" LCD
1024*768
60
800*600
60
19" LCD
1024*768
60
800*600
60

0789456
17" LCD
1024*768
60
800*600
60
19" LCD
1024*768
60
800*600
60

Jessica Sis

456789
17" LCD
1024*768
60
800*600
60
19" LCD
1024*768
60
800*600
60

345678
17" LCD
1024*768
60
800*600
60
19" LCD
1024*768
60
800*600
60

Could some one please help me in showing the output as shown above...
Many Thanks...


-- modified at 8:02 Wednesday 24th October, 2007
AnswerRe: How to extract specific data values from xml using VC++ Pin
Stefan Troschuetz24-Oct-07 2:30
Stefan Troschuetz24-Oct-07 2:30 
AnswerRe: How to extract specific data values from xml using VC++ Pin
Nathan Holt at EMOM24-Oct-07 6:35
Nathan Holt at EMOM24-Oct-07 6:35 
GeneralProblem with SelectNodes [modified] Pin
Brady Kelly23-Oct-07 5:08
Brady Kelly23-Oct-07 5:08 
GeneralRe: Problem with SelectNodes Pin
pmarfleet23-Oct-07 5:34
pmarfleet23-Oct-07 5:34 
GeneralRe: Problem with SelectNodes Pin
Brady Kelly23-Oct-07 5:37
Brady Kelly23-Oct-07 5:37 
News[ANN] Liquid XML Studio Released - A Freeware XML Development Environment Pin
Liquid Technologies22-Oct-07 22:33
Liquid Technologies22-Oct-07 22:33 
GeneralRe: [ANN] Liquid XML Studio Released - A Freeware XML Development Environment Pin
Scott Dorman23-Oct-07 3:23
professionalScott Dorman23-Oct-07 3:23 
QuestionClass for deserializing array Pin
Howard Richards22-Oct-07 4:54
Howard Richards22-Oct-07 4:54 
AnswerRe: Class for deserializing array Pin
George L. Jackson22-Oct-07 8:27
George L. Jackson22-Oct-07 8:27 
GeneralRe: Class for deserializing array Pin
Howard Richards22-Oct-07 9:02
Howard Richards22-Oct-07 9:02 
QuestionProblem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#19-Oct-07 0:16
Rocky#19-Oct-07 0:16 
AnswerRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
George L. Jackson19-Oct-07 4:31
George L. Jackson19-Oct-07 4:31 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#21-Oct-07 19:55
Rocky#21-Oct-07 19:55 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
George L. Jackson22-Oct-07 0:55
George L. Jackson22-Oct-07 0:55 
GeneralRe: Problem in linking the xsl file to xml file (when I use FireFox) Pin
Rocky#22-Oct-07 1:23
Rocky#22-Oct-07 1:23 
Questionproblem in javascript Pin
Arihant rathi18-Oct-07 0:50
Arihant rathi18-Oct-07 0:50 
AnswerRe: problem in javascript Pin
Stefan Troschuetz18-Oct-07 1:19
Stefan Troschuetz18-Oct-07 1:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.