Return-Path: Delivered-To: apmail-incubator-abdera-user-archive@locus.apache.org Received: (qmail 566 invoked from network); 31 Oct 2007 22:46:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Oct 2007 22:46:01 -0000 Received: (qmail 95573 invoked by uid 500); 31 Oct 2007 22:45:49 -0000 Delivered-To: apmail-incubator-abdera-user-archive@incubator.apache.org Received: (qmail 95554 invoked by uid 500); 31 Oct 2007 22:45:49 -0000 Mailing-List: contact abdera-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-user@incubator.apache.org Delivered-To: mailing list abdera-user@incubator.apache.org Received: (qmail 95545 invoked by uid 99); 31 Oct 2007 22:45:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 15:45:48 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [64.233.182.184] (HELO nf-out-0910.google.com) (64.233.182.184) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 22:45:49 +0000 Received: by nf-out-0910.google.com with SMTP id k4so290000nfd for ; Wed, 31 Oct 2007 15:45:27 -0700 (PDT) Received: by 10.78.200.3 with SMTP id x3mr6642841huf.1193870726917; Wed, 31 Oct 2007 15:45:26 -0700 (PDT) Received: by 10.78.184.4 with HTTP; Wed, 31 Oct 2007 15:45:26 -0700 (PDT) Message-ID: <7c8978aa0710311545p1c59210erfc95584c35f593bd@mail.gmail.com> Date: Wed, 31 Oct 2007 15:45:26 -0700 From: "Woody Anderson" To: abdera-user@incubator.apache.org Subject: Re: extensionfactory to handle bad namespace In-Reply-To: <4728DFD1.6050202@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c8978aa0710311247q55bd766bm42c88eadcd1e2c8e@mail.gmail.com> <4728DFD1.6050202@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ok. i tried to do this, but it seems i'm not understanding something with regard to the getElementWrapper method.. and now the mimetype (per Element?) public class AliasNamespacesFactory implements ExtensionFactory { HashSet _namespaces = new HashSet(); public AliasNamespacesFactory( Set namespaces ) { _namespaces.addAll( namespaces ); } public T getElementWrapper(Element internal) { // ???????? } public String getMimeType(T base) { // ?????????? } public String[] getNamespaces() { return _namespaces.toArray( new String[ _namespaces.size() ] ); } public boolean handlesNamespace(String namespace) { return _namespaces.contains( namespace ); } } do i have to have a if/else to instantiate FOMEntry, FOMLink, etc.. ? most of the constructors are protected, which makes that sort of a non-starter. FOMFactory seems to have a lot of methods, but these take objects that i don't have at my disposal. And these seem much more geared toward creation for population, not for cloning or refacing an existing "Element". do i need to basically recreate the FOMFactory for myself? and subsequently all of the objects? on a complete hack approach: if i ask the ClientResponse for a reader and put the entire response in a string replacing the namespace with the "correct" namespace. i could just ask for the default parser and continue right? i mean this would be ugly in the extreme, but it sounds only slightly worse than recreating the entire FOM factory just to change broken-ns to atom-ns. and the only other way i see to get in front of the system is to front a stream reader via. createXMLStreamReader, but that seems tied up in axiom.. which is an extra helping of confusing. thoughts? -w On 10/31/07, James M Snell wrote: > Ok, this is actually somewhat difficult right now but definitely > possible. What you'd need to do is create a custom ExtensionFactory > implementation (that does not extend AbstractExtensionFactory) and use > that to create the appropriate objects. The getElementWrapper method is > not required to return an instance of an actual ElementWrapper subclass. > > It would take a bit of work to do, because the internal element passed > in to getElementWrapper would need to be used to create a new instance > of the appropriate FOM impl. > > It's entirely possible that this could be made easier. > > - James > > Woody Anderson wrote: > > hello, > > > > i'm getting an errant namespace in responses from various servers. > > > > e.g. > > > > > > Example Title > > Example Text > > > >
Example Text
> >
> > urn:lj:livejournal.com:atom1:username:number > > > rel="service.edit" > > href="http://www.livejournal.com/interface/atom/edit/3" title="Example > > Title"/> > > > rel="alternate" href="http://username.livejournal.com/number.html" > > title="Example Title"/> > >
> > > > i want to handle this as though it were a correctly namespaced entry. > > all types of elements from this server comeback with this namespace, > > so i need this for each of the model elements. > > > > I'm a bit confused about how i do this for all elements. I've been > > looking at AbstractExtensionFactory. > > and ExtensionFactory docs, but it is unclear what getElementWrapper() > > is supposed to do to make it all "work". > > > > i would hope that it's fairly simple to consume this bogus namespace. > > > > i found an old example doing something *similar* that extended > > FOMExtensionFactory (which no longer exists..) to handle an Atom03 > > feed. This example doesn't work anymore and was still pretty confusing > > as it seemed to work for Feed only. > > > > is there a simple way to handle this errant ns? > > thanks > > -w > > >