markSaunders
Programmer
i know that the ASP code at the bottom of my post will insert the relevant data (passed from the HTML form calling the ASP) into the xmlDoc.
what i now need to do is locate the unique value [tt]Example1[/tt] (from the HTML form) and use this (sExample1) to locate the appropriate node in the XMLdocument. Having located it i need to extract the data for [tt]Example1[/tt] and other elements that are at the same level. and example of the XML i have described is thus
[tt] Im the one[/tt]
[tt] so get me too[/tt]
any help appreciated..
Mark Saunders
what i now need to do is locate the unique value [tt]Example1[/tt] (from the HTML form) and use this (sExample1) to locate the appropriate node in the XMLdocument. Having located it i need to extract the data for [tt]Example1[/tt] and other elements that are at the same level. and example of the XML i have described is thus
Code:
<EXAMPLEFILE>
<RECORD>
<EXAMPLE1> not me </EXAMPLE1>
<EXAMPLE2> nor me </EXAMPLE2>
</RECORD">
<RECORD>
<EXAMPLE1>
Code:
</EXAMPLE1>
<EXAMPLE2>
Code:
</EXAMPLE2>
</RECORD>
<RECORD>
<EXAMPLE1> not me </EXAMPLE1>
<EXAMPLE2> nor me </EXAMPLE2>
</RECORD>
</EXAMPLEFILE>
any help appreciated..
Code:
' Variables from HTML form
Dim sExample1
Dim sExample2
' XML DOM Variables
Dim oDOM
Dim oRootNode
Dim oEntryNode
Dim oDetailsNode
' Get the values from the http header
sExample1=Request("Example1")
sExample2=Request("Example2")
' Create DOM Document Objects
Set oDOM = Server.CreateObject("Microsoft.XMLDOM")
oDOM.async = false
oDOM.load server.mappath("ExampleData.xml")
' Check if it wasn't found
If oDOM.parseError.ErrorCode <> 0 Then ' not found!
oDOM.loadXML "<EXAMPLEFILE/>"
End If
' Create a RECORD node in the xml document
Set oEntryNode = oDOM.documentElement.AppendChild(oDOM.createElement("RECORD"))
' Create 'Example1' node in the XML document
Set oDetailsNode = oEntryNode.appendChild(oDOM.createElement("Example1"))
oDetailsNode.Text = sExample1
' Create 'Example2' node in the XML document
Set oDetailsNode = oEntryNode.appendChild(oDOM.createElement("Example2"))
oDetailsNode.Text = sExample2
...