You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@locus.apache.org on 2000/10/31 00:02:47 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap XSLTFactoryLoader.java
giacomo 00/10/30 15:02:46
Modified: src/org/apache/cocoon Tag: xml-cocoon2 CodeFactory.java
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/matching Tag: xml-cocoon2
BrowserMatcherFactory.java
RegexpURIMatcherFactory.java
WildcardURIMatcherFactory.java
src/org/apache/cocoon/selection Tag: xml-cocoon2
BrowserSelectorFactory.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
XSLTFactoryLoader.java
Log:
Fixed problem with old DocumentFragments which indeed are NodeIterators in Xalan2.
BrowserSelectorFactory works correct now.
But there are still exception in Xerces during rebuild of the sitemap when a Selector in used ?!?
Revision Changes Path
No revision
No revision
1.1.2.3 +5 -5 xml-cocoon/src/org/apache/cocoon/Attic/CodeFactory.java
Index: CodeFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CodeFactory.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CodeFactory.java 2000/10/25 16:02:15 1.1.2.2
+++ CodeFactory.java 2000/10/30 23:02:43 1.1.2.3
@@ -10,7 +10,7 @@
import org.apache.avalon.ConfigurationException;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
/**
* Interface a class has to implement that produces java source code
@@ -22,16 +22,16 @@
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/25 16:02:15 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/30 23:02:43 $
*/
public interface CodeFactory {
- public String generateParameterSource (DocumentFragment conf)
+ public String generateParameterSource (NodeIterator conf)
throws ConfigurationException;
- public String generateClassSource (String test, String prefix, DocumentFragment conf)
+ public String generateClassSource (String prefix, String test, NodeIterator conf)
throws ConfigurationException;
- public String generateMethodSource (DocumentFragment conf)
+ public String generateMethodSource (NodeIterator conf)
throws ConfigurationException;
}
No revision
No revision
1.1.2.57 +5 -5 xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.56
retrieving revision 1.1.2.57
diff -u -r1.1.2.56 -r1.1.2.57
--- sitemap.xsl 2000/10/30 18:37:43 1.1.2.56
+++ sitemap.xsl 2000/10/30 23:02:43 1.1.2.57
@@ -76,7 +76,7 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loiritsch</a>
- * @version CVS $Revision: 1.1.2.56 $ $Date: 2000/10/30 18:37:43 $
+ * @version CVS $Revision: 1.1.2.57 $ $Date: 2000/10/30 23:02:43 $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static {
@@ -134,7 +134,7 @@
</xsl:variable>
<xsl:if test="not(preceding::map:when[@test = $this-test])">
/** The generated selector for a test of "<xsl:value-of select="@test"/>" */
- <xsl:value-of select="java:getClassSource($factory-loader,string($src),string(@test),string($selector-name),$config)"/>
+ <xsl:value-of select="java:getClassSource($factory-loader,string($src),string($selector-name),string(@test),$config)"/>
</xsl:if>
</xsl:for-each>
</xsl:if>
@@ -163,9 +163,9 @@
/** The generated selectors (for backward compatability. Should be removed in the future) */
<xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@factory]">
<xsl:variable name="factory" select="@factory"/>
- <xsl:variable name="type" select="translate(@name, '- ', '__')"/>
+ <xsl:variable name="type" select="translate(@name, '- ', '__')"/>
<xsl:variable name="default" select="$type = ../@default"/>
- <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
+ <xsl:variable name="config" select="descendant-or-self::*"/>
private boolean <xsl:value-of select="$type"/>Select (<xsl:value-of select="java:getParameterSource($factory-loader, string($factory),$config)"/> pattern, Map objectModel) {
<xsl:value-of select="java:getMethodSource($factory-loader, string($factory),$config)"/>
}
@@ -180,7 +180,7 @@
<xsl:value-of select="@test"/>
</xsl:variable>
<xsl:if test="not(preceding::map:when[@test = $this-test])">
- <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string(@test),string($selector-name),$config)"/>
+ <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string($selector-name),string(@test),$config)"/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
No revision
No revision
1.1.2.10 +7 -10 xml-cocoon/src/org/apache/cocoon/matching/Attic/BrowserMatcherFactory.java
Index: BrowserMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/BrowserMatcherFactory.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- BrowserMatcherFactory.java 2000/10/25 16:02:17 1.1.2.9
+++ BrowserMatcherFactory.java 2000/10/30 23:02:44 1.1.2.10
@@ -9,11 +9,9 @@
import java.util.Stack;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
import org.w3c.dom.Node;
import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.traversal.TreeWalker;
-import org.w3c.dom.traversal.NodeFilter;
import org.apache.avalon.ConfigurationException;
@@ -25,21 +23,20 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/10/25 16:02:17 $
+ * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/10/30 23:02:44 $
*/
-public class BrowserMatcherFactory implements MatcherFactory {
+public class BrowserMatcherFactory implements org.apache.cocoon.CodeFactory {
- public String generateMethodSource (DocumentFragment conf)
+ public String generateMethodSource (NodeIterator conf)
throws ConfigurationException {
StringBuffer sb = new StringBuffer();
- TreeWalker tw = new TreeWalkerImpl (conf, NodeFilter.SHOW_ALL, null, false);
Node node = null;
Node nodea = null;
NamedNodeMap nm = null;
sb.append ("/*\n");
- while ((node = tw.nextNode()) != null) {
+ while ((node = conf.nextNode()) != null) {
sb.append("name=")
.append(node.getNodeName())
.append(" type=")
@@ -60,12 +57,12 @@
}
public String generateClassSource (String prefix, String pattern,
- DocumentFragment conf)
+ NodeIterator conf)
throws ConfigurationException {
return "\n// Dummy values\nstatic String " + prefix + "_expr = \"" + pattern + "\";\n";
}
- public String generateParameterSource (DocumentFragment conf)
+ public String generateParameterSource (NodeIterator conf)
throws ConfigurationException {
return "String";
}
1.1.2.13 +5 -5 xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java
Index: RegexpURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- RegexpURIMatcherFactory.java 2000/10/25 16:02:17 1.1.2.12
+++ RegexpURIMatcherFactory.java 2000/10/30 23:02:44 1.1.2.13
@@ -13,7 +13,7 @@
import org.apache.avalon.ConfigurationException;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
/**
* This class generates source code which represents a specific pattern matcher
@@ -21,17 +21,17 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/10/25 16:02:17 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/10/30 23:02:44 $
*/
public class RegexpURIMatcherFactory implements MatcherFactory {
- public String generateParameterSource (DocumentFragment conf)
+ public String generateParameterSource (NodeIterator conf)
throws ConfigurationException {
return "RE";
}
public String generateClassSource (String prefix, String pattern,
- DocumentFragment conf)
+ NodeIterator conf)
throws ConfigurationException {
StringBuffer sb = new StringBuffer ();
try {
@@ -68,7 +68,7 @@
}
}
- public String generateMethodSource (DocumentFragment conf)
+ public String generateMethodSource (NodeIterator conf)
throws ConfigurationException {
StringBuffer sb = new StringBuffer ();
sb.append("ArrayList list = new ArrayList ();")
1.1.2.18 +5 -5 xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java
Index: WildcardURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -r1.1.2.17 -r1.1.2.18
--- WildcardURIMatcherFactory.java 2000/10/25 16:02:17 1.1.2.17
+++ WildcardURIMatcherFactory.java 2000/10/30 23:02:44 1.1.2.18
@@ -10,7 +10,7 @@
import org.apache.avalon.ConfigurationException;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
/**
* This class generates source code which represents a specific pattern matcher
@@ -19,7 +19,7 @@
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.17 $ $Date: 2000/10/25 16:02:17 $
+ * @version CVS $Revision: 1.1.2.18 $ $Date: 2000/10/30 23:02:44 $
*/
public class WildcardURIMatcherFactory implements MatcherFactory {
@@ -41,7 +41,7 @@
/**
* Generates the matcher parameter level source code
*/
- public String generateParameterSource (DocumentFragment conf)
+ public String generateParameterSource (NodeIterator conf)
throws ConfigurationException {
return "int []";
}
@@ -49,7 +49,7 @@
/**
* Generates the matcher method level source code
*/
- public String generateMethodSource (DocumentFragment conf)
+ public String generateMethodSource (NodeIterator conf)
throws ConfigurationException {
return " ArrayList list = new ArrayList();\n if (WildcardURIMatcher.match (list, ((HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT))\n .getRequestURI(), pattern)) {\n return list;\n } else {\n return null;\n }\n";
}
@@ -58,7 +58,7 @@
* Generates the matcher class level source code
*/
public String generateClassSource (String prefix, String pattern,
- DocumentFragment conf)
+ NodeIterator conf)
throws ConfigurationException {
StringBuffer result = new StringBuffer();
try {
No revision
No revision
1.1.2.11 +7 -14 xml-cocoon/src/org/apache/cocoon/selection/Attic/BrowserSelectorFactory.java
Index: BrowserSelectorFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/selection/Attic/BrowserSelectorFactory.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- BrowserSelectorFactory.java 2000/10/30 20:21:44 1.1.2.10
+++ BrowserSelectorFactory.java 2000/10/30 23:02:46 1.1.2.11
@@ -9,7 +9,7 @@
import org.apache.avalon.ConfigurationException;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
import org.w3c.dom.traversal.TreeWalker;
import org.w3c.dom.traversal.NodeFilter;
import org.w3c.dom.Node;
@@ -26,20 +26,19 @@
* @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/10/30 20:21:44 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/10/30 23:02:46 $
*/
public class BrowserSelectorFactory implements CodeFactory {
- public String generateParameterSource (DocumentFragment conf)
+ public String generateParameterSource (NodeIterator conf)
throws ConfigurationException {
return "String []";
}
- public String generateClassSource (String test, String prefix, DocumentFragment conf)
+ public String generateClassSource (String prefix, String test, NodeIterator conf)
throws ConfigurationException {
- TreeWalker tw = new TreeWalkerImpl (conf, NodeFilter.SHOW_ALL, null, false);
Node node = null;
Node nodeattrname = null;
Node nodeattruseragent = null;
@@ -49,7 +48,7 @@
sb.append("static String [] ")
.append(prefix)
.append("_expr = {");
- while ((node = tw.nextNode()) != null) {
+ while ((node = conf.nextNode()) != null) {
if (node.getNodeName().equals("browser") &&
node.getNodeType() == Node.ELEMENT_NODE) {
nm = node.getAttributes();
@@ -58,7 +57,7 @@
nodeattruseragent = nm.getNamedItem("useragent");
if (nodeattrname != null && nodeattruseragent != null
&& nodeattrname.getNodeValue().equals(test)) {
- sb.append(cnt==0 ? "\"" : ",\"")
+ sb.append(cnt++==0 ? "\"" : ",\"")
.append(nodeattruseragent.getNodeValue())
.append("\"");
}
@@ -68,14 +67,8 @@
return sb.append("};").toString();
}
- public String generateMethodSource (DocumentFragment conf)
+ public String generateMethodSource (NodeIterator conf)
throws ConfigurationException {
- TreeWalker tw = new TreeWalkerImpl (conf, NodeFilter.SHOW_ALL, null, false);
- Node node = null;
- Node nodeattrname = null;
- Node nodeattruseragent = null;
- NamedNodeMap nm = null;
-
StringBuffer sb = new StringBuffer();
sb.append("if (pattern != null && objectModel.get(Cocoon.REQUEST_OBJECT) != null) {")
.append("javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);")
No revision
No revision
1.1.2.5 +6 -6 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTFactoryLoader.java
Index: XSLTFactoryLoader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTFactoryLoader.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- XSLTFactoryLoader.java 2000/10/25 16:02:19 1.1.2.4
+++ XSLTFactoryLoader.java 2000/10/30 23:02:46 1.1.2.5
@@ -13,7 +13,7 @@
import org.apache.cocoon.CodeFactory;
import org.apache.cocoon.util.ClassUtils;
-import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.traversal.NodeIterator;
/**
* This class is used as a XSLT extension class. It is used by the sitemap
@@ -22,15 +22,15 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/10/25 16:02:19 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/10/30 23:02:46 $
*/
public class XSLTFactoryLoader {
HashMap obj = new HashMap();
- public String getClassSource(String className, String prefix, String pattern, DocumentFragment conf)
- throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception {
+ public String getClassSource(String className, String prefix, String pattern, NodeIterator conf)
+ throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception {
Object factory = obj.get(className);
if (factory == null) factory = ClassUtils.newInstance(className);
obj.put(className, factory);
@@ -43,7 +43,7 @@
+ "\". Should implement the CodeFactory interface");
}
- public String getParameterSource(String className, DocumentFragment conf)
+ public String getParameterSource(String className, NodeIterator conf)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception {
Object factory = obj.get(className);
if (factory == null) factory = ClassUtils.newInstance(className);
@@ -57,7 +57,7 @@
+ "\". Should implement the CodeFactory interface");
}
- public String getMethodSource(String className, DocumentFragment conf)
+ public String getMethodSource(String className, NodeIterator conf)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception {
Object factory = obj.get(className);
if (factory == null) factory = ClassUtils.newInstance(className);