p2p.wrox.com, look up code for Professional VB.NET Chapter 10--on XML--maybe
something there can help you. If not try
www.superexpert.com, "ASP
Unleashed" Look at code for Chapter 13.
Both of these deal with XML and are really the extent of what I know but
just haven't used it much.
You can easily iterate through your form posted elements as I have said
before. If all have a unique name, then you can get "NameofElement" and
then go get it's value as mentioned before... Do that in a loop using the
count-1 property of the collection.
Inside of that as to what to do with it in XML, John is write--that is an
XML question better directed at an XML group. But maybe the sample code
from one of the books I mentioned might have something you need.
Sorry I can't be of further help.
Shane
"KathyB" <KathyBurke40@attbi.com> wrote in message
news:75e8d381.0308120232.6b703274@posting.google.c om...[color=blue]
> My html form is a set of user instructions steps. For each
> <data_collection> element, for example, my xsl turns that into an
> <input type=text name="the unique name attribute defined in the base
> xml doc"> box in the html form (I would post it, but it's really quite
> large). AND, I don't have the html script yet!!! but it's just a
> simple post to an aspx page (e.g., process_dom.aspx).
>
> The only "changes" the user is allowed to make are via these text
> boxes. When the user is done, they click a Submit button. The submit
> javascript then opens an aspX page (hidden from the user), where I
> would use code to load the original xml doc and that's where I need to
> do node.value changes FOR EACH TEXTBOX INPUT before saving the entire
> DOM.
>
> Again, because these instruction docs have an unknown number/type
> (different elements such as <measurement> and <data_collection> of
> name/value pairs, that's where I'm needing the help! I think what
> you're giving me is certainly the right track, I'm just not able yet
> to translate it into the code I need.
>
> For example, a request.form collection ends up having 2 pairs from two
> html textboxes name="one", name="two".
>
> For each, I need to set a variable name so I can use that in an xpath
> to get to the right DOM node (yes?).
>
> Dim xElem As XmlElement =
> xDoc.SelectSingleNode("//measurement[@name='" & varName & "'")
>
> Then I could do a node.value = "value of the name/value pair here".
>
> Move onto the next name/value pair, set the varName variable, etc.
>
> Hope this helps clarify...I truly, truly appreciate your sticking with
> me on this!!!
>
> Thanks.
> Kathy
>
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message[/color]
news:<e9D0esGYDHA.3444@tk2msftngp13.phx.gbl>...[color=blue][color=green]
> > "KathyB" <KathyBurke40@attbi.com> wrote in message
> > news:75e8d381.0308111621.16e6d4@posting.google.com ...[color=darkred]
> > > Hi again. Sorry but I'm still confused at how to do this exactly.[/color]
> >
> > That makes two of us. :-)
> >[color=darkred]
> > > I
> > > have an html form (resulting from a transformed xml document). Within
> > > the form I will have an unknown set of name/value pairs dependent on
> > > how many of a certain element I have in the source xml (e.g.,
> > > <measurement> or <data_collection>.[/color]
> >
> > Ok. BTW, maybe you said this before, but what kind of HTML elements will
> > contain the name/value pairs from the XML file? Also, I want to make[/color][/color]
sure[color=blue][color=green]
> > we're both talking about an .aspx page?
> >[color=darkred]
> > > When I post the html form, my script opens an asp.net page[/color]
> >
> > Ok, now I'm confused.
> >
> > When you say "post the html form", I presume you mean that you click a
> > button or something to submit the form? So, what script are you talking
> > about? Are you referring to a "<script runat=server />" block in the[/color][/color]
..aspx[color=blue][color=green]
> > page, or perhaps you're referring to the codebehind?
> >
> > In those cases, the script _is_ the asp.net page. It doesn't open it.
> >[color=darkred]
> > > and I need
> > > to save the xml elements back into the DOM.[/color]
> >
> > Ok, which DOM are you talking about? Do you mean that you need to[/color][/color]
update[color=blue][color=green]
> > the original XML file?
> >[color=darkred]
> > > I figured the best/easiest
> > > way to do that was the request.forms collection (per other posts I've
> > > had).
> > >
> > > But to be dynamic (unknown number of elements, but each with a unique
> > > "name" attribute), in English I want to:
> > >
> > > For each name/value pair in the request.form collection, I need to set
> > > an xpath expression pointing to the "name" fo the name/value pair,
> > > then update the name.value of the xpath to the value of the name/value
> > > pair.
> > >
> > > See what I mean?[/color]
> >
> > Maybe. You can iterate through the Request.Form collection in the same[/color][/color]
way[color=blue][color=green]
> > you iterate through the NameValueCollection in the example I gave. This[/color][/color]
is[color=blue][color=green]
> > because Request.Form _is_ a NameValueCollection:
> >
> > Dim aName as String
> > Dim aValue as String
> > For Each aName in Request.Form.AllKeys
> > aValue = Request.Form(aName)
> >
> > ' Set the xpath expression pointing to aName then
> > ' update the name.value of the xpath to the value of aValue
> > Next
> >[color=darkred]
> > > Thanks for responding. Kathy[/color]
> >
> > I hope I'm getting warmer. BTW, if this gets further into XML, you'll[/color][/color]
have[color=blue][color=green]
> > to find someone else to help out - I haven't done much with XML yet.
> > --
> > John Saunders
> > Internet Engineer
> >
john.saunders@surfcontrol.com
> >
> >
> >[color=darkred]
> > >
> > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message[/color]
> > news:<egrZ7jCYDHA.1916@TK2MSFTNGP12.phx.gbl>...[color=darkred]
> > > > "Kathy Burke" <kathyburke40@attbi.com> wrote in message
> > > > news:%231podZ5XDHA.2020@TK2MSFTNGP10.phx.gbl...
> > > > > John, could you possibly show me a little example?
> > > > > Thanks.
> > > > >
> > > >
> > > > Kathy, if I understand you correctly (and I think maybe I don't),[/color][/color][/color]
you[color=blue][color=green]
> > want[color=darkred]
> > > > to create a set of name/value pairs at one point in your code (like,
> > > > Page_Load), and use it later in the same request (like, in a Click[/color][/color][/color]
event[color=blue][color=green][color=darkred]
> > > > handler). You can do it like this:
> > > >
> > > > ' Let's assume we have a DataReader returning rows with two fields -
> > > > "TheName" and "TheValue".
> > > > ' We can put them in a variable as follows:
> > > >
> > > > Private NamesAndValues as New
> > > > System.Collections.Specialized.NameValueCollection ()
> > > >
> > > > Private Sub Page_Load(sender as object, e as EventArgs)
> > > > If Not Page.IsPostBack Then
> > > > ' Somehow get the DataReader, then:
> > > >
> > > > While reader.Read()
> > > > NamesAndValues.Add(reader.GetString("TheName"),
> > > > reader.GetString("TheValue"))
> > > > End While
> > > > End If
> > > > End Sub
> > > >
> > > > ' Later:
> > > > Private Sub btnOk_Click(sender as Object, e as EventArgs)
> > > > ' We can get the value for a particular name
> > > > Dim aValue as String = NamesAndValues("aName")
> > > >
> > > > ' Or we can loop through them all
> > > > Dim aName as String
> > > >
> > > > For Each aName in NamesAndValues.AllKeys
> > > > aValue = NamesAndValues(aName)
> > > > Next
> > > >
> > > > End Sub
> > > >
> > > > I hope that helps.[/color][/color][/color]