diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-10-28 14:42:11 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-10-28 14:42:11 +0000 |
commit | 34311b3de6f762aa39dc92477062140364cfccd0 (patch) | |
tree | 9f7112d53a377a70a8df514398882b64f50ccfa4 /src | |
parent | dc7b66987e8ab71a5fa0193f4b43d86b9571ab6b (diff) | |
download | xmlgraphics-fop-34311b3de6f762aa39dc92477062140364cfccd0.tar.gz xmlgraphics-fop-34311b3de6f762aa39dc92477062140364cfccd0.zip |
Do explicit prefix mappings for foi and fox prefixes to make AT XML slightly smaller.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@830563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/render/xml/XMLRenderer.java | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index a8a1a1911..c283dbd98 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -36,6 +36,7 @@ import javax.xml.transform.stream.StreamResult; 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.Viewport; 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 @@ public class XMLRenderer extends AbstractXMLRenderer { } } + /** + * 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 @@ public class XMLRenderer extends AbstractXMLRenderer { 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); } |