Question about using the Rome library for RSS

J

J_Zanetti

Hello everybody,

Im using the library Rome to create the RSS feed for the contents of my
application. I post my question on this ng since I dont know where I
can find experts on this library and I didnt find anything about it on
documentation :)
I have a problem trying to write the content of a tag, (ie TITLE). I
need to be able to write CDATA content instad of normal text, this
causes the creation of not well formed XML.
Is any function or external library that gives me a method to format a
text into CDATA or escape the wrong chars?

Thank you!
 
M

Manish Pandit

J_Zanetti said:
Hello everybody,

Im using the library Rome to create the RSS feed for the contents of my
application. I post my question on this ng since I dont know where I
can find experts on this library and I didnt find anything about it on
documentation :)
I have a problem trying to write the content of a tag, (ie TITLE). I
need to be able to write CDATA content instad of normal text, this
causes the creation of not well formed XML.
Is any function or external library that gives me a method to format a
text into CDATA or escape the wrong chars?

Thank you!

I have used Rome quite recently. In order to keep the well-formedness,
I used Apache's StringEscapeUtils. It has an API for escapeXML(String
yourString) : String which handles escaping the String for XML. I did
notice that I did not need it for RSS 1.0 and 2.0, but I ran into
issues with Atom 1.0. Eventually I ended up using this call for all the
content (link/title/description, etc.) for all feed types..to be safe.

Anyway, you might want to look into this API - It is a part of Apache
Commons' lang distribution. The version of Rome I am using is 0.9.

-cheers,
Manish
 
J

J_Zanetti

I used Apache's StringEscapeUtils.
I did notice that I did not need it for RSS 1.0 and 2.0, but I ran into
issues with Atom 1.0. Eventually I ended up using this call for all the
content (link/title/description, etc.) for all feed types..to be safe.

Thank you,
I will take a look at this API.
Why you say you didnt need this API for RSS 1.0 and 2.0? Do you think
Rome can handle the content itself?
Its strange that such useful tool like Rome doesn't provide any method
for CDATA contents. It would be nice to find a solution that allows me
to write special chars in my RSS.

Thanks!
 
J

J_Zanetti

I used Apache's StringEscapeUtils.

I tried this class...it works fine , thank you for your advice!
Just it is 200Kb library for a single function use, could this create
performances problems? Im kind of newbie ;)

Anyway the EscapeXML makes greatly its job!
Thanks again!!
 
M

Manish Pandit

Just it is 200Kb library for a single function use, could this create
performances problems? Im kind of newbie ;)

Anyway the EscapeXML makes greatly its job!
Thanks again!!

Glad it worked for you!

Yeah - I still do not know why the RSS 1.0 and 2.0 formats came out
just fine, even with malformed content in the description section. If I
run into any issue(s), I will let you know, so that you can take
appropriate measures in case you might encounter the same.

There should be no performance impact for that call - it is a local
method call. The only impact is that your distribution's footprint is
now 200k bigger due to the extra jar file :)

-cheers,
Manish
 

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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top