472,358 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Problems with <link> in a 0.91 RSS

Hello.

I'm trying to build a RSS feed for my website. It starts:

----------------//---------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
----------------//----------------------

And an item could be:
--------//--------------
<item>
<link>http://www.mydomain.com</link>
<title>Foo</title>
</item>
------//---------------

If instead of 'http://www.mydomain.com', I set
'http://www.mydomain.com/mypage.aspx?ID=1&cod=9&num=20031206'
I get problems of validation (some RSS readers do not read it).

Does exist any problem with these kind of URLs?

Thank you very much.
Jul 20 '05 #1
9 2801
On 6 Dec 2003 07:48:23 -0800, fr**********@europe.com (Francesco Moi)
wrote:
If instead of 'http://www.mydomain.com', I set
'http://www.mydomain.com/mypage.aspx?ID=1&cod=9&num=20031206'
I get problems of validation (some RSS readers do not read it).


Try this instead

http://www.mydomain.com/mypage.aspx?...p;num=20031206
It's an XML entity issue, not RSS

Jul 20 '05 #2

To futher clarify, XML itself requires that a certain 5 characters should always
be entity encoded if used within an element or attribute value.

& - &amp;
< - &lt;
- &gt; ' - &apos;
" - &quot;

The one thing to guard against is double encoding. Do not re-encode n already
encoded entity. As in don't create &amp;amp;

This is less of an issue inside the link element than it is inside the
descriptions.

While many folks argue about this, the most commonly used and least distruptive
form is a single encoding of markup. For example, an HTML snippet of "this text
has both <b>bold</b> & <i>italic</i> text". The least harmful way to encode
this is "this text has both &lt;b&gt;bold&lt;/b&gt; &amp; &lt;i>italic&lt;/i&gt;
text". Sure, if the generating tool can /properly/ assure it's well-formed it's
perfectly reasonable to use XHTML instead. But most applications don't
consistently guarantee that their text will be valid, let alone well-formed. In
a perfect world it would be arguably superior to avoid using markup encoding.
Until that time arrives (don't hold your breath) using a single pass of encoding
has shown itself to be the most workable all-around.

-Bill Kearney
www.Syndic8.com - The worlds largest directory of RSS content

"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:h7********************************@4ax.com... On 6 Dec 2003 07:48:23 -0800, fr**********@europe.com (Francesco Moi)
wrote:
If instead of 'http://www.mydomain.com', I set
'http://www.mydomain.com/mypage.aspx?ID=1&cod=9&num=20031206'
I get problems of validation (some RSS readers do not read it).


Try this instead

http://www.mydomain.com/mypage.aspx?...p;num=20031206
It's an XML entity issue, not RSS


Jul 20 '05 #3
In article <Jr********************@speakeasy.net>,
Bill Kearney <wk********@hotmail.com> wrote:

% To futher clarify, XML itself requires that a certain 5 characters should always
% be entity encoded if used within an element or attribute value.
%
% & - &amp;
% < - &lt;
% > - &gt;
% ' - &apos;
% " - &quot;

You waffle a bit there (requires ... should), but I'm going to disagree
anyway. Except when used in a CDATA section, & and < must always be
encoded. On the other hand, > never needs to be encoded. and ' and "
need be encoded only in attribute values, and only when they match the
value's delimiter. It is legal to encode any of the five outside a CDATA
section, but not always required.

My personal opinion is that you're better off using the predefined
entities as little as possible. It's hard to avoid using &amp;, but
I would always encode your example using a CDATA section

<![CDATA[this text has both <b>bold</b> & <i>italic</i> text]]>

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #4
On Wed, 10 Dec 2003 12:43:05 -0500, "Bill Kearney"
<wk********@hotmail.com> wrote:
The one thing to guard against is double encoding. Do not re-encode n already
encoded entity. As in don't create &amp;amp;


You often can't avoid this happening, especially not in an RSS-like
context where you're handling material that may already be encoded.

But if it does, make sure that your de-coding and en-coding is
balanced.

Jul 20 '05 #5
The one thing to guard against is double encoding. Do not re-encode n alreadyencoded entity. As in don't create &amp;amp;
You often can't avoid this happening, especially not in an RSS-like
context where you're handling material that may already be encoded.


Then your code better work at improving the situation. Honestly, don't pass
along crap.
But if it does, make sure that your de-coding and en-coding is
balanced.


Sure, the trick lies in making sure the input is decoded properly and passed
along with the proper encoding as well.

It's not all that hard but it can be tedious to code properly.

-Bill Kearney

Jul 20 '05 #6
> You waffle a bit there (requires ... should), but I'm going to disagree
anyway. Except when used in a CDATA section, & and < must always be
encoded. On the other hand, > never needs to be encoded. and ' and "
need be encoded only in attribute values, and only when they match the
value's delimiter. It is legal to encode any of the five outside a CDATA
section, but not always required.
Well, what's better, to worry about the if's and when's or to encode them
consistently?
My personal opinion is that you're better off using the predefined
entities as little as possible. It's hard to avoid using &amp;, but
I would always encode your example using a CDATA section

<![CDATA[this text has both <b>bold</b> & <i>italic</i> text]]>


Sure, provided tools understand how to use CDATA properly (many don't).

Jul 20 '05 #7
On Thu, 11 Dec 2003 11:28:46 -0500, "Bill Kearney"
<wk********@hotmail.com> wrote:

[double encoding]
You often can't avoid this happening, especially not in an RSS-like
context where you're handling material that may already be encoded.
Then your code better work at improving the situation. Honestly, don't pass
along crap.


Rubbish. The _last_ thing your code should ever do is to try and "fix
up" content in transit. (Especially note the "in transit")

Multiple encoding is perfectly safe, and can be decoded perfectly by
applying the appropriate number of decodes. Where it goes wrong is
when someone breaks this number - encoding more than they should, or
less than they should. But I would _much_ rather receive the
occasional bit of extra-encoded garbage (it's semantically wrong, but
it's still well-formed XML) rather than run the risk of getting things
which have been "smart de-encoded" by something en-route that
"thought" it ought not to see an entity in that location and so
decided to decode the lot. That means it's no longer well-formed, and
that causes a lot of trouble down the line.

If you're _really_ worried about never rendering "&amp;" on screen for
the poor squeamish user, then do this in the user agent at the very
last point, when there's _no_ risk of it being propagated further.
This is also a good time to do it, as it's clearer (sic) here what the
content author's original intent was (maybe they're writing an RSS
feed of HTML coding tips and the entity is deliberate).

Are you really part of syndic8 ? Is this their official policy ?
--
Die Gotterspammerung - Junkmail of the Gods
Jul 20 '05 #8
In article <xM********************@speakeasy.net>,
Bill Kearney <wk********@hotmail.com> wrote:
% > You waffle a bit there (requires ... should), but I'm going to disagree
% > anyway. Except when used in a CDATA section, & and < must always be
% > encoded. On the other hand, > never needs to be encoded. and ' and "
% > need be encoded only in attribute values, and only when they match the
% > value's delimiter. It is legal to encode any of the five outside a CDATA
% > section, but not always required.
%
% Well, what's better, to worry about the if's and when's or to encode them
% consistently?

I guess, it depends on your goals. If you're writing what's `required',
I think it's better to be correct. If you have trouble keeping track
of when to use pre-defined entities, then you can take comfort in
the fact that it's always allowed, and not worry about when it's required.

% > My personal opinion is that you're better off using the predefined
% > entities as little as possible. It's hard to avoid using &amp;, but
% > I would always encode your example using a CDATA section
% >
% > <![CDATA[this text has both <b>bold</b> & <i>italic</i> text]]>
%
% Sure, provided tools understand how to use CDATA properly (many don't).

Well, why use these tools? What's the point of pretending to use XML if
you're really spending your life worrying about whether your tools can
support the basic syntax? It's fair enough to say that you'd prefer to
always use the predefined entities, but lack of CDATA support doesn't
merit consideration.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #9
On Thu, 11 Dec 2003 19:59:14 +0100 (MET), pt**@interlog.com (Patrick
TJ McPhee) wrote:
What's the point of pretending to use XML if
you're really spending your life worrying about whether your tools can
support the basic syntax?


We're dealing with RSS 0.91 here. The spec for the content here is
"ASCII", not even CDATA or PCDATA (Yes, Dave Winer's lousy
spec-writing).

If you do anything vaguely clever in the RSS field, it;'s likely to
break other people's (broken) code all over the place. It sucks, but
there you have it - your call.
--
Die Gotterspammerung - Junkmail of the Gods
Jul 20 '05 #10

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

Similar topics

6
by: Todd Peterson | last post by:
I'm encountering some wierd behavior with a <link> tag over an HTTPS connection, vs. an HTTP connection... In an ASP/HTML page on my website, I've add a <link rel="shortcut icon"...> in order to...
2
by: Hernán Castelo | last post by:
hi i'm trying to do : <link rel="stylesheet" type="text/css" href="myurl..../inc/css/style.css"/> from the url field of the browser i can normally open the "style.css" with notepad but thru...
2
by: brw | last post by:
Is there a way to dynamically add a link tag to the head block of an ..aspx page? I'm aware that you can add a link tag (or literal control) statically and then dynamically modify the attributes....
4
by: Jake Barnes | last post by:
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 "="...
1
by: Baldoni | last post by:
It's been years since putting together a page. This line in my HTML: <link type="text/css" rel="stylesheet" href="net4801style.css"> gives this problem (via weblint HTML checker): attribute...
17
by: The Numerator | last post by:
I know a lot about HTML, but all this time I don't know what the <LINK> tags in the head do. There are those that call a stylesheet, favicon, etc. But what about those that state the contents of...
4
by: John A Grandy | last post by:
When constructing an RSS 2.0 XML doc , should the <channel><link> element's value be 1. the url of the page the displays the content that the RSS feed describes : fox example:...
1
by: Doug.Sheahan | last post by:
I am attempting to parse and xml file using javascript but am running into a problem when parsing a <link></link> pair. For example, the link information in most RSS feeds is given as <link> ...
9
by: Arancaytar | last post by:
I have so far seen two methods for including external resources as CSS stylesheets in a document. The first is this: <link href="/stylesheets/style.css" rel="stylesheet" type="text/css" /> And...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.