sboag 00/02/17 14:07:33
Modified: src/org/apache/xalan/xpath XPathEnvSupport.java
XPathSupportDefault.java
src/org/apache/xalan/xpath/xml XMLParserLiaisonDefault.java
src/org/apache/xalan/xslt XSLTEngineImpl.java
Log:
Removed the factory object from the processor, moved it into the
XMLParserLiaisonDefault, and put a setDOMFactory method on the XPathSupport
interface.
Revision Changes Path
1.5 +6 -0 xml-xalan/src/org/apache/xalan/xpath/XPathEnvSupport.java
Index: XPathEnvSupport.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathEnvSupport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathEnvSupport.java 2000/02/17 13:06:24 1.4
+++ XPathEnvSupport.java 2000/02/17 22:07:32 1.5
@@ -86,6 +86,12 @@
* Given a DOM Document, tell what URI was used to parse it.
*/
String findURIFromDoc(Document owner); // Needed for relative resolution
+
+ /**
+ * Get the factory object required to create DOM nodes
+ * in the result tree.
+ */
+ public void setDOMFactory(Document domFactory);
/**
* Get a DOM document, primarily for creating result
1.12 +9 -0
xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java
Index: XPathSupportDefault.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XPathSupportDefault.java 2000/02/17 13:06:24 1.11
+++ XPathSupportDefault.java 2000/02/17 22:07:32 1.12
@@ -464,6 +464,15 @@
{
return "";
}
+
+ /**
+ * Get the factory object required to create DOM nodes
+ * in the result tree.
+ */
+ public void setDOMFactory(Document domFactory)
+ {
+ throw new RuntimeException("setDOMFactory is not supported by
XPathSupportDefault!");
+ }
public Document getDOMFactory()
{
1.22 +31 -7
xml-xalan/src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java
Index: XMLParserLiaisonDefault.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLParserLiaisonDefault.java 2000/02/17 13:06:25 1.21
+++ XMLParserLiaisonDefault.java 2000/02/17 22:07:32 1.22
@@ -227,7 +227,7 @@
* The document just parsed. Short lived only!
*/
protected Document m_document;
-
+
/**
* The error event handler that will be used for the parse.
*/
@@ -1392,17 +1392,41 @@
}
return root;
}
+
+ /**
+ * The factory object used for creating nodes
+ * in the result tree.
+ */
+ protected Document m_DOMFactory = null;
+
+ /**
+ * Get the factory object required to create DOM nodes
+ * in the result tree.
+ */
+ public void setDOMFactory(Document domFactory)
+ {
+ this.m_DOMFactory = domFactory;
+ }
+
+ /**
+ * Get the factory object required to create DOM nodes
+ * in the result tree.
+ */
public Document getDOMFactory()
{
- if(null == m_envSupport)
- {
- return createDocument();
- }
- else
+ if(null != this.m_DOMFactory)
{
- return m_envSupport.getDOMFactory();
+ if(null == this.m_envSupport)
+ {
+ this.m_DOMFactory = createDocument();
+ }
+ else
+ {
+ this.m_DOMFactory = m_envSupport.getDOMFactory();
+ }
}
+ return this.m_DOMFactory;
}
/**
1.38 +4 -18 xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
Index: XSLTEngineImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- XSLTEngineImpl.java 2000/02/17 13:06:27 1.37
+++ XSLTEngineImpl.java 2000/02/17 22:07:33 1.38
@@ -271,11 +271,6 @@
DocumentHandler m_flistener = null;
/**
- * The factory that will be used to create result tree fragments.
- */
- Document m_resultTreeFactory = null;
-
- /**
* The current input element that is being processed.
*/
protected Node m_currentNode;
@@ -489,7 +484,6 @@
m_resultNameSpaces.removeAllElements();
// m_resultNameSpaces = new Stack();
m_cdataStack = new Stack();
- m_resultTreeFactory = null;
m_currentNode = null;
m_needToCheckForInfiniteLoops = false;
m_variableStacks = new VariableStack();
@@ -1935,7 +1929,7 @@
MutableAttrListImpl savedPendingAttributes = this.m_pendingAttributes;
this.m_pendingAttributes = new MutableAttrListImpl();
- m_flistener = new FormatterToDOM(m_resultTreeFactory, resultFragment);
+ m_flistener = new FormatterToDOM(getDOMFactory(), resultFragment);
templateParent.executeChildren(this, sourceTree, sourceNode, mode);
@@ -3041,11 +3035,7 @@
*/
DocumentFragment createDocFrag()
{
- if(null == m_resultTreeFactory)
- {
- m_resultTreeFactory = m_parserLiaison.createDocument();
- }
- return new ResultTreeFrag(m_resultTreeFactory, m_parserLiaison);
+ return new ResultTreeFrag(getDOMFactory(), m_parserLiaison);
}
/**
@@ -3326,7 +3316,7 @@
*/
public void setDOMFactory(Document doc)
{
- m_resultTreeFactory = doc;
+ getXMLProcessorLiaison().setDOMFactory(doc);
}
@@ -3336,11 +3326,7 @@
*/
public Document getDOMFactory()
{
- if(null == m_resultTreeFactory)
- {
- m_resultTreeFactory = m_parserLiaison.createDocument();
- }
- return m_resultTreeFactory;
+ return getXMLProcessorLiaison().getDOMFactory();;
}
/**