Sigh. I wish it weren't done that way.

The Description contains text. Sometimes that text is intended to be
interpreted itself as HTML.

When you read the outer XML (i.e. the <Description> tag), the contents
are interpreted as text. The &lt; turns into <.

Now, if you want to "properly" display that, you have to parse that
text as HTML. Not XML, since it's likely not valid XHTML And then
render it as a HTML, not text.

However, if you're not displaying that description as HTML in a
browser, you'll need to strip out the tags. Some of them you can leave
in -- Android supports tags like <b> to make things bold, etc; see the
Html class's javadoc.

On Mar 23, 12:43 pm, alejandro <alejandr...@gmail.com> wrote:
> Thanks Bob,
> Something more is going bad , I'm trying to parse the RSS with Sax
> component , but in some situtions like :
>
> <Description>&lt;p&gt; [...] </Description>
>
> It extrac this content at description part    " < " , y think that is
> decoding "&lt;" like the beginning of a new xml tag
>
> It's difficult to explain, sorry.
>
> If someone understand me or have an example about RSS parser it could
> be helpfull.
> Thanks
>
> On 23 mar, 07:12, Bob Kerns <r...@acm.org> wrote:
>
>
>
> > Your English is fine, it's your HTML that has problems!  (English is
> > harder!)
>
> > Well, first, you should use all lower-case in your HTML these days.
> > Certainly, not mixed case!
>
> > Second -- you just fed it text, with the '<' and '>' properly encoded
> > as text. So it did just what you asked it to.
>
> > If you want HTML tags to be processed, you have to supply them as HTML
> > tags. That means no &lt; and no &gt;
>
> >         String s = new String("<img src='http://www.december.com/html/
> > images/icon.gif' alt='logo'>");
>
> > Perhaps you got this from some site which did this trying to get it to
> > display correctly, but it wasn't needed...?
>
> > On Mar 21, 11:28 am, alejandro <alejandr...@gmail.com> wrote:
>
> > > Hi!
> > > I want to render one UTF-8 encoded string what is provided by a rss
> > > feed like that:
>
> > >  WebView webview = new WebView(this);
> > >         setContentView(webview);
> > >         String s = new String("&lt;IMG Src='http://www.december.com/
> > > html/images/icon.gif' alt='logo'&gt;");
> > >         webview.loadData(s, mimeType, encoding);
>
> > > it shows at the emulator
> > >        <IMG Src='http://www.december.com/html/images/icon.gif'
> > > alt='logo'>
> > > like plain text , but it isn't rendered ....
> > > What I'm doing bad?
>
> > > thanks in advance , and sorry if my english is not correctly.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to