]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Widened "bookmarks" to "document-navigation" to fit named destination into this names...
authorJeremias Maerki <jeremias@apache.org>
Tue, 12 Aug 2008 15:30:54 +0000 (15:30 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 12 Aug 2008 15:30:54 +0000 (15:30 +0000)
Added support for named destinations (no implementation for PDF and no tests, yet).

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@685181 13f79535-47bb-0310-9956-ffa450edef68

src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory
src/java/org/apache/fop/render/intermediate/IFRenderer.java
src/java/org/apache/fop/render/intermediate/extensions/Bookmark.java
src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionConstants.java [deleted file]
src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionHandlerFactory.java [deleted file]
src/java/org/apache/fop/render/intermediate/extensions/BookmarkTree.java
src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java [new file with mode: 0644]
src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java [new file with mode: 0644]
src/java/org/apache/fop/render/intermediate/extensions/GoToXYAction.java
src/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java [new file with mode: 0644]
src/java/org/apache/fop/render/intermediate/extensions/URIAction.java

index d7adf6a6c1c21743207a4a86e4043fd0933a7332..3745e670217f21ef968ca48d477067bb044a472e 100644 (file)
@@ -1,4 +1,4 @@
 org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory\r
 org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory\r
 org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory\r
-org.apache.fop.render.intermediate.extensions.BookmarkExtensionHandlerFactory\r
+org.apache.fop.render.intermediate.extensions.DocumentNavigationExtensionHandlerFactory\r
index 345854cdebe95376b427a5d46d80fc7c1643fef1..703b035d1435124a03b45fabdd80b403aba786c6 100644 (file)
@@ -83,6 +83,7 @@ import org.apache.fop.render.Renderer;
 import org.apache.fop.render.intermediate.extensions.Bookmark;
 import org.apache.fop.render.intermediate.extensions.BookmarkTree;
 import org.apache.fop.render.intermediate.extensions.GoToXYAction;
+import org.apache.fop.render.intermediate.extensions.NamedDestination;
 import org.apache.fop.render.pdf.PDFEventProducer;
 
 /**
@@ -269,10 +270,12 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
         PageViewport pv = dd.getPageViewport();
         if (pv != null) {
             GoToXYAction action = getGoToActionForID(targetID, pv.getPageIndex());
-            /*
-            pdfDoc.getFactory().makeDestination(
-                    dd.getIDRef(), gt.makeReference());
-                    */
+            NamedDestination namedDestination = new NamedDestination(targetID, action);
+            try {
+                painter.handleExtensionObject(namedDestination);
+            } catch (IFException ife) {
+                handleIFException(ife);
+            }
         } else {
             //Warning already issued by AreaTreeHandler (debug level is sufficient)
             log.debug("Unresolved destination item received: " + dd.getIDRef());
index a96bbd0ff727e05510463684eba4be2e27b9d19a..446da6ef9a42856d635d5289c4a64feca57debbc 100644 (file)
@@ -34,7 +34,7 @@ import org.apache.fop.util.XMLUtil;
 /**
  * This class is a bookmark element for use in the intermediate format.
  */
-public class Bookmark implements XMLizable, BookmarkExtensionConstants {
+public class Bookmark implements XMLizable, DocumentNavigationExtensionConstants {
 
     private String title;
     private boolean show;
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionConstants.java b/src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionConstants.java
deleted file mode 100644 (file)
index 184c71d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.intermediate.extensions;
-
-import org.apache.xmlgraphics.util.QName;
-
-import org.apache.fop.render.intermediate.IFConstants;
-
-/**
- * Constants for the IF bookmark extension.
- */
-public interface BookmarkExtensionConstants {
-
-    /** Namespace URI for the bookmark extension */
-    String NAMESPACE = IFConstants.NAMESPACE + "/bookmarks";
-
-    /** the bookmark-tree element */
-    QName BOOKMARK_TREE = new QName(NAMESPACE, "bookmark-tree");
-    /** the bookmark element */
-    QName BOOKMARK = new QName(NAMESPACE, "bookmark");
-    /** the goto-xy element */
-    QName GOTO_XY = new QName(NAMESPACE, "goto-xy");
-    /** the goto-uri element */
-    QName GOTO_URI = new QName(NAMESPACE, "goto-uri");
-
-}
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionHandlerFactory.java b/src/java/org/apache/fop/render/intermediate/extensions/BookmarkExtensionHandlerFactory.java
deleted file mode 100644 (file)
index ac3f956..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.intermediate.extensions;
-
-import java.awt.Point;
-import java.util.Stack;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.fop.render.ps.extensions.PSExtensionAttachment;
-import org.apache.fop.util.ContentHandlerFactory;
-import org.apache.fop.util.XMLUtil;
-
-/**
- * Factory for the ContentHandler that handles the IF bookmarks namespace.
- */
-public class BookmarkExtensionHandlerFactory
-        implements ContentHandlerFactory, BookmarkExtensionConstants {
-
-    /** Logger instance */
-    protected static Log log = LogFactory.getLog(BookmarkExtensionHandlerFactory.class);
-
-    /** {@inheritDoc} */
-    public String[] getSupportedNamespaces() {
-        return new String[] {NAMESPACE};
-    }
-
-    /** {@inheritDoc} */
-    public ContentHandler createContentHandler() {
-        return new BookmarkExtensionHandler();
-    }
-
-    private static class BookmarkExtensionHandler extends DefaultHandler
-                implements ContentHandlerFactory.ObjectSource {
-
-        private StringBuffer content = new StringBuffer();
-        //private Attributes lastAttributes;
-        private Stack objectStack = new Stack();
-        private BookmarkTree bookmarkTree;
-
-        private ObjectBuiltListener listener;
-
-        /** {@inheritDoc} */
-        public void startElement(String uri, String localName, String qName, Attributes attributes)
-                throws SAXException {
-            boolean handled = false;
-            if (NAMESPACE.equals(uri)) {
-                if (BOOKMARK_TREE.getLocalName().equals(localName)) {
-                    if (bookmarkTree != null) {
-                        throw new SAXException(localName + " must be the root element!");
-                    }
-                    bookmarkTree = new BookmarkTree();
-                    objectStack.push(bookmarkTree);
-                } else if (BOOKMARK.getLocalName().equals(localName)) {
-                    String title = attributes.getValue("title");
-                    String s = attributes.getValue("starting-state");
-                    boolean show = !"hide".equals(s);
-                    Bookmark b = new Bookmark(title, show, null);
-                    Object o = objectStack.peek();
-                    if (o instanceof AbstractAction) {
-                        AbstractAction action = (AbstractAction)objectStack.pop();
-                        o = objectStack.peek();
-                        ((Bookmark)o).setAction(action);
-                    }
-                    if (o instanceof BookmarkTree) {
-                        ((BookmarkTree)o).addBookmark(b);
-                    } else {
-                        ((Bookmark)o).addChildBookmark(b);
-                    }
-                    objectStack.push(b);
-                } else if (GOTO_XY.getLocalName().equals(localName)) {
-                    int pageIndex = XMLUtil.getAttributeAsInt(attributes, "page-index");
-                    int x = XMLUtil.getAttributeAsInt(attributes, "x");
-                    int y = XMLUtil.getAttributeAsInt(attributes, "y");
-                    GoToXYAction action = new GoToXYAction(pageIndex, new Point(x, y));
-                    objectStack.push(action);
-                } else if (GOTO_URI.getLocalName().equals(localName)) {
-                    String gotoURI = attributes.getValue("uri");
-                    URIAction action = new URIAction(gotoURI);
-                    objectStack.push(action);
-                } else {
-                    throw new SAXException(
-                            "Invalid element " + localName + " in namespace: " + uri);
-                }
-                handled = true;
-            }
-            if (!handled) {
-                if (PSExtensionAttachment.CATEGORY.equals(uri)) {
-                    throw new SAXException("Unhandled element " + localName + " in namespace: "
-                            + uri);
-                } else {
-                    log.warn("Unhandled element " + localName + " in namespace: " + uri);
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        public void endElement(String uri, String localName, String qName) throws SAXException {
-            if (NAMESPACE.equals(uri)) {
-                if (BOOKMARK_TREE.getLocalName().equals(localName)) {
-                    //nop
-                } else if (BOOKMARK.getLocalName().equals(localName)) {
-                    if (objectStack.peek() instanceof AbstractAction) {
-                        AbstractAction action = (AbstractAction)objectStack.pop();
-                        Bookmark b = (Bookmark)objectStack.pop();
-                        b.setAction(action);
-                    } else {
-                        objectStack.pop();
-                    }
-                }
-            }
-            content.setLength(0); // Reset text buffer (see characters())
-        }
-
-        /** {@inheritDoc} */
-        public void characters(char[] ch, int start, int length) throws SAXException {
-            content.append(ch, start, length);
-        }
-
-        /** {@inheritDoc} */
-        public void endDocument() throws SAXException {
-            if (listener != null) {
-                listener.notifyObjectBuilt(getObject());
-            }
-        }
-
-        /** {@inheritDoc} */
-        public Object getObject() {
-            return bookmarkTree;
-        }
-
-        /** {@inheritDoc} */
-        public void setObjectBuiltListener(ObjectBuiltListener listener) {
-            this.listener = listener;
-        }
-    }
-
-}
index 8ecd871036bde7945ac41ebd4b910418774dea2d..77e9726b302869fc9ffc06d6c7b985486202d5d8 100644 (file)
@@ -32,7 +32,7 @@ import org.apache.xmlgraphics.util.XMLizable;
 /**
  * This class is the root of the bookmark tree for use in the intermediate format.
  */
-public class BookmarkTree implements XMLizable, BookmarkExtensionConstants {
+public class BookmarkTree implements XMLizable, DocumentNavigationExtensionConstants {
 
     private List bookmarks = new java.util.ArrayList();
 
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java
new file mode 100644 (file)
index 0000000..a8f458f
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.intermediate.extensions;
+
+import org.apache.xmlgraphics.util.QName;
+
+import org.apache.fop.render.intermediate.IFConstants;
+
+/**
+ * Constants for the IF document-level navigation extension.
+ */
+public interface DocumentNavigationExtensionConstants {
+
+    /** Namespace URI for the bookmark extension */
+    String NAMESPACE = IFConstants.NAMESPACE + "/document-navigation";
+
+    /** the bookmark-tree element */
+    QName BOOKMARK_TREE = new QName(NAMESPACE, "bookmark-tree");
+    /** the bookmark element */
+    QName BOOKMARK = new QName(NAMESPACE, "bookmark");
+
+    /** the named-destination element */
+    QName NAMED_DESTINATION = new QName(NAMESPACE, "named-destination");
+
+    /** the goto-xy element */
+    QName GOTO_XY = new QName(NAMESPACE, "goto-xy");
+    /** the goto-uri element */
+    QName GOTO_URI = new QName(NAMESPACE, "goto-uri");
+
+}
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java b/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java
new file mode 100644 (file)
index 0000000..2822ff2
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.intermediate.extensions;
+
+import java.awt.Point;
+import java.util.Stack;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.render.ps.extensions.PSExtensionAttachment;
+import org.apache.fop.util.ContentHandlerFactory;
+import org.apache.fop.util.XMLUtil;
+
+/**
+ * Factory for the ContentHandler that handles the IF document navigation namespace.
+ */
+public class DocumentNavigationExtensionHandlerFactory
+        implements ContentHandlerFactory, DocumentNavigationExtensionConstants {
+
+    /** Logger instance */
+    protected static Log log = LogFactory.getLog(DocumentNavigationExtensionHandlerFactory.class);
+
+    /** {@inheritDoc} */
+    public String[] getSupportedNamespaces() {
+        return new String[] {NAMESPACE};
+    }
+
+    /** {@inheritDoc} */
+    public ContentHandler createContentHandler() {
+        return new Handler();
+    }
+
+    private static class Handler extends DefaultHandler
+                implements ContentHandlerFactory.ObjectSource {
+
+        private StringBuffer content = new StringBuffer();
+        private Stack objectStack = new Stack();
+
+        private Object objectBuilt;
+        private ObjectBuiltListener listener;
+
+        /** {@inheritDoc} */
+        public void startElement(String uri, String localName, String qName, Attributes attributes)
+                throws SAXException {
+            boolean handled = false;
+            if (NAMESPACE.equals(uri)) {
+                if (BOOKMARK_TREE.getLocalName().equals(localName)) {
+                    if (!objectStack.isEmpty()) {
+                        throw new SAXException(localName + " must be the root element!");
+                    }
+                    BookmarkTree bookmarkTree = new BookmarkTree();
+                    objectStack.push(bookmarkTree);
+                } else if (BOOKMARK.getLocalName().equals(localName)) {
+                    String title = attributes.getValue("title");
+                    String s = attributes.getValue("starting-state");
+                    boolean show = !"hide".equals(s);
+                    Bookmark b = new Bookmark(title, show, null);
+                    Object o = objectStack.peek();
+                    if (o instanceof AbstractAction) {
+                        AbstractAction action = (AbstractAction)objectStack.pop();
+                        o = objectStack.peek();
+                        ((Bookmark)o).setAction(action);
+                    }
+                    if (o instanceof BookmarkTree) {
+                        ((BookmarkTree)o).addBookmark(b);
+                    } else {
+                        ((Bookmark)o).addChildBookmark(b);
+                    }
+                    objectStack.push(b);
+                } else if (NAMED_DESTINATION.getLocalName().equals(localName)) {
+                    if (!objectStack.isEmpty()) {
+                        throw new SAXException(localName + " must be the root element!");
+                    }
+                    String name = attributes.getValue("name");
+                    NamedDestination dest = new NamedDestination(name, null);
+                    objectStack.push(dest);
+                } else if (GOTO_XY.getLocalName().equals(localName)) {
+                    int pageIndex = XMLUtil.getAttributeAsInt(attributes, "page-index");
+                    int x = XMLUtil.getAttributeAsInt(attributes, "x");
+                    int y = XMLUtil.getAttributeAsInt(attributes, "y");
+                    GoToXYAction action = new GoToXYAction(pageIndex, new Point(x, y));
+                    objectStack.push(action);
+                } else if (GOTO_URI.getLocalName().equals(localName)) {
+                    String gotoURI = attributes.getValue("uri");
+                    URIAction action = new URIAction(gotoURI);
+                    objectStack.push(action);
+                } else {
+                    throw new SAXException(
+                            "Invalid element " + localName + " in namespace: " + uri);
+                }
+                handled = true;
+            }
+            if (!handled) {
+                if (PSExtensionAttachment.CATEGORY.equals(uri)) {
+                    throw new SAXException("Unhandled element " + localName + " in namespace: "
+                            + uri);
+                } else {
+                    log.warn("Unhandled element " + localName + " in namespace: " + uri);
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+            if (NAMESPACE.equals(uri)) {
+                if (BOOKMARK_TREE.getLocalName().equals(localName)) {
+                    //nop
+                } else if (BOOKMARK.getLocalName().equals(localName)) {
+                    if (objectStack.peek() instanceof AbstractAction) {
+                        AbstractAction action = (AbstractAction)objectStack.pop();
+                        Bookmark b = (Bookmark)objectStack.pop();
+                        b.setAction(action);
+                    } else {
+                        objectStack.pop();
+                    }
+                } else if (NAMED_DESTINATION.getLocalName().equals(localName)) {
+                    AbstractAction action = (AbstractAction)objectStack.pop();
+                    NamedDestination dest = (NamedDestination)objectStack.peek();
+                    dest.setAction(action);
+                }
+            }
+            content.setLength(0); // Reset text buffer (see characters())
+        }
+
+        /** {@inheritDoc} */
+        public void characters(char[] ch, int start, int length) throws SAXException {
+            content.append(ch, start, length);
+        }
+
+        /** {@inheritDoc} */
+        public void endDocument() throws SAXException {
+            this.objectBuilt = objectStack.pop();
+            assert objectStack.isEmpty();
+            if (listener != null) {
+                listener.notifyObjectBuilt(this.objectBuilt);
+            }
+        }
+
+        /** {@inheritDoc} */
+        public Object getObject() {
+            return objectBuilt;
+        }
+
+        /** {@inheritDoc} */
+        public void setObjectBuiltListener(ObjectBuiltListener listener) {
+            this.listener = listener;
+        }
+    }
+
+}
index ef6d9c2a6b3dc6d41f73d836e0e5bbb2ae0b2f01..67cd5b5927ab1f7e907d56bf1b63d0f6c39affcb 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.fop.util.XMLUtil;
 /**
  * Action class which represents a "go-to" action to an absolute coordinate on a page.
  */
-public class GoToXYAction extends AbstractAction implements BookmarkExtensionConstants {
+public class GoToXYAction extends AbstractAction implements DocumentNavigationExtensionConstants {
 
     private int pageIndex;
     private Point targetLocation;
diff --git a/src/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java b/src/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java
new file mode 100644 (file)
index 0000000..85b6aca
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.intermediate.extensions;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.xmlgraphics.util.XMLizable;
+
+import org.apache.fop.util.XMLConstants;
+
+/**
+ * This class is a named destination element for use in the intermediate format.
+ */
+public class NamedDestination implements XMLizable, DocumentNavigationExtensionConstants {
+
+    private String name;
+    private AbstractAction action;
+
+    /**
+     * Creates a new named destination.
+     * @param name the destination's name
+     * @param action the action performed when the destination is selected
+     */
+    public NamedDestination(String name, AbstractAction action) {
+        this.name = name;
+        this.action = action;
+    }
+
+    /**
+     * Returns the destination's name.
+     * @return the name
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * Returns the action performed when the destination is selected.
+     * @return the action
+     */
+    public AbstractAction getAction() {
+        return this.action;
+    }
+
+    /**
+     * Sets the action performed when the destination is selected.
+     * @param action the action
+     */
+    public void setAction(AbstractAction action) {
+        this.action = action;
+    }
+
+    /** {@inheritDoc} */
+    public void toSAX(ContentHandler handler) throws SAXException {
+        AttributesImpl atts = new AttributesImpl();
+        atts.addAttribute(null, "name", "name", XMLConstants.CDATA, getName());
+        handler.startElement(NAMED_DESTINATION.getNamespaceURI(),
+                NAMED_DESTINATION.getLocalName(), NAMED_DESTINATION.getQName(), atts);
+        if (getAction() != null) {
+            getAction().toSAX(handler);
+        }
+        handler.endElement(NAMED_DESTINATION.getNamespaceURI(),
+                NAMED_DESTINATION.getLocalName(), NAMED_DESTINATION.getQName());
+    }
+
+}
index c5d56d9a4eb9ca8386ebd9a47bae672e84e26e3e..e3020dac324879d77a718e8d33136dfe1c927ba2 100644 (file)
@@ -29,7 +29,7 @@ import org.apache.fop.util.XMLUtil;
  * Action class which represents a "URI" action, i.e. an action that will call up an external
  * resource identified by a URI.
  */
-public class URIAction extends AbstractAction implements BookmarkExtensionConstants {
+public class URIAction extends AbstractAction implements DocumentNavigationExtensionConstants {
 
     private String uri;