Author: adelmelle
Date: Sat Jan 22 19:09:00 2011
New Revision: 1062236

URL: http://svn.apache.org/viewvc?rev=1062236&view=rev
Log:
Minor fixups: extract addAttributeToList() + no reason to first check the 
attributeValue to ignore namespace declarations

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java?rev=1062236&r1=1062235&r2=1062236&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java Sat Jan 
22 19:09:00 2011
@@ -264,6 +264,13 @@ public abstract class PropertyList {
         return -1;
     }
 
+    private String addAttributeToList(Attributes attributes,
+                                    String attributeName) throws 
ValidationException {
+        String attributeValue = attributes.getValue(attributeName);
+        convertAttributeToProperty(attributes, attributeName, attributeValue);
+        return attributeValue;
+    }
+
     /**
      * Adds the attributes, passed in by the parser to the PropertyList
      *
@@ -278,39 +285,29 @@ public abstract class PropertyList {
          * need them before all others (possible from-table-column() on any
          * other property further in the list...
          */
-        String attributeName = "column-number";
-        String attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
-        attributeName = "number-columns-spanned";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
+        addAttributeToList(attributes, "column-number");
+        addAttributeToList(attributes, "number-columns-spanned");
 
         /*
          * If font-size is set on this FO, must set it first, since
          * other attributes specified in terms of "ems" depend on it.
          */
-        attributeName = "font";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-                attributeValue);
-        if (attributeValue == null) {
+        String checkValue = addAttributeToList(attributes, "font");
+        if (checkValue == null || "".equals(checkValue)) {
             /*
              * font shorthand wasn't specified, so still need to process
              * explicit font-size
              */
-            attributeName = "font-size";
-            attributeValue = attributes.getValue(attributeName);
-            convertAttributeToProperty(attributes, attributeName,
-                    attributeValue);
+            addAttributeToList(attributes, "font-size");
         }
 
+        String attributeName;
+        String attributeValue;
         String attributeNS;
         FopFactory factory = getFObj().getUserAgent().getFactory();
         for (int i = 0; i < attributes.getLength(); i++) {
             /* convert all attributes with the same namespace as the fo element
-             * the "xml:lang" property is a special case */
+             * the "xml:lang" and "xml:base" properties are special cases */
             attributeNS = attributes.getURI(i);
             attributeName = attributes.getQName(i);
             attributeValue = attributes.getValue(i);
@@ -368,15 +365,14 @@ public abstract class PropertyList {
                                             String attributeValue)
                     throws ValidationException {
 
-        if (attributeValue != null) {
-
-            if (attributeName.startsWith("xmlns:")
-                    || "xmlns".equals(attributeName)) {
-                //Ignore namespace declarations if the XML parser/XSLT 
processor
-                //reports them as 'regular' attributes
-                return;
-            }
+        if (attributeName.startsWith("xmlns:")
+                || "xmlns".equals(attributeName)) {
+            /* Ignore namespace declarations if the XML parser/XSLT processor
+             * reports them as 'regular' attributes */
+            return;
+        }
 
+        if (attributeValue != null) {
             /* Handle "compound" properties, ex. space-before.minimum */
             String basePropertyName = findBasePropertyName(attributeName);
             String subPropertyName = findSubPropertyName(attributeName);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to