diff options
author | Keiron Liddle <keiron@apache.org> | 2001-11-06 08:34:53 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-11-06 08:34:53 +0000 |
commit | 31965968c68717055bbd096b709df3e72ceb8b40 (patch) | |
tree | 92820b3533809c21ea4decd0069edbb1e858f064 /src/org/apache/fop/fo/XMLObj.java | |
parent | cfc0da75fcc187e6dd7596e7480c4941e278b9d5 (diff) | |
download | xmlgraphics-fop-31965968c68717055bbd096b709df3e72ceb8b40.tar.gz xmlgraphics-fop-31965968c68717055bbd096b709df3e72ceb8b40.zip |
changed the way that elements and properties are handled
the element makers are associated with the element mapping
attributes are passed to the element object the object can then
use the attributes to make the properties
added default value for element handling, makes it easier to
ensure all elements of an external xml markup are loaded (eg. svg)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo/XMLObj.java')
-rw-r--r-- | src/org/apache/fop/fo/XMLObj.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index bc56718aa..9658f8552 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -28,7 +28,8 @@ import java.util.*; */ public abstract class XMLObj extends FObj { - protected String tagName = ""; + // temp reference for attributes + Attributes attr = null; protected Element element; protected Document doc; @@ -38,21 +39,25 @@ public abstract class XMLObj extends FObj { * @param parent the parent formatting object * @param propertyList the explicit properties of this object */ - public XMLObj(FObj parent, PropertyList propertyList, String tag) { - super(parent, propertyList); - tagName = tag; + public XMLObj(FObj parent) { + super(parent); } + public void setName(String str) { + name = str; + } + + public void handleAttrs(Attributes attlist) throws FOPException { + attr = attlist; + } public abstract String getNameSpace(); protected static Hashtable ns = new Hashtable(); public void addGraphic(Document doc, Element parent) { this.doc = doc; - element = doc.createElementNS(getNameSpace(), tagName); + element = doc.createElementNS(getNameSpace(), name); - if(this.properties instanceof DirectPropertyListBuilder.AttrPropertyList) { - Attributes attr = ((DirectPropertyListBuilder.AttrPropertyList)this.properties).getAttributes(); for (int count = 0; count < attr.getLength(); count++) { String rf = attr.getValue(count); String qname = attr.getQName(count); @@ -70,16 +75,12 @@ public abstract class XMLObj extends FObj { qname, rf); } } - } else { - } - + attr = null; parent.appendChild(element); } public void buildTopLevel(Document doc, Element svgRoot) { // build up the info for the top level element - if(this.properties instanceof DirectPropertyListBuilder.AttrPropertyList) { - Attributes attr = ((DirectPropertyListBuilder.AttrPropertyList)this.properties).getAttributes(); for (int count = 0; count < attr.getLength(); count++) { String rf = attr.getValue(count); String qname = attr.getQName(count); @@ -97,8 +98,6 @@ public abstract class XMLObj extends FObj { qname, rf); } } - } else { - } } public Document createBasicDocument() { @@ -109,7 +108,7 @@ public abstract class XMLObj extends FObj { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); fact.setNamespaceAware(true); doc = fact.newDocumentBuilder().newDocument(); - Element el = doc.createElement(tagName); + Element el = doc.createElement(name); doc.appendChild(el); element = doc.getDocumentElement(); |