]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Removed unnecessary languageStack field
authorVincent Hennebert <vhennebert@apache.org>
Wed, 7 Oct 2009 17:34:29 +0000 (17:34 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Wed, 7 Oct 2009 17:34:29 +0000 (17:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@822810 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/intermediate/IFSerializer.java

index b010ee41fe876ca5a3b621d6831a84f2104381d3..9d7c15a61150b43702ee7604c455b877aa66f7fa 100644 (file)
@@ -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();
-        }
-    }
-
 }