Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting data in to an xml document

Status
Not open for further replies.

lazytrucker

Programmer
Aug 4, 2004
39
GB
Trying to use asp to add to an xml doc on the fly.

Method:

set elementchild=objxml.documentelement.childnodes.Item(i).childnodes(0).createelement("ElementName")

An error is returned object doesnt support this method.

Is there a way of inserting data in to an xml document using asp on the fly???

Any ideas appreciated.

Cheers Lazytrucker.

 
copied from devguru::

Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("names.xml")

Dim objCurrNode, objNewNode, objNewText
Set objNewNode = objXMLDoc.createElement("name")
Set objNewText = objXMLDoc.createTextNode("John")
objNewNode.appendChild(objNewText)

Set objCurrNode = objXMLDoc.documentElement
objCurrNode.appendChild(objNewNode)
Set objCurrNode = objCurrNode.lastChild
Response.write(objCurrNode.firstChild.nodeValue)


don't forget dom is case sensitive and that the changes are only in memory and will need to be saved for permanancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top