UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Recordset XML and the dreaded "&" and tick    
 
   
akhound
post Dec 5 2007, 03:36 PM
Post #1

UtterAccess Member
Posts: 32
From: NE



I'm dumping a recordset out into XML and would like to know if anyone knows of a way to change the ampersands to &amp and the apostrophes to &apos as its building the XML. I am doing this in ASP not right in access.

Darren


Edited by: akhound on Wed Dec 5 15:38:07 EST 2007.
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 2)
HiTechCoach
post Dec 5 2007, 03:39 PM
Post #2

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



Darren

I would probably use the Replace() function to format the data before exporting.

CODE
Replace( Replace([field],"&","&amp") , "'","&apos")


See:
http://www.w3schools.com/vbscript/func_replace.asp

Iy you have more to do them use a function, something like:

CODE
FUNCTION PreSubmit(p_sTargetString)

   PreSubmit = REPLACE(p_sTargetString,”textarea”,”")

   PreSubmit = REPLACE(PreSubmit,"'","&apos")

   PreSubmit = REPLACE(PreSubmit,"&","&amp")

   PreSubmit = Trim(PreSubmit)

END FUNCTION


Edited by: HiTechCoach on Wed Dec 5 15:49:41 EST 2007.
Go to the top of the page
 
+
Dragyn
post Dec 5 2007, 03:42 PM
Post #3

UtterAccess Addict
Posts: 152
From: Omaha, NE



I believe you can also use an escape() function to convert all bothersome characters to safe alternatives. (And use and unescape() to put it back)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 02:53 AM