ASP Syntax

bschwarting
bschwarting used Ask the Experts™
on
Why can't I get this to work?  Here is the error.

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/updated/insert.asp, line 41
line1 = "<?xml version="1.0" encoding="UTF-8"?>"
------------------------------^
line1 = "<?xml version="1.0" encoding="UTF-8"?>"

f.WriteLine(line1)

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011

Commented:
Have no idea what you are trying to do but change to single quoes like:

line1 = "<?xml version='1.0' encoding="UTF-8"?>"

f.WriteLine(line1)
Top Expert 2011

Commented:
line1 = "<?xml version='1.0' encoding='UTF-8'?>"

I missed the utf-8...

Author

Commented:
Inside the quotes needs to stay exactly how it is.  I'm writing a bunch of stuff out to a text file, in a loop, and this has to be the header.
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Top Expert 2011
Commented:
It *won't* work unless you either do it that way or double up on the double quotes like:

line1 = "<?xml version=""1.0"" encoding=""UTF-8"">"

Author

Commented:
ah!  you da man!  double quotes worked great!
Top Expert 2011

Commented:
You can also try this:
Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial