From d02f9801cc4e945dbf9fbc36741598a2ac6d7281 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 28 Dec 2003 05:22:07 +0000 Subject: [PATCH] Eliminated checks for xmlns* in line with removal of namespace-prefixes feature from parser. Localised some varialbe references. Interned LocalName. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197064 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FOAttributes.java | 22 +++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/java/org/apache/fop/fo/FOAttributes.java b/src/java/org/apache/fop/fo/FOAttributes.java index 52e91cd5f..7703b2570 100644 --- a/src/java/org/apache/fop/fo/FOAttributes.java +++ b/src/java/org/apache/fop/fo/FOAttributes.java @@ -150,35 +150,26 @@ public class FOAttributes { Attributes attributes = event.getAttributes(); if (attributes == null) throw new FOPException ("No Attributes in XMLEvent"); - int propIndex; - HashMap tmpHash; for (int i = 0; i < attributes.getLength(); i++) { - String attrUri = attributes.getURI(i); - String attrLocalname = attributes.getLocalName(i); - String attrQName = attributes.getQName(i); - int sep = attrQName.indexOf(':'); - String prefix = attrQName.substring(0, (sep == -1 ? 0 : sep)); - if (prefix.equals("xmlns")) break; + String attrUri = attributes.getURI(i).intern(); + String attrLocalname = attributes.getLocalName(i).intern(); String attrValue = attributes.getValue(i); int attrUriIndex = foNode.namespaces.getURIIndex(attrUri); //System.out.println("FONode:" + event); if (attrUriIndex == XMLNamespaces.DefAttrNSIndex) { - // Standard FO namespace - // Catch default namespace declaration here. - if (attrLocalname.equals("xmlns")) break; + // Standard attribute namespace // Is this a known (valid) property? - propIndex = PropNames.getPropertyIndex(attrLocalname); + int propIndex = PropNames.getPropertyIndex(attrLocalname); // Known attribute name foAttrMap.put(Ints.consts.get(propIndex), attrValue); } else { // Not the XSL FO namespace - int j; if (nSpaceAttrMaps == null) { //Create the list System.out.println("Creating nSpaceAttrMaps"); nSpaceAttrMaps = new ArrayList(attrUriIndex + 1); // Add the fo list - for (j = 0; j < XMLNamespaces.DefAttrNSIndex; j++) + for (int j = 0; j < XMLNamespaces.DefAttrNSIndex; j++) nSpaceAttrMaps.add(new HashMap(0)); System.out.println("Adding foAttrMap"); @@ -186,10 +177,11 @@ public class FOAttributes { } // Make sure there are elements between the last current // and the one to be added - for (j = nSpaceAttrMaps.size(); j <= attrUriIndex; j++) + for (int j = nSpaceAttrMaps.size(); j <= attrUriIndex; j++) nSpaceAttrMaps.add(new HashMap(0)); // Does a HashMap exist for this namespace? + HashMap tmpHash; if ((tmpHash = (HashMap)nSpaceAttrMaps.get(attrUriIndex)) == null) { tmpHash = new HashMap(1); -- 2.39.5