Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 21st, 2006, 03:16 PM
Authorized User
 
Join Date: Apr 2006
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default ampersand in hyperlink is not working

Hi,
I have a link in my XML document with an ampersand in the URL. the XML parser will not validate since it thinks it is a reference entity, but it is not. The parser keep complaining that entity must end with a delimiter ";".
How can I work around this parsing error?
Please advise.

 
Old August 21st, 2006, 03:22 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well an ampersand in the representation of a URL is illegal so the parser is correct. How is the XML document being formed?

--

Joe (Microsoft MVP - XML)
 
Old August 21st, 2006, 03:24 PM
Authorized User
 
Join Date: Apr 2006
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not sure if I understand what you are asking me.
I keep getting an XML file not formed.
here is a part of the link.
"&blnSearchResults"

 
Old August 21st, 2006, 03:38 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

An ampersand in XML must always be written as & (that's &_amp; without the underscore).

For example the URL posted with this message:

http://p2p.wrox.com/post.asp?method=...44&FORUM_ID=85

would be represented in XML as

http://p2p.wrox.com/post.asp?method=...44&FORUM_ID=85

(again, without the underscore).

If you don't do that, it's not XML.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 21st, 2006, 03:39 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

(The second & should also be escaped as & of course)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 23rd, 2006, 04:27 PM
Authorized User
 
Join Date: Apr 2006
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried the suggested replacement of & with amp; and it worked.
thanks guys.






Similar Threads
Thread Thread Starter Forum Replies Last Post
ampersand problems with XML crmpicco Excel VBA 5 May 5th, 2005 06:33 AM
AMPERSAND disappears when given along with # happygv Forum and Wrox.com Feedback 2 October 25th, 2004 09:49 PM
Hyperlink column in datagrid not working ltdanp21 General .NET 1 July 13th, 2004 03:04 PM
Ampersand in a Query string nkunapaneni HTML Code Clinic 2 November 3rd, 2003 01:07 PM
ampersand in a querystring trangd Beginning PHP 3 October 23rd, 2003 07:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.