Return-Path: Delivered-To: apmail-incubator-abdera-user-archive@locus.apache.org Received: (qmail 63089 invoked from network); 6 Nov 2007 00:55:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2007 00:55:02 -0000 Received: (qmail 38717 invoked by uid 500); 6 Nov 2007 00:54:50 -0000 Delivered-To: apmail-incubator-abdera-user-archive@incubator.apache.org Received: (qmail 38701 invoked by uid 500); 6 Nov 2007 00:54:50 -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 38692 invoked by uid 99); 6 Nov 2007 00:54:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Nov 2007 16:54:50 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jasnell@gmail.com designates 209.85.198.184 as permitted sender) Received: from [209.85.198.184] (HELO rv-out-0910.google.com) (209.85.198.184) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2007 00:54:50 +0000 Received: by rv-out-0910.google.com with SMTP id k20so1641576rvb for ; Mon, 05 Nov 2007 16:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; bh=rnmlNjSi6twE6GSdRKfCKgORd4Nq3Wlc+iyuPPSmA8U=; b=LJPwtlUdddB9VJ9DZJH5Nbf7ma1ruNmkAsC1yone6pUurZCXeHRH7xF434REshsJ/7ZF7CsuDdja9X/sfC/Ie/WCcfh5E1K/p8i2CqZNdWCOWtjW3OHtwHJ+niZCxTaTPFAVOPYez/WiN7Vq7Y0dZrMs5Uuzp1oQvvxT+JdPflI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=R69dsP6o4gMn3qo1WT66C+yI2MkUyEjboDnNXqmtOSLETFsysd+UEIpTIhNAVTEpX7W4qx4qEUaWecNxxbYYo5uG2jTbcNEEWxif1mBq2+JqNi+oFY/4sh8TnmU7WLlcFLLvkZo87Rr8jp6y05MsuLax75lCW3Tkjn+RhPLe4GU= Received: by 10.141.44.13 with SMTP id w13mr2741742rvj.1194310468929; Mon, 05 Nov 2007 16:54:28 -0800 (PST) Received: from ?192.168.1.2? ( [67.181.218.96]) by mx.google.com with ESMTPS id l27sm13069287rvb.2007.11.05.16.54.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 05 Nov 2007 16:54:27 -0800 (PST) Message-ID: <472FBB41.8000801@gmail.com> Date: Mon, 05 Nov 2007 16:54:25 -0800 From: James M Snell User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: abdera-user@incubator.apache.org Subject: Re: extensionfactory to handle bad namespace References: <7c8978aa0710311247q55bd766bm42c88eadcd1e2c8e@mail.gmail.com> <4728DFD1.6050202@gmail.com> <7c8978aa0710311545p1c59210erfc95584c35f593bd@mail.gmail.com> <7c8978aa0711051651y63747e24we33b0677666097fd@mail.gmail.com> In-Reply-To: <7c8978aa0711051651y63747e24we33b0677666097fd@mail.gmail.com> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Will do; this is on my list of things to look at very soon. Right now I'm focusing on making some general performance improvements. - James Woody Anderson wrote: > so this is my current solution: > > Reader reader = response.getReader(); > String docStr = StreamUtils.getString( reader ); > > docStr = docStr.replace( "http://purl.org/atom/ns#", > > "http://www.w3.org/2005/Atom" ); > Parser parser = ABDERA.getParser(); > Document doc = parser.parse( new StringReader( docStr ) ); > > which works but is clearly a complete hack. > if it becomes easier to alias this namespace or handle this with an > extension factory, please let me know. > -w > > On 10/31/07, Woody Anderson wrote: >> 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 >>>> >