From 618e88ae22d5371122621e4df84fcbd66bc1ece8 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Wed, 7 Oct 2009 17:34:29 +0000 Subject: [PATCH] Removed unnecessary languageStack field git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@822810 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/intermediate/IFSerializer.java | 29 ++++--------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index b010ee41f..9d7c15a61 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -29,7 +29,6 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Stack; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -215,7 +214,11 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler if (id != null) { atts.addAttribute(XML_NAMESPACE, "id", "xml:id", XMLUtil.CDATA, id); } - applyLanguage(atts); + Locale lang = getContext().getLanguage(); + if (lang != null) { + atts.addAttribute(XML_NAMESPACE, "lang", "xml:lang", XMLUtil.CDATA, + XMLUtil.toRFC3066(lang)); + } addForeignAttributes(atts); handler.startElement(EL_PAGE_SEQUENCE, atts); if (this.getUserAgent().isAccessibilityEnabled()) { @@ -237,7 +240,6 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler public void endPageSequence() throws IFException { try { handler.endElement(EL_PAGE_SEQUENCE); - popLanguage(); } catch (SAXException e) { throw new IFException("SAX error in endPageSequence()", e); } @@ -772,25 +774,4 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler } } - private Stack languageStack = new Stack(); - - private void applyLanguage(AttributesImpl atts) { - Locale lang = getContext().getLanguage(); - if (lang != null) { - if (languageStack.isEmpty() || !languageStack.peek().equals(lang)) { - atts.addAttribute(XML_NAMESPACE, "lang", "xml:lang", XMLUtil.CDATA, - XMLUtil.toRFC3066(lang)); - } - languageStack.push(lang); - } else { - assert languageStack.isEmpty(); - } - } - - private void popLanguage() { - if (!languageStack.isEmpty()) { - languageStack.pop(); - } - } - } -- 2.39.5