You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2009/10/28 15:42:11 UTC

svn commit: r830563 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java

Author: jeremias
Date: Wed Oct 28 14:42:11 2009
New Revision: 830563

URL: http://svn.apache.org/viewvc?rev=830563&view=rev
Log:
Do explicit prefix mappings for foi and fox prefixes to make AT XML slightly smaller.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=830563&r1=830562&r2=830563&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java Wed Oct 28 14:42:11 2009
@@ -36,6 +36,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 import org.xml.sax.SAXException;
 
 import org.apache.xmlgraphics.util.QName;
@@ -81,6 +82,8 @@
 import org.apache.fop.area.inline.WordArea;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.extensions.InternalElementMapping;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.render.Renderer;
@@ -148,6 +151,10 @@
         }
     }
 
+    /**
+     * Controls whether to create a more compact format which omit certain attributes.
+     * @param compact true to activate the compact format
+     */
     public void setCompactFormat(boolean compact) {
         this.compactFormat = compact;
     }
@@ -447,14 +454,23 @@
         if (this.getUserAgent().isAccessibilityEnabled()) {
             String structureTreeElement = "structureTree";
             startElement(structureTreeElement);
-            NodeList nodes = getUserAgent().getStructureTree().getPageSequence(pageSequenceIndex++);
-            for (int i = 0, n = nodes.getLength(); i < n; i++) {
-                Node node = nodes.item(i);
-                try {
-                    new DOM2SAX(handler).writeFragment(node);
-                } catch (SAXException e) {
-                    handleSAXException(e);
+            try {
+                this.handler.startPrefixMapping("foi", InternalElementMapping.URI);
+                this.handler.startPrefixMapping("fox", ExtensionElementMapping.URI);
+                NodeList nodes = getUserAgent().getStructureTree().getPageSequence(
+                        pageSequenceIndex++);
+                for (int i = 0, n = nodes.getLength(); i < n; i++) {
+                    Node node = nodes.item(i);
+                    try {
+                        new DOM2SAX(handler).writeFragment(node);
+                    } catch (SAXException e) {
+                        handleSAXException(e);
+                    }
                 }
+                this.handler.endPrefixMapping("fox");
+                this.handler.endPrefixMapping("foi");
+            } catch (SAXException se) {
+                handleSAXException(se);
             }
             endElement(structureTreeElement);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org