Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Read/Write XML data in C#

From: RLEE71@-----------.---------.---
To: NULL
Date: 10/9/2008 11:46:00 AM

Thanks Martin. That code worked. Now how would I pull the current value into 
a text box, and then change it and write it back from the data entered in the 
textbox?

For instance, I havae a form that has a TextBox for:
IP Address
Subnet Mask
Gateway
DNS Name

The XML file would have default values that I would like populated in each 
textbox. Then if a change was required, one would just change the data in the 
textbox and then save the data back to the xml file.

I'm a bit new to programming, that's why I like Visual Studio, so forgive me 
if these questions seem a bit rudimentary.

Ron

"RLEE71" wrote:

> I'm using VS C# 2008 Express. I want to read data from an XML file and 
> display into a text box. I then want to be able to edit the data in the text 
> box and save back to the XML file. I've seen various examples of how to do 
> this, but I think that my particular XML file is more complicated. Any help 
> would be greatly appreciated. I'm concerned with the data in the IP_ADRESS, 
> SUBNET_MASK, GATEWAY_IP_ADRESS, and DNS_NAME tags under MOD_NETWORK_SETTINGS. 
> Also want to edit the ADD_USER PASSWORD data.
> 
> Here is the XML file:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <!-- HPONCFG VERSION = "1.5.1.1" -->
> <!-- Generated 09/09/08 11:45:12 -->
> <RIBCL VERSION="2.1">
>   <LOGIN USER_LOGIN="Administrator" PASSWORD="password">
>     <DIR_INFO MODE="write">
>       <MOD_DIR_CONFIG>
>         <DIR_AUTHENTICATION_ENABLED VALUE="N" />
>         <DIR_LOCAL_USER_ACCT VALUE="Y" />
>         <DIR_SERVER_ADDRESS VALUE="" />
>         <DIR_SERVER_PORT VALUE="636" />
>         <DIR_OBJECT_DN VALUE="" />
>         <DIR_OBJECT_PASSWORD VALUE="" />
>         <DIR_USER_CONTEXT_1 VALUE="" />
>         <DIR_USER_CONTEXT_2 VALUE="" />
>         <DIR_USER_CONTEXT_3 VALUE="" />
>       </MOD_DIR_CONFIG>
>     </DIR_INFO>
>     <RIB_INFO MODE="write">
>       <MOD_GLOBAL_SETTINGS>
>         <RBSU_POST_IP VALUE="Y" />
>       </MOD_GLOBAL_SETTINGS>
>       <MOD_NETWORK_SETTINGS>
>         <SPEED_AUTOSELECT VALUE="N" />
>         <NIC_SPEED VALUE="100" />
>         <FULL_DUPLEX VALUE="Y" />
>         <DHCP_ENABLE VALUE="N" />
>         <DHCP_GATEWAY VALUE="N" />
>         <DHCP_DNS_SERVER VALUE="N" />
>         <DHCP_STATIC_ROUTE VALUE="N" />
>         <DHCP_WINS_SERVER VALUE="N" />
>         <REG_WINS_SERVER VALUE="Y" />
>         <IP_ADDRESS VALUE="20.5.236.19" />
>         <SUBNET_MASK VALUE="255.255.255.0" />
>         <GATEWAY_IP_ADDRESS VALUE="20.5.236.254" />
>         <DNS_NAME VALUE="name.com" />
>         <DOMAIN_NAME VALUE="" />
>         <PRIM_DNS_SERVER value="0.0.0.0" />
>         <SEC_DNS_SERVER value="0.0.0.0" />
>         <TER_DNS_SERVER value="0.0.0.0" />
>         <PRIM_WINS_SERVER value="0.0.0.0" />
>         <SEC_WINS_SERVER value="0.0.0.0" />
>         <STATIC_ROUTE_1 DEST="0.0.0.0" GATEWAY="0.0.0.0" />
>         <STATIC_ROUTE_2 DEST="0.0.0.0" GATEWAY="0.0.0.0" />
>         <STATIC_ROUTE_3 DEST="0.0.0.0" GATEWAY="0.0.0.0" />
>       </MOD_NETWORK_SETTINGS>
>       <LICENSE>
>         <ACTIVATE KEY="332DX8V87SZYLMMGYXGT4GD6M" />
>       </LICENSE>
>     </RIB_INFO>
>     <USER_INFO MODE="write">
>       <ADD_USER USER_NAME="ilo03" USER_LOGIN="ilo03" PASSWORD="paswword">
>         <ADMIN_PRIV value="Y" />
>         <REMOTE_CONS_PRIV value="Y" />
>         <RESET_SERVER_PRIV value="Y" />
>         <VIRTUAL_MEDIA_PRIV value="Y" />
>         <CONFIG_ILO_PRIV value="Y" />
>       </ADD_USER>
>       <ADD_USER USER_NAME="ilo02" USER_LOGIN="ilo02" PASSWORD="password1">
>         <ADMIN_PRIV value="N" />
>         <REMOTE_CONS_PRIV value="Y" />
>         <RESET_SERVER_PRIV value="Y" />
>         <VIRTUAL_MEDIA_PRIV value="Y" />
>         <CONFIG_ILO_PRIV value="N" />
>       </ADD_USER>
>       <ADD_USER USER_NAME="ilo01" USER_LOGIN="ilo01" PASSWORD="password2">
>         <ADMIN_PRIV value="N" />
>         <REMOTE_CONS_PRIV value="N" />
>         <RESET_SERVER_PRIV value="Y" />
>         <VIRTUAL_MEDIA_PRIV value="Y" />
>         <CONFIG_ILO_PRIV value="N" />
>       </ADD_USER>
>     </USER_INFO>
>   </LOGIN>
> </RIBCL>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent