vgritsenko 2002/08/14 20:13:46 Modified: . Tag: cocoon_2_0_3_branch changes.xml . changes.xml src/java/org/apache/cocoon/xml/xlink Tag: cocoon_2_0_3_branch ExtendedXLinkPipe.java Log: In addition to attributes in same namespace with elements, link serializer reacts on non-namespaced attributes too. This allows processing of (strict) XHTML. Revision Changes Path No revision No revision 1.138.2.46 +6 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.138.2.45 retrieving revision 1.138.2.46 diff -u -r1.138.2.45 -r1.138.2.46 --- changes.xml 11 Aug 2002 20:18:39 -0000 1.138.2.45 +++ changes.xml 15 Aug 2002 03:13:46 -0000 1.138.2.46 @@ -39,6 +39,11 @@ </devs> <release version="@version@" date="@date@"> + <action dev="VG" type="update"> + In addition to attributes in same namespace with elements, + link serializer reacts on non-namespaced attributes too. This allows + processing of (strict) XHTML. + </action> <action dev="CH" type="add"> Backport usage of InputModules to compiled sitemap. </action> 1.234 +6 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.233 retrieving revision 1.234 diff -u -r1.233 -r1.234 --- changes.xml 13 Aug 2002 02:37:29 -0000 1.233 +++ changes.xml 15 Aug 2002 03:13:46 -0000 1.234 @@ -39,6 +39,11 @@ </devs> <release version="@version@" date="@date@"> + <action dev="VG" type="update"> + In addition to attributes in same namespace with elements, + link serializer reacts on non-namespaced attributes too. This allows + processing of (strict) XHTML. + </action> <action dev="VG" type="update" fixes-bug="10697"> Changed default persistence store to the JispFilesystemStore. To switch back to FilesystemStore, remove jisp.jar and rebuild Cocoon No revision No revision 1.4.2.1 +38 -14 xml-cocoon2/src/java/org/apache/cocoon/xml/xlink/ExtendedXLinkPipe.java Index: ExtendedXLinkPipe.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/xml/xlink/ExtendedXLinkPipe.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- ExtendedXLinkPipe.java 22 Feb 2002 07:03:59 -0000 1.4 +++ ExtendedXLinkPipe.java 15 Aug 2002 03:13:46 -0000 1.4.2.1 @@ -58,42 +58,67 @@ * This class extends the XLink semantic capabilities to understand those * elements that are have default linking semantics associated. * - * This class reacts on 'href' and 'src' attributes and is able to understand - * the semantics of XHTML/WML/SMIL/SVG and all the rest of the languages that - * use either XLink of the above attributes. + * This class reacts on 'href', 'src', and 'background' attributes and is able + * to understand the semantics of XHTML/WML/SMIL/SVG and all the rest of the + * languages that use either XLink of the above attributes. * - * NOTE: this class is clearly a hack and is not future compatible, but + * <p>NOTE: this class is clearly a hack and is not future compatible, but * since many XML formats to date are not compatible with the XLink semantics * this is what we have to do to live in the bleeding edge. Once there will * be a way to remove this, that will be a happy day for XML and for Cocoon too. + * </p> * * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> * @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) { + 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 = ""; } - String href = attr.getValue(uri, "href"); + + // Get attributes without namespace too + + String href = attr.getValue("", "href"); if (href != null) { - simpleLink(href, null, null, null, null, null, uri, name, raw, attr); + simpleLink(href, null, null, null, null, null, "", name, raw, attr); return; } - String src = attr.getValue(uri, "src"); + String src = attr.getValue("", "src"); if (src != null) { - simpleLink(src, null, null, null, null, null, uri, name, raw, attr); + simpleLink(src, null, null, null, null, null, "", name, raw, attr); return; } - String background = attr.getValue(uri, "background"); + String background = attr.getValue("", "background"); if (background != null) { - simpleLink(background, null, null, null, null, null, uri, name, raw, attr); + simpleLink(background, null, null, null, null, null, "", name, raw, attr); return; } + super.startElement(uri, name, raw, attr); } @@ -108,4 +133,3 @@ super.startElement(uri, name, raw, newattr); } } -
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]