Here's a little progress, I just need the touchdown hint!!
-------------------------Begin Code-------------------------
Dim xmlConfig As New XmlDocument
xmlConfig.Load( "http://localhost/myapp/Config.xml")
Dim nodeList As XmlNodeList =
xmlConfig.Selec tNodes("//myappInfo/UserName")
Dim node As XmlNode
Dim listItem As ListItem
For Each node In nodeList
If node.InnerXml = Me.ddlDivision. SelectedItem.Te xt Then
node.Attributes .RemoveAll() 'Remove current attributes of
selected user and re-populate
For Each listItem In Me.listSelected .Items
Dim newElem As XmlElement =
xmlConfig.Creat eElement("Field ")
Dim newAttrib As XmlAttribute =
xmlConfig.Creat eAttribute("Nam e")
newAttrib.Value = listItem.Text
newElem.Attribu tes.Append(newA ttrib)
xmlConfig.Docum entElement.Appe ndChild(newElem )
Next
End If
Next
-------------------------EndCode-------------------------
Here's the end result:
<myappConfig>
<UserInfo>
<DivisionName>N orthern California</DivisionName>
<DivisionCode>S J</DivisionCode>
<ReportAttribut es>
<ReqdFields/>
</ReportAttribute s>
</UserInfo>
<UserInfo>
<DivisionName>T ampa</DivisionName>
<DivisionCode>T F</DivisionCode>
<ReportAttribut es>
<ReqdFields/>
</ReportAttribute s>
</UserInfo>
<Field Name="Project"/>
<Field Name="Builder"/>
</myappConfig>
So...now that I'm able to add the new elements "Field" and attributes
"Name", how can I get this data into the correct ReqdFields node based on
the selected DivisionName in the app??
TIA
-Rich
"Rich Wallace" <ri**********@m inusthecannedme at.jfsheadotcom > wrote in
message news:eP******** *****@TK2MSFTNG P11.phx.gbl...
Hi all,
I've been though many posts in this group and have yet to find one that
helps me understand how to accomplish my goal.
I have an XML document that stores user specific values that I need to
maintain based on options they select in a web app. Here's the XML:
<?xml version="1.0" encoding="utf-8" ?>
<MyConfig>
<UserInfo>
<UserName>Joe Schmoe</UserName>
<ReportAttribut es>
<ReqdFields>
<Field Name="Address"/>
<Field Name="City" />
<Field Name="Close_Dat e" />
<Field Name="FName1" />
<Field Name="FName2" />
<Field Name="Project" />
<Field Name="State" />
<Field Name="Zip" />
</ReqdFields>
</ReportAttribute s>
</UserInfo>
</MyConfig>
A form in the web app displays all available fields that the user can
select as a valid 'ReqdFields' option or remove them from teh list as well. How
can I update the XML and remove or add the updated fields via .NET code to
reflect the changes??
TIA
-Rich