[jdom-commits] CVS Update: jdom/src/java/org/jdom/transform
nobody
nobody at chimbo.servlets.com
Tue Jun 17 13:49:43 PDT 2003
****************************************
Date: Tue Jun 17, 2003 @14:49:43 MDT
Author:
Update of /home/cvs/jdom/src/java/org/jdom/transform
In directory chimbo:/tmp/cvs-serv22663/transform
Modified Files:
JDOMResult.java
Log Message:
Changing SAXHandler.setAlternateRoot() to SAXHandler.pushElement()
which solves the same problem but in a more general way. Laurent
had the idea (see below), and it's a darn good one!
-jh-
> SAXHandler:
> atRoot
>
> I see JDOMResult.FragmentHandler uses this. That's an odd property
> to expose. Could this be done another way? Laurent?
Sure, this could be removed if SAXHandler provided a protected
pushElement() method. As JDOMResult may receive a node list and not
a document, it needs to add a dummy root element to the being-built
document before the parse begins. To do that, I simply pasted some
code from startElement.
For example, in SAXHandler:
protected void pushElement(Element element) {
if (atRoot) {
document.setRootElement(element);
atRoot = false;
} else {
getCurrentElement().addContent(element);
}
currentElement = element;
}
Then JDOMResult.FragmentHandler constructor could be changed to:
public FragmentHandler(JDOMFactory factory) {
super(factory);
// Add a dummy root element to the being-built document as XSL
// transformation can output node lists instead of well-formed
// documents.
this.pushElement(dummyRoot);
}
Laurent
===================================================================
File: no file JDOMResult.java Status: Needs Checkout
Working revision: 1.19 Tue Jun 17 20:49:42 2003
Repository revision: 1.19 /home/cvs/jdom/src/java/org/jdom/transform/JDOMResult.java,v
Existing Tags:
jdom_1_0_b9 (revision: 1.16)
jdom_1_0_b8 (revision: 1.5)
jdom_prefilter (revision: 1.4)
jdom_1_0_b7 (revision: 1.4)
More information about the jdom-commits
mailing list