diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-22 19:09:00 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-22 19:09:00 +0000 |
commit | b970c338ba74b78e16b10c0b38b71b33df49fb36 (patch) | |
tree | cb02507ea0a9ea574bcc11f0aa0902436dbfdcd1 | |
parent | 57d30ce11144107318c7620941dac47c5bb7540d (diff) | |
download | xmlgraphics-fop-b970c338ba74b78e16b10c0b38b71b33df49fb36.tar.gz xmlgraphics-fop-b970c338ba74b78e16b10c0b38b71b33df49fb36.zip |
Minor fixups: extract addAttributeToList() + no reason to first check the attributeValue to ignore namespace declarations
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1062236 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyList.java | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 709c4303b..8d5a4311f 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -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); |