[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: HTML form contents => XML document

Subject: RE: HTML form contents => XML document
From: "Kevin Read" <kevin@xxxxxxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 04:07:48 +0930
kevin read
Although not perl or php, in ASP I use the following code sets.  They may be
useful to others as well.  They look in the request object and etract the
values.

Kevin

<%
Function Form2XML
	Dim FormXML
	FormXML = "<?xml version=""1.0""?>" + chr(10)
	FormXML = FormXML & "<form>"+ chr(10)
	For Each objItem In Request.Form
		FormXML = FormXML + "<" + objItem + ">" +
ValidateXMLItemValue(Request.Form(objItem)) + "</" + objItem + ">" + chr(10)
	Next
	FormXML = FormXML + "</form>"+ chr(10)

	Form2XML = FormXML
End Function

Function Form2XMLwithSession
	Dim FormXML
	FormXML = "<?xml version=""1.0""?>" + chr(10)
	FormXML = FormXML & "<form>"+ chr(10)
	For Each objItem In Request.Form
		FormXML = FormXML + "<" + objItem + ">" +
ValidateXMLItemValue(Request.Form(objItem)) + "</" + objItem + ">" + chr(10)
	Next
	For Each objItem In Session.Contents
		If Not IsObject(Session.Contents(objItem)) and Not
IsArray(Session.Contents(objItem)) Then
			FormXML = FormXML + "<" + objItem + ">" +
ValidateXMLItemValue(Session.Contents(objItem)) + "</" + objItem + ">" +
chr(10)
		End If
	Next
	FormXML = FormXML + "</form>"+ chr(10)

	Form2XMLwithSession = FormXML
End Function

function ValidateXMLItemValue( XMLText )
	Dim objSTR
	set objSTR = CreateObject("Framework.StringFunctions")
	thisXMLText = objStr.StringReplace(XMLText, "<", "&lt;")
	thisXMLText = objStr.StringReplace(thisXMLText, "&", "&amp;")
	thisXMLText = objStr.StringReplace(thisXMLText, ">", "&gt;")
	thisXMLText = objStr.StringReplace(thisXMLText, """", "&quot;")
	thisXMLText = objStr.StringReplace(thisXMLText, "'", "&apos;")
	set objSTR = Nothing
	ValidateXMLItemValue = thisXMLText
end function

%>

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of dante
Sent: Thursday, 2 August 2001 9:32 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  HTML form contents => XML document


G'day all,

I'd like to have the contents of a form converted/exported into a xml
document
How can this be done server-side?
With PHP?
Perl/cgi?
or another method?
Has anyone seen an example of this or something similar?
See the form: http://www.vianet.net.au/~dante/xml/input_form.html

Thanks,
            Oliver Reid
            Perth, Western Australia
            dante@xxxxxxxxxxxxx
            www.vianet.net.au/~dante




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Re: variable, (continued)
    • James Melton - Wed, 1 Aug 2001 17:02:38 -0400 (EDT)
      • dante - Thu, 2 Aug 2001 08:05:14 -0400 (EDT)
        • cutlass - Thu, 2 Aug 2001 08:14:59 -0400 (EDT)
        • Matt Sergeant - Thu, 2 Aug 2001 08:53:41 -0400 (EDT)
        • Kevin Read - Thu, 2 Aug 2001 14:42:10 -0400 (EDT) <=
    • Oleg Tkachenko - Thu, 2 Aug 2001 03:49:14 -0400 (EDT)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.