473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XML, asp amphasand

I have a .asp document on my server it goes as follows
---
<?xml version="1.0" standalone='yes'?>
<Restaurants>
<%
Dim objConn
Dim objRS

set objConn = Server.CreateObject("ADODB.Connection")
set objRS = server.CreateObject("ADODB.recordset")
objconn.open "Driver={SQL
Server};Server=localhost;Uid=user;Pwd=pass;Databas e=me"
objRS.activeconnection = objConn
objRS.open "SELECT RestaurantName, PremisesAddressLine1 as
Address
FROM tblRestaurantAccounts WHERE franchiseID= 16 and accountstatus=0"
do until objRS.eof
response.write vbtab & "<Restaurant>" & vbcrlf
response.write vbtab & vbtab & "<Shop>" &
objRS.fields("Restaurantname").value & "</Shop>" & vbcrlf
response.write vbtab & vbtab & "<Address>" &
objRS.fields("address").value & "</Address>" & vbcrlf
response.write vbtab & "</Restaurant>" & vbcrlf
objRS.movenext
loop
objRS.close
objConn.close
set objRS = nothing
set objConn = nothing
%>
</Restaurants>
---
the only problem is that it chokes when it gets a record entry that
contains a "&". what code do i need or what modifications to my code to

let this .asp document display a "well-formed" xml document?
thanks for your help
Jonathan Carl Broderick

Jul 19 '06 #1
4 1362
How about converting & to &amp; ?

Replace(objRS.fields("Restaurantname").value,"&",& amp;")

Cheers

Jul 19 '06 #2
OOPS - i missed a "

Replace(objRS.fields("Restaurantname").value,"&"," &amp;")
hiredgoon wrote:
How about converting & to &amp; ?

Replace(objRS.fields("Restaurantname").value,"&",& amp;")

Cheers
Jul 19 '06 #3

jb********@gmail.com wrote:
the only problem is that it chokes when it gets a record entry that
contains a "&". what code do i need or what modifications to my code to
Look up Server.HTMLEncode() (and its colleague .URLEncode() )

Don't do it "longhand" with string replace functions.

Jul 19 '06 #4
Excerlent, works a treat, cheers mate

hiredgoon wrote:
OOPS - i missed a "

Replace(objRS.fields("Restaurantname").value,"&"," &amp;")
Cheers
Jul 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jbroderick | last post by:
I have a .asp document on my server it goes as follows --- <?xml version="1.0" standalone='yes'?> <Restaurants> <% Dim objConn Dim objRS set objConn = Server.CreateObject("ADODB.Connection")...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.