abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Klein" <jeff.kl...@markmonitor.com>
Subject RE: Parsing XHTML from Atom using Abdera
Date Wed, 07 Jul 2010 23:29:11 GMT
The elements inside of the <content> tag can be any arbitrary XML or text, so the Abdera
API's are not intended to operate on them. Probably the quickest solution would be to write
an XPATH expression in XSLT to drill down to the bit of content you are interested in.  Alternatively,
you could use a third party XML parsing API (there are a bunch to choose from out there),
but that might be slightly more effort. 


-----Original Message-----
From: Chaitali Gupta [mailto:chaitaligupta80@yahoo.com] 
Sent: Wednesday, July 07, 2010 4:00 PM
To: user@abdera.apache.org
Subject: RE: Parsing XHTML from Atom using Abdera

But how do I extract the elements under div? For example,  how do I extract whatever there
within the "entry_content"? I mean to say I want to extract "Some Content" from the div element.
How do I do that if I take it in string? I dont want to string compare, but rather like to
use Abdera Div element. 

 <div class="entry-content">
   <p>"Some Content"</p>


--- On Wed, 7/7/10, Jeff Klein <jeff.klein@markmonitor.com> wrote:

From: Jeff Klein <jeff.klein@markmonitor.com>
Subject: RE: Parsing XHTML from Atom using Abdera
To: user@abdera.apache.org
Date: Wednesday, July 7, 2010, 6:01 PM


You can get the <div> element as a String by calling content.getValue() in the putEntry()
or postEntry() method implementation of your CollectionAdapter.


    public SomeObject postEntry(String title, IRI id, String summary,
            Date updated, List<Person> authors, Content content,
            RequestContext request) throws ResponseContextException {

        String theDiv = content.getValue();
        return new SomeObject(theDiv);

Hope this helps.


-----Original Message-----
From: Chaitali Gupta [mailto:chaitaligupta80@yahoo.com] 
Sent: Wednesday, July 07, 2010 2:12 PM
To: user@abdera.apache.org
Subject: Parsing XHTML from Atom using Abdera


I need to parse an ATOM using Abdera. But the ATOM contains entries with XHTML content. Here
is an example of how each entry look like -

<entry xmlns="http://www.w3.org/2005/Atom">
    <title type="text">SomeTitle</title>
        <name>Some Author </name>
    <content type="xhtml">
        <div xmlns="http://www.w3.org/1999/xhtml">
            <div class="hnews hentry item">
        <div class="hmedia">
    <a rel="enclosure" type="image/jpeg" href="some reference">
      <img border="0" class="photo" src="some src "></img>
    <div class="fn">Some comment</div>
  <div class="entry-content">
    <p>"Some Content"</p>
    <p>"More Content"</p>

My question is how can I parse the div element and extract images and "entry-content". From
each Abdera Entry object, how do I get Div object? 




View raw message