-1

i created an xml like registry structure.. i can node traverse through node name ..here i cannot traverse a nodepath through attribute value ...i give the xml below..

 <Computer>
   <HIVE Name="HKEY_CUREENT_USER">
     <Elements>
       <element Name="(Default)" Type="REG_SZ" Data="(value not set)" /> 
       <element Name="SoftwareMicrosoftVisualStudio9.0ResourceEditorsPerformanceLoggingEnabled" Type="REG_SZ" Data="" /> 
     </Elements>
     <KEYS>
       <Key Name="Network">
         <Elements>
           <element Name="(Default)" Type="REG_SZ" Data="(value not set)" /> 
         </Elements>
       </Key>
     </KEYS>
   </HIVE>
 </Computer>

i want the path access"HKEY_CUREENT_USER\Network" ...give me a solution in c++ code(using MSXML)

Rajakumar
  • 442
  • 1
  • 9
  • 21
  • 1
    Edit and make yourself clearer ... Your code does not appear ... – neuro Aug 11 '09 at 09:46
  • 1
    DO you mean you need a XML parser? – Vaibhav Aug 11 '09 at 09:50
  • I downmodded -1 for the demanding "give me" attitude (which I happily will undo if the question is corrected). This post is lucky, http://stackoverflow.com/questions/1259508/sample-c-program received a -5 reward. – hlovdal Aug 11 '09 at 11:28

2 Answers2

1

The XPath expression you need to access that is /Computer/HIVE/KEYS/Key[@Name='Network']

If you put this into a selectnodes statement on your DOM document then you will get a nodelist back, which you can interrogate for the information you require

Xetius
  • 44,755
  • 24
  • 88
  • 123
1

Load into DOM and use following method:

IXMLDOMDocument::selectSingleNode(
     L"/HIVE[@Name='HKEY_CUREENT_USER']/Key[@Name='Network']/...")
Dewfy
  • 23,277
  • 13
  • 73
  • 121