# Ruby-Feed parser and relative URL references

**URL:** <https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391>\
**Category:** Ruby\
**Created:** [December 30, 2005, 5:45pm UTC](https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391 "2005-12-30T17:45:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@eduard](https://www.ruby-forum.com/u/eduard)\
**Post date:** [December 30, 2005, 5:45pm UTC](https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391/1 "2005-12-30T17:45:05Z")

</div>

I am using Ruby-Feedparser and it works great, but when I try to parse a  
feed in which description contains relative URL references, I get an  
error:

(REXML::ParseException) “#\<REXML::ParseException: Declarations can only  
occur in the doctype declaration.\nLine: \nPosition: \nLast 80  
unconsumed  
characters:\n\<![CDATA[

Filed under: \<a href="  
[http://engadget.com/category/cellphones/\](http://engadget.com/category/cellphones/%5C)[http://engadget.com/category/cellphones/\](http://engadget.com/category/cellphones/%5C)”  
rel="\>\n/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:325:

Is there a workaround?

Thanks,  
eduard

---

<div class="post-metadata">

**Author:** ![eduard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@eduard](https://www.ruby-forum.com/u/eduard)\
**Post date:** [December 30, 2005, 6:07pm UTC](https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391/2 "2005-12-30T18:07:01Z")

</div>

On 12/30/05, eduard [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am using Ruby-Feedparser and it works great, but when I try to parse a  
> feed in which description contains relative URL references, I get an error:
> 
> (REXML::ParseException) “#\<REXML::ParseException: Declarations can only  
> occur in the doctype declaration.\nLine: \nPosition: \nLast 80 unconsumed  
> characters:\n\<![CDATA[
> 
> Filed under: \<a href="  
> [http://engadget.com/category/cellphones/\](http://engadget.com/category/cellphones/%5C)[http://engadget.com/category/cellphones/\](http://engadget.com/category/cellphones/%5C)”  
> rel="\>\n/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:325:
> 
> Is there a workaround?

That feed doesn’t validate at [http://www.feedvalidator.org/](http://www.feedvalidator.org/) but for  
different reasons than your are experiencing.

People need to validate feeds and complain to the authors. If feed  
validation gets out of control we will be back to the HTML mess.

> **[XML Errors in Feeds](http://googlereader.blogspot.com/2005/12/xml-errors-in-feeds.html)**
>
> Posted by Mihai Parparita, Software Engineer Dealing with the millions of RSS and Atom feeds out there is hard work. We're not trying to ma...

---

<div class="post-metadata">

**Author:** ![eduard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@eduard](https://www.ruby-forum.com/u/eduard)\
**Post date:** [December 30, 2005, 7:59pm UTC](https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391/3 "2005-12-30T19:59:04Z")

</div>

Is this the feed you are using?

Source: [\<![CDATA[Engadget is a web magazine with obsessive daily coverage of everything new in gadgets and consumer electronics]]\>](http://engadget.com/category/cellphones/rss.xml)  
This feed does not validate.  
line 404, column 1805: Undefined named entity: hellip [help]  
… Watch movies on your phones… while  
they're stil …  
It is missing the external entity declaration.

From your mail you are getting an error about a malformed CDATA  
section but I can’t find a feed with that error.

You can do basic checking just by putting the feed URL into Firefox  
and see if it parses without error.  
[\<![CDATA[Engadget is a web magazine with obsessive daily coverage of everything new in gadgets and consumer electronics]]\>](http://engadget.com/category/cellphones/rss.xml) will give you an  
error.

---

<div class="post-metadata">

**Author:** ![eduard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@eduard](https://www.ruby-forum.com/u/eduard)\
**Post date:** [December 30, 2005, 6:25pm UTC](https://www.ruby-forum.com/t/ruby-feed-parser-and-relative-url-references/51391/4 "2005-12-30T18:25:14Z")

</div>

Thanks Jon,

I validated the feed with [feedvalidator.org](http://feedvalidator.org) before posting the message  
and  
it said:

“This feed is valid, but may cause problems for some users.” Obviously,  
I  
am one of those users.

I’ll write email to engadget and tell them about the problem.

Thanks for your help,  
eduard
