RSS 2.0 question - why are "=" characters not allowed in URLs, even inside the <link> tag?

J

Jake Barnes

Very odd. Check out this RSS feed that my PHP script just built:

http://www.tagcastle.com/rss/photography.xml

When I had a straight URL in the <link> tag, or the <comment> tag, then
"=" character drew an error and caused my XML to be not-well-formed. So
I hit it with the PHP command rawurlencode, and now it draws no error,
but it no longer works as a link.

What did I do wrong?
 
J

Jake Barnes

Jake said:
Very odd. Check out this RSS feed that my PHP script just built:

http://www.tagcastle.com/rss/photography.xml

When I had a straight URL in the <link> tag, or the <comment> tag, then
"=" character drew an error and caused my XML to be not-well-formed. So
I hit it with the PHP command rawurlencode, and now it draws no error,
but it no longer works as a link.

What did I do wrong?

I should add, when I don't hit the query string with rawurlencode(),
I"m getting this error:

XML Parsing Error: not well-formed

Location: http://www.tagcastle.com/rss/photography.xml
Line Number 7, Column 77:

<link>http://www.tagcastle.com/index.php?whatPage=showOneTag.php&whatTag=photography</link>
--------------------------------------------------------------------------------------------------------^
 
N

Nadeem

Jake Barnes said:
I should add, when I don't hit the query string with rawurlencode(),
I"m getting this error:

XML Parsing Error: not well-formed

Location: http://www.tagcastle.com/rss/photography.xml
Line Number 7, Column 77:

<link>http://www.tagcastle.com/index.php?whatPage=showOneTag.php&whatTag=photography</link>
--------------------------------------------------------------------------------------------------------^


Perhaps it's the & that's causing the problem - try &amp; instead

HTH

Nadeem
 
M

Michael Winter

Jake Barnes wrote:
[snip]
When I had a straight URL in the <link> tag, or the <comment> tag, then
"=" character drew an error and caused my XML to be not-well-formed.

This has nothing to do with an equals symbol, though it took your
follow-up to identify the problem clearly.

[snip]

In XML (HTML, too) an ampersand (&) marks the beginning of an entity
reference. All 'Name' characters (in brief: mainly letters and numbers)
after that, up to a semicolon (;)[1], identify that entity. The entity
reference above (&whatTag;, I suppose) not only fails to end with a
semicolon, but doesn't exist anyway.

Long story short, the ampersand needs to be changed to an entity
reference, &amp;, just as it would need to be in HTML.

Mike


[1] As I understand it, in SGML, and therefore HTML
(technically), the semicolon wasn't necessary, and the first
character that didn't match the 'name' token would end the
reference. XML is more strict, however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top