Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 70259 invoked by uid 500); 16 May 2003 14:39:04 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 70217 invoked by uid 500); 16 May 2003 14:39:03 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 70192 invoked from network); 16 May 2003 14:39:03 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 16 May 2003 14:39:03 -0000 Received: (qmail 15571 invoked by uid 1509); 16 May 2003 14:39:03 -0000 Date: 16 May 2003 14:39:03 -0000 Message-ID: <20030516143903.15570.qmail@icarus.apache.org> From: stephan@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/xml/xlink ExtendedXLinkPipe.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N stephan 2003/05/16 07:39:03 Modified: . status.xml src/java/org/apache/cocoon/xml/xlink ExtendedXLinkPipe.java Log: Patch 19786 applied. Revision Changes Path 1.35 +3 -0 cocoon-2.1/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/status.xml,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- status.xml 16 May 2003 13:35:56 -0000 1.34 +++ status.xml 16 May 2003 14:39:02 -0000 1.35 @@ -180,6 +180,9 @@ + + Extended the ExtendedXLinkPipe to be more extensible. Prepared is html and p3p. + Patch velocity generator, so that the scope of objects can be specified (request, session, sitemap). 1.2 +68 -48 cocoon-2.1/src/java/org/apache/cocoon/xml/xlink/ExtendedXLinkPipe.java Index: ExtendedXLinkPipe.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/xml/xlink/ExtendedXLinkPipe.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ExtendedXLinkPipe.java 9 Mar 2003 00:09:48 -0000 1.1 +++ ExtendedXLinkPipe.java 16 May 2003 14:39:02 -0000 1.2 @@ -53,6 +53,10 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; /** * This class extends the XLink semantic capabilities to understand those @@ -68,66 +72,82 @@ * be a way to remove this, that will be a happy day for XML and for Cocoon too. * * @author Stefano Mazzocchi + * @author Torsten Knodt * @version CVS $Id$ */ public abstract class ExtendedXLinkPipe extends XLinkPipe { - public void startElement(String uri, String name, String raw, Attributes attr) throws SAXException { - if (uri != null) { - // Get namespaced attributes - - String href = attr.getValue(uri, "href"); - if (href != null) { - simpleLink(href, null, null, null, null, null, uri, name, raw, attr); - return; - } - - String src = attr.getValue(uri, "src"); - if (src != null) { - simpleLink(src, null, null, null, null, null, uri, name, raw, attr); - return; - } - - String background = attr.getValue(uri, "background"); - if (background != null) { - simpleLink(background, null, null, null, null, null, uri, name, raw, attr); - return; - } - } else { - uri = ""; - } + private static Set arrayToSet(Object[] array) { + final Set set = new HashSet(array.length); - // Get attributes without namespace too + for (int i = 0; i -1) newattr.setValue(hrefIndex, href); - int srcIndex = attr.getIndex(uri, "src"); - if (srcIndex > -1) newattr.setValue(srcIndex, href); - int backgroundIndex = attr.getIndex(uri, "background"); - if (backgroundIndex > -1) newattr.setValue(backgroundIndex, href); - super.startElement(uri, name, raw, newattr); + public void simpleLink(final String href, final String role, + final String arcrole, final String title, + final String show, final String actuate, + final String uri, final String name, + final String raw, + final Attributes attr) throws SAXException { + if (attrIndex!=-1) { + AttributesImpl newattr = new AttributesImpl(attr); + + newattr.setValue(attrIndex, href); + attrIndex = -1; + super.startElement(uri, name, raw, newattr); + } else { + super.simpleLink(href, role, arcrole, title, show, actuate, uri, + name, raw, attr); + } + } }