You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/10/01 02:18:46 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/serialization LinkSerializer.java

stefano     00/09/30 17:18:46

  Modified:    src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        LinkSerializer.java
  Log:
  local anchors are not traversable links so ignore them
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +7 -5      xml-cocoon/src/org/apache/cocoon/serialization/Attic/LinkSerializer.java
  
  Index: LinkSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/LinkSerializer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- LinkSerializer.java	2000/09/29 01:04:49	1.1.2.3
  +++ LinkSerializer.java	2000/10/01 00:18:45	1.1.2.4
  @@ -21,7 +21,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/29 01:04:49 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/10/01 00:18:45 $
    */
   
   public class LinkSerializer extends ExtendedXLinkPipe implements Serializer {
  @@ -45,15 +45,17 @@
   
       public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr)
       throws SAXException {
  -        if (isLocal(href)) out.println(href);
  +        if (traversable(href)) out.println(href);
       }
   
       public void startLocator(String href, String role, String title, String label, String uri, String name, String raw, Attributes attr)
       throws SAXException {
  -        if (isLocal(href)) out.println(href);
  +        if (traversable(href)) out.println(href);
       }
   
  -    private boolean isLocal(String href) {
  -        return (href.indexOf("://") == -1);
  +    private boolean traversable(String href) {
  +        if (href.charAt(0) == '#') return false;
  +        if (href.indexOf("://") != -1) return false;
  +        return true;
       }
   }