Build registry treeview from XML

dakota97

Well-known member
Joined
Nov 14, 2003
Messages
113
Location
Pennsylvania
Hi all,

Im working on an XML reader program for our support team to make a "human readable" form of an XML file. I have the XML file that is generated from a program whenever a support request is sent. The XML file has a breakdown of the registry keys on the users computer that are specific to the program. The file is structured as follows:


Code:
- <Registry>
- <RegistryKey>
  <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name</Name> 
  </RegistryKey>
- <RegistryKey>
  <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name</Name> 
- <Property>
  <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMajor</Name> 
  <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">1</Value> 
  </Property>
- <Property>
  <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMinor</Name> 
  <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">2</Value> 
  </Property>
  </RegistryKey>
- <RegistryKey>
  <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name\Version 1.2</Name> 
  </RegistryKey>
.
.
.
.
.

Now, I need to build a treeview that looks like the REGEDIT in Windows, but Im having a hard time getting the nodes set up correctly. Basically what I need to do is read the NAME value that includes the registry key and determine if the correct nodes have been added to the treeview. If not, then I need to add the appropriate nodes.

This is where Im running into problems. Ive added the 5 root nodes into the node collection of the treeview control through the designer. But, when I go to add the "subnodes" at runtime, I just cant get them to display correctly. Later, Ill need to add the PROPERTY values from the XML file to a listview control so that when the user clicks on the node, it displays the property values in the listview.

Does anyone have an idea on how I can do this without writing multiple FOREACH and IF statements?

Thanks in advance,

Chris
 
Back
Top