소스 검색

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
tags/fop-1_1rc1old
Andreas L. Delmelle 13 년 전
부모
커밋
b970c338ba
1개의 변경된 파일22개의 추가작업 그리고 26개의 파일을 삭제
  1. 22
    26
      src/java/org/apache/fop/fo/PropertyList.java

+ 22
- 26
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);

Loading…
취소
저장