Hello guys, Please I need your advice, I'm very new in XML. I guess it should be easy for your:
Let's say that we have people.xml with the following structure:
<name country="be"> name1 </name>
But I want that the new names are saved in the people.xml in the server, no in the RAM.
Please if you can explain me that as for a man of 99 y.o could be great
Thanks a lot guys.
XML isn't really the issue here, it's whatever language you choose to generate the XML file. The XML itself is arbitrary.
Thanks a lot for your answer Daniel.
I recently built a site for a client that uses an XML file for some of the content items.
Along with the site, I built an "admin" page using Classic ASP, XML, and XSL that allows them to update the XML file (including being able to add additional records).
The basic design is like this:
1- "admin.asp" - reads the XML file and presents the data in an HTML form using a table for the layout.
2- user makes updates, adds rows, etc.
3- then the user clicks "Save" the form posts to a page which loops through all of the table rows, creating XML as it goes, ultimately overwriting the current XML file with a new one.
The function that creates the XML, looks like this:
The function "WriteToFile" looks like this:
newProductList = "<?xml version=""1.0"" encoding=""ISO-8859-1""?>" & vbCRLF
newProductList = newProductList & "<Doc>" & vbCRLF
numberofRecords = Request.Form("numberOfRecords")
i = 1
For i = 1 to numberOfRecords
If validRow(i) Then
newProductList = newProductList & " <Product id=""" & i & """>" & vbCRLF
newProductList = newProductList & " <Type>" & Request.Form("Type_"&i) & "</Type>" & vbCRLF
newProductList = newProductList & " <ProductName>" & Request.Form("ProductName_"&i) & "</ProductName>" & vbCRLF
newProductList = newProductList & " <Unit>" & Request.Form("unit_"&i) & "</Unit>" & vbCRLF
newProductList = newProductList & " <Price>" & Request.Form("Price_"&i) & "</Price>" & vbCRLF
newProductList = newProductList & " <Image>" & Request.Form("Image_"&i) & "</Image>" & vbCRLF
newProductList = newProductList & " <Description>" & Request.Form("Description_"&i) & "</Description>" & vbCRLF
newProductList = newProductList & " </Product>" & vbCRLF
newProductList = newProductList & "</Doc>"
WriteToFile server.MapPath("data\product_list.xml"), newProductList, false
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
function WriteToFile(FileName, Contents, Append)
if Append = true then
iMode = 8
iMode = 2
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(FileName, iMode, True)
set oTextFile = nothing
set oFS = nothing
THanks a lot for your response nap0leon
I guess I have to analyse it pretty calm because I'm new using XML... I will copy paste your codes in some blank pages so that I will see what they show me.
Can I use 1 xml file to work with different domains hosted in different servers?
The code just writes a "string" to a file, the string happens to be in XML format, to whatever file you point it to. Since this runs server-side, if you want the process to update files on different servers, you would need to send the information to a web page on each server.
Hey I kind of just stumbled across this while working on a site. I'm trying to create a page similar to yours, with an admin page where a user can edit a list that gets displayed on the page. The is a set of people and is stored in an xml file with their name, personal webpage, and their position on our team.
Originally Posted by nap0leon
I have experience programming, but I've never worked with asp xml or xls, and im still a student, so I'm not even sure how to get started. Any help would be appreciated.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread