Interact with XML - the article concentrates in appending but the ZIP includes a full project.
Note: It saves the XML file onto a specific folder. Please change this in the code.
This example assumes that you are familiar with ASP, XML and HTML 4.0.
Before proceeding with this article, I recommend that you read Saving HTML Form Data to XML and Editing XML with XSL and ASP.
The example in this article is very similar to the example on Saving HTML Form Data to XML. However, instead of creating a new file each time that the form is submitted, we will check to see if the file already exists, and if it does, we will append to it. Using this type of technique, we are creating a data construct similar to a database table.
If you have read the Saving HTML Form Data to XML article, you will notice that the code to append the HTML data to the XML file is almost identical to the code used to save HTML data to a new file. There are two main differences in the addNewContacttoXML function used in this example and the ConvertFormtoXML function used in the Saving HTML Form Data to XML example.
This section of code is from the addNewContacttoXML function. Since we are not creating a new file each time, we save a contact now, we need to call the Load function of the XMLDOM object and attempt to load the file. If we are able to load the file, we obtain a reference to the root element of the XML document. If the file does not load, we assume that it does not exist and create reference to a new root element and append it to the XML Document.
The other main difference is when we test a second time to see if the file was successfully loaded so that we know whether or not we need to add a processing instruction. If the file exists, we do not need a processing instruction. However, if a new file is being created, a processing instruction must be added.
Other than these two differences, however, you will notice that the code to save data to a new file is virtually the same as the code to append a new record to an existing file. We create a new container element, contact, as a child of the root element, main, to hold the data for each new record added. The code then iterates through the Form Collection of the Request Object creating the appropriate XML nodes and setting the nodes' values equal to the current Form Field.
As always, it is recommended that you copy this code to your development server and give it a try. I hope that this example will help shedding some light on the subject!
| You must Sign In to use this message board. |
|
|
 |
 | hey  Nish [BusterBoy] | 14:38 27 Feb '02 |
|
|
 |
 | Re: hey  Mauricio Ritter | 2:09 28 Feb '02 |
|
 |
Nish [BusterBoy] wrote: Can someone remedy things please?
Chris could create some kinda filter to the articles (if incomplete for x weeks than FLAME the article).
Mauricio Ritter - Brazil Sonorking now: 100.13560 Trank
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | Re: hey  Chris Maunder | 5:36 28 Feb '02 |
|
 |
Nish [BusterBoy] wrote: I know there must have been a submission wizard error.
Really? Why?
cheers, Chris Maunder
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | Re: hey  Nish [BusterBoy] | 14:57 28 Feb '02 |
|
|
 |
 | Re: hey  Chris Maunder | 4:33 1 Mar '02 |
|
 |
Actually no I'm not. You said "I know there must be a submission Wizard error' and I said, in all seriousness "Why".
Just because an author has problems posting an article doesn't mean it's the Wizards fault (unless you consider the lack of a detailed tutorial a problem, which it probably is).
If there is a problem with the wizard then I do want to hear about it (so I can fix it ASAP), but it didn't seem to be the case this time.
cheers, Chris Maunder
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | Re: hey  Mike Klimentiev | 11:37 4 Mar '02 |
|
 |
Chris, sorry for being slightly off topic but what do you think about an idea of introducing "Kill it" rating? Let's say that after 2 weeks if the "Kill it rating" comes to 50% then mark the article as "Killed" and move to a separate section (or, better, delete it to free HD space). Some publishing "lockout period" may be considered for the author after "qualifying" number of kills per time period.
To be honest, I must say that I'm dead serious. It's started to bug me that weekly post contains more and more dead weight.
MK
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | Re: hey  Braulio Díez | 22:02 4 Mar '02 |
|
 |
Hi Chris !,
Last time I tried to use the wizard, in the second step I decide to send the submission to you manually, because in the first step it ask me for an HTM extension, and in the second it began talking about a file with ASP extension, so I didn´t know what to do if renaming it to HTM or ASP or.... well better send an e-mail with all the stuff... 
I think it can be better of course, it should be better, if not you will continue receiving mails from people to make the manual submission thing... or we will continue having problems with the submissions.
Cheers Braulio
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
yes. he is.
i had to hand-craft the download HREF for one of the articles i just posted. the submission wizard isn't automatically adding the links to new articles today.
-c
Smaller Animals Software, Inc. You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|