diff options
author | Keiron Liddle <keiron@apache.org> | 2001-11-15 08:12:37 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-11-15 08:12:37 +0000 |
commit | a0f30b3d13ee1a3aaf521eed1c0665f1d8fd03b1 (patch) | |
tree | 90c8515260d302868de9644ec45d8bd7ba443621 /src/org/apache/fop/fo | |
parent | 777dbd0139d29b074adc4ddd05e64b66b0cd5d48 (diff) | |
download | xmlgraphics-fop-a0f30b3d13ee1a3aaf521eed1c0665f1d8fd03b1.tar.gz xmlgraphics-fop-a0f30b3d13ee1a3aaf521eed1c0665f1d8fd03b1.zip |
made the batik pdf transcoder work again
some improvements to svg handling
Submitted by: Thomas E Deweese <thomas.deweese@kodak.com>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194567 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo')
-rw-r--r-- | src/org/apache/fop/fo/XMLObj.java | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index db4dd3962..c52006d8a 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -53,51 +53,52 @@ public abstract class XMLObj extends FONode { public abstract String getNameSpace(); protected static HashMap ns = new HashMap(); + static { + ns.put("xlink", "http://www.w3.org/1999/xlink"); + } public void addElement(Document doc, Element parent) { this.doc = doc; element = doc.createElementNS(getNameSpace(), name); - for (int count = 0; count < attr.getLength(); count++) { - String rf = attr.getValue(count); - String qname = attr.getQName(count); - if (qname.indexOf(":") == -1) { - element.setAttribute(qname, rf); + for (int count = 0; count < attr.getLength(); count++) { + String rf = attr.getValue(count); + String qname = attr.getQName(count); + int idx = qname.indexOf(":"); + if (idx == -1) { + element.setAttribute(qname, rf); + } else { + String pref = qname.substring(0, idx); + String tail = qname.substring(idx + 1); + if (pref.equals("xmlns")) { + ns.put(tail, rf); } else { - String pref = - qname.substring(0, qname.indexOf(":")); - if (pref.equals("xmlns")) { - ns.put(qname.substring(qname.indexOf(":") - + 1), rf); - } - ns.put("xlink", "http://www.w3.org/1999/xlink"); - element.setAttributeNS((String)ns.get(pref), - qname, rf); + element.setAttributeNS((String)ns.get(pref), tail, rf); } } + } attr = null; parent.appendChild(element); } public void buildTopLevel(Document doc, Element svgRoot) { // build up the info for the top level element - for (int count = 0; count < attr.getLength(); count++) { - String rf = attr.getValue(count); - String qname = attr.getQName(count); - if (qname.indexOf(":") == -1) { - element.setAttribute(qname, rf); + for (int count = 0; count < attr.getLength(); count++) { + String rf = attr.getValue(count); + String qname = attr.getQName(count); + int idx = qname.indexOf(":"); + if (idx == -1) { + element.setAttribute(qname, rf); + } else { + String pref = qname.substring(0, idx); + String tail = qname.substring(idx + 1); + if (pref.equals("xmlns")) { + ns.put(tail, rf); } else { - String pref = - qname.substring(0, qname.indexOf(":")); - if (pref.equals("xmlns")) { - ns.put(qname.substring(qname.indexOf(":") - + 1), rf); - } - ns.put("xlink", "http://www.w3.org/1999/xlink"); - element.setAttributeNS((String)ns.get(pref), - qname, rf); + element.setAttributeNS((String)ns.get(pref), tail, rf); } } + } } public Document createBasicDocument() { |