Re: Proposal for a XML_Atom Library in the PEAR packages

From: Date: Fri, 05 Sep 2008 19:22:30 +0000
Subject: Re: Proposal for a XML_Atom Library in the PEAR packages
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-50717@lists.php.net to get a copy of this message
Hi Mike, thank you for your answer ! Indeed, your code and mine are similar :-) Actually, I'm trying to go further in the parsing of an Atom feed. Indeed according to the Relax NG schema ( http://www.atomenabled.org/developers/syndication/atom-format-spec.php), most of the Atom elements could have attributes; so may be in your code, you could also add that information to respect even more the Atom Syndication format. My last problem is the parsing of namespaces attributes. Indeed, when I use the php DOM to convert an xml flow in a DOMDocument, namespaces are not known as attributes. So i am compelled to use the "hasAttributeNS". But the problem is that for an Atom element, we could have many namespaces. Example: <feed xmlns="..." xmlns:test1="..." attr="value">...</feed> In this example, when i convert that feed in a DOMDocument, only the pair [attr, value] is recognized. Have somenone already noticed that problem ? Chrislain. On Fri, Sep 5, 2008 at 5:52 PM, Michael Gauthier <mike@silverorange.com>wrote: > Hi Chrislain, > > I wrote an XML_Atom package but never pushed it to PEAR because I didn't > have time to write proper API documentation. It uses the DOM extension > to create and render Atom documents. My package doesn't handle any of > the publishing protocol, only the syndication format. > > You can check out my code at > https://code.silverorange.com/browser/public/xml-atom/trunk . > It's also > available as a package 'XML_Atom' in the PEAR channel > pear.silverorange.com. > > At first glance, what you've written seems very similar. I think a > comprehensive XML_Atom proposal should include: > > 1.) Ability to write Atom feeds (like my XML_Atom package and your Atom > package) > > 2.) Ability to parse existing atom feeds into PHP objects. This should > be fairly easy once #1 is done. > > 3.) Atom publishing protocol. Incomplete proposal at > http://pear.php.net/pepr/pepr-proposal-show.php?id=376 > > Anyway, I look forward to your proposal and maybe you can take some > ideas from my code :) > > > Mike > > On Fri, 2008-09-05 at 15:26 +0200, Chrislain Jemba wrote: > > Hello, > > First of all, i would like to apologize for my english mistakes. > > > > In order to build a server-side implementation of the ATOM publishing > > protocol, i , first, planned to make a library which could easily handle > any > > Atom feed: > > - By converting an Atom feed in a PHP Atom_object > > - By converting a PHP Atom_Object in an Atom feed > > > > For sure, this library will strictly follow the Atom Syndication Format. > > > > From now here is an example of implementation: > > > > $feed=new Atom_Feed(); > > $feed->addAttribute('class','test'); > > * $feed->setTitle(new Atom_Title('Example Feed', > array('key'=>'value'))); > > * > > $feed->addLink(new Atom_Link(null,array('href'=>' > http://example.org/' > <http://example.org/%27>)) > > ); > > $feed->setUpdated(new Atom_Updated(new DateTime('2003-12-13 18:30:02 > > GMT'))); > > $feed->addAuthor(new Atom_Author('John Doe')); > > $feed->setId(new > > Atom_Id('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6')); > > $entry = new Atom_Entry(); > > $entry->setTitle(new Atom_Title('Atom-Powered Robots Run Amok')); > > $entry->addLink(new Atom_Link(null,array('href'=>' > > > > http://example.org/2003/12/13/atom03'))<http://example.org/2003/12/13/atom03%27%29%29> > ); > > $entry->setId(new > > Atom_Id('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a')); > > $entry->setUpdated(new Atom_Updated(new DateTime('2003-12-13 18:30:02 > > GMT'))); > > $entry->setSummary(new Atom_Summary('Some text.')); > > $feed->addEntry($entry); > > > > You may be think at a first glance, that this implementation is too > complex. > > Therefore, I also planned to enable that kind of syntax > > *$feed->setTitle('Example feed', > > array('key'=>'value'))* > > > > I think this second example could be more pleasant to implement, but the > > good thing in the first example, is that we control the type of the > > parameter > > Therefore i would like to have your opinion and may be your approval for > > that project, before trying to create an account on the PEAR website. > > Thanks a lot for your answers. > >

« previous php.pear.dev (#50717) next »