cziegeler 02/05/08 00:55:51
Modified: . todo.xml
src/java/org/apache/cocoon/webapps/session session-tran.xmap
src/scratchpad/src/org/apache/cocoon/sunshine
sunshine-int.xpipe sunshine.xpipe
src/webapp/sunspotdemo/resources saveglobalprofile.xml
saveroleprofile.xml saveuserprofile.xml
saveuserstatus.xml sunrise-changeuser.xml
sunrise-delrole.xml sunrise-deluser.xml
sunrise-newrole.xml sunrise-newuser.xml
Added: src/java/org/apache/cocoon/webapps/session/transformation
SourceWritingTransformer.java
Removed: src/scratchpad/src/org/apache/cocoon/sunshine
sunshine-tran.xmap
src/scratchpad/src/org/apache/cocoon/sunshine/transformation
InsertTransformer.java
src/scratchpad/src/org/apache/cocoon/transformation
SourceWritingTransformer.java
Log:
Fixing namespace for source writing transformer in portal demo and activating
insertion function
Revision Changes Path
1.32 +6 -1 xml-cocoon2/todo.xml
Index: todo.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/todo.xml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- todo.xml 7 May 2002 08:19:10 -0000 1.31
+++ todo.xml 8 May 2002 07:55:50 -0000 1.32
@@ -3,7 +3,7 @@
<!DOCTYPE todo PUBLIC "-//APACHE//DTD Todo V1.0//EN"
"src/documentation/xdocs/dtd/todo-v10.dtd">
<!--
- $Id: todo.xml,v 1.31 2002/05/07 08:19:10 cziegeler Exp $
+ $Id: todo.xml,v 1.32 2002/05/08 07:55:50 cziegeler Exp $
-->
@@ -88,6 +88,11 @@
</actions>
<actions priority="medium">
+
+ <action context="code">
+ Finish the SourceWritingTransformer: for insertion of fragments the
serializer
+ should be used instead of the XMLUtils.
+ </action>
<action context="code">
Rationalise the various copies of the DTDs and entities into one set.
1.3 +2 -0
xml-cocoon2/src/java/org/apache/cocoon/webapps/session/session-tran.xmap
Index: session-tran.xmap
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/session/session-tran.xmap,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- session-tran.xmap 7 May 2002 10:37:16 -0000 1.2
+++ session-tran.xmap 8 May 2002 07:55:50 -0000 1.3
@@ -12,4 +12,6 @@
<map:transformer name="session-post"
src="org.apache.cocoon.webapps.session.transformation.SessionPostTransformer"
pool-max="32" pool-min="8" pool-grow="4"/>
+ <map:transformer name="write-source"
+
src="org.apache.cocoon.webapps.session.transformation.SourceWritingTransformer"/>
</xmap>
1.1
xml-cocoon2/src/java/org/apache/cocoon/webapps/session/transformation/SourceWritingTransformer.java
Index: SourceWritingTransformer.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.webapps.session.transformation;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.components.source.WriteableSource;
import org.apache.cocoon.components.source.WriteableSAXSource;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.webapps.session.connector.ResourceConnector;
import org.apache.cocoon.webapps.session.xml.XMLUtil;
import org.apache.cocoon.xml.XMLConsumer;
import org.apache.cocoon.xml.XMLUtils;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.w3c.dom.*;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import java.util.Properties;
/**
* This transformer allows you to output to a WritableSource.
*
* <p>Definition:</p>
* <pre>
* <map:transformer name="tofile"
src="org.apache.cocoon.transformation.SourceWritingTransformer">
* <map:parameter name="serializer" value="xml"/> <!-- this is
the default Serializer (if your Source needs one, like for instance FileSource)
-->
* </map:transformer/>
* </pre>
*
* <p>Invocation:</p>
* <pre>
* <map:transform type="tofile">
* <map:parameter name="serializer" value="xml"/>
* </map:transform>
* </pre>
*
* <p>Input XML document example:</p>
* <pre>
* <page xmlns:source="http://apache.org/cocoon/source/1.0">
* ...
* <source:write src="context://doc/editable/my.xml">
* <page>
* XML Object body
* </page>
* </source:write>
* ...
* </page>
* </pre>
*
* <p>Output XML document example:</p>
* <pre>
* <page xmlns:source="http://apache.org/cocoon/source/1.0">
* ...
* <source:write
src="/source/specific/path/to/context/doc/editable/my.xml"
result="success|failure" action="new">
* source specific error message
* </source:write>
* ...
* </page>
* </pre>
*
* <P>Inserting of XML fragments:</p>
* This implementation allows the inserting of an xml fragment into a
* source.
*
* <pre>
* <page xmlns:source="http://apache.org/cocoon/source/1.0">
* ...
* <source:insert>
* <source:source>The SRC</source:source>
* <source:path>XPath denoting the position to
insert</source:path>
* <source:fragment>the xml fragment</source:fragment>
* </source:insert>
* ...
* </page>
* </pre>
*
* By default, the fragment is always inserted (added). It is possible to
specify
* a node (by an XPath) which will be replaced if it exists.
* <pre>
* <page xmlns:source="http://apache.org/cocoon/source/1.0">
* ...
* <source:insert>
* <source:source>The SRC</source:source>
* <source:path>XPath denoting the position to
insert</source:path>
* <source:fragment>the xml fragment</source:fragment>
* <source:replace>XPath denoting a criteria for which node will be
replaced</source:replace>
* </source:insert>
* ...
* </page>
* </pre>
*
* The information for <code>replace</code> has to be relative to path, but
can
* specify a subnode of the node the be replaced.
*
* The XPath specification is very complicated. So here is an example for the
sitemap:
* <pre>
* <page xmlns:source="http://apache.org/cocoon/source/1.0">
* ...
* <source:insert>
* <source:source>sitemap.xmap</source:source>
*
<source:path>/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0"
and
local-name()="sitemap"]/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0"
and
local-name()="components"]/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0"
and local-name()="generators"]</source:path>
* <source:fragment>
* <generator name="file"
xmln="http://apache.org/cocoon/sitemap/1.0">
* <test/>
* </generator>
* </source:fragment>
*
<source:replace>*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0"
and local-name()="generator" and attribute::name="file"]</source:replace>
* </source:insert>
* ...
* </page>
* </pre>
*
* This insert replaces (if it exists) the file generator definition with a
new one.
* As the sitemap uses namespaces the XPath for the generator is rather
complicated.
* Due to this it is necessary that the node specified by path exists if
namespaces
* are used! Otherwise a node with the name * would be created...
*
* The create attribute of insert. If this is set
* to true (default is true), the file is created if it does not exists.
* If it is set to false, it is not created, making insert a real insert.
* create is only usable for files!
* In addition the overwrite attribute is used to check if replacing is
allowed.
* If overwrite is true (the default) the node is replaced. If it is false
* the node is not inserted if the replace node is available.
*
* The <session:reinsert> option can be used to
* reinsert a replaced node at a given path in the new fragment.
*
* TODO: Use the serializer instead of the XMLUtils for inserting of fragments
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Quinn</a>
*
*/
public class SourceWritingTransformer
extends AbstractSessionTransformer {
private static String SWT_URI = "http://apache.org/cocoon/source/1.0";
private static String SWT_ELEMENT = "write";
private static String SWT_RESULT_ATTRIBUTE= "result";
private static String SWT_SRC_ATTRIBUTE = "src";
private static String SWT_ACTION_ATTRIBUTE = "action";
private static String SWT_SERIALIZER_ATTRIBUTE = "serializer";
private static String SWT_RESULT_FAILED = "failed";
private static String SWT_RESULT_SUCCESS = "success";
private static String SWT_ACTION_NONE = "none";
private static String SWT_ACTION_NEW = "new";
private static String SWT_ACTION_OVER = "overwritten";
public static final String INSERT_ELEMENT = "insert";
public static final String INSERT_CREATE_ATTRIBUTE = "create";
public static final String INSERT_OVERWRITE_ATTRIBUTE = "overwrite";
public static final String PATH_ELEMENT = "path";
public static final String FRAGMENT_ELEMENT = "fragment";
public static final String REPLACE_ELEMENT = "replace";
public static final String FILE_ELEMENT = "file";
public static final String REINSERT_ELEMENT = "reinsert";
/** The current state */
private static final int STATE_OUTSIDE = 0;
private static final int STATE_INSERT = 1;
private static final int STATE_RESOURCE = 2;
private static final int STATE_PATH = 3;
private static final int STATE_FRAGMENT = 4;
private static final int STATE_REPLACE = 5;
private static final int STATE_FILE = 6;
private static final int STATE_REINSERT = 7;
private int state;
/** The configured serializer name */
protected String configuredSerializerName;
/** The ContentHandler instance */
protected XMLConsumer ch; // is XMLConsumer suitable
for this purpose?
/** Are we using a Serializer? */
private boolean isSerializer = false;
/** Current Serializer name. */
private String serializer_name = null;
/** Current target name. */
private String target = null;
/** Current OutputStream. */
private OutputStream os = null;
/** Current status of outputting the file. */
private boolean failed = true;
/** Current error message. */
private String message = null;
/** Does the file exist, before we try to make it? */
private boolean exists = false;
/** the Source. */
private Source source = null;
/** the WritableSource. */
private WriteableSource wsource = null;
/**
* Constructor
* Set the namespace
*/
public SourceWritingTransformer() {
this.namespaceURI = SWT_URI;
}
/**
* Get the current <code>Configuration</code> instance used by this
* <code>Configurable</code>.
*/
public void configure(Configuration configuration)
throws ConfigurationException {
super.configure( configuration );
this.configuredSerializerName =
configuration.getChild(SWT_SERIALIZER_ATTRIBUTE).getValue(null);
}
/**
* Get the <code>Parameter</code> called "serializer" from the
* <code>Transformer</code> invocation.
*/
public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
this.serializer_name = par.getParameter(SWT_SERIALIZER_ATTRIBUTE,
this.configuredSerializerName);
if (this.serializer_name != null && this.getLogger().isDebugEnabled()
) {
this.getLogger().debug("Setup, using serializer: " +
this.serializer_name);
}
this.state = STATE_OUTSIDE;
}
/**
* Receive notification of the beginning of an element.
*
* @param uri The Namespace URI, or the empty string if the element has no
* Namespace URI or if Namespace
* processing is not being performed.
* @param loc The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
* @param raw The raw XML 1.0 name (with prefix), or the empty string if
* raw names are not available.
* @param a The attributes attached to the element. If there are no
* attributes, it shall be an empty Attributes object.
*/
public void startTransformingElement(String uri, String name, String raw,
Attributes attr)
throws SAXException, IOException, ProcessingException {
System.out.println("startTransformingElement: " + name + " - " +
this.state);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("BEGIN startTransformingElement uri=" +
uri +
", name=" + name + ", raw=" + raw + ", attr=" +
attr);
}
// Element: insert
if (name.equals(INSERT_ELEMENT)
&& this.state == STATE_OUTSIDE) {
this.state = STATE_INSERT;
if (attr.getValue(INSERT_CREATE_ATTRIBUTE) != null
&& attr.getValue(INSERT_CREATE_ATTRIBUTE).equals("false")) {
this.stack.push("false");
} else {
this.stack.push("true");
}
if (attr.getValue(INSERT_OVERWRITE_ATTRIBUTE) != null
&& attr.getValue(INSERT_OVERWRITE_ATTRIBUTE).equals("false"))
{
this.stack.push("false");
} else {
this.stack.push("true");
}
this.stack.push("INSERT");
// Element: file
} else if (name.equals(FILE_ELEMENT)
&& this.state == STATE_INSERT) {
this.state = STATE_FILE;
this.startTextRecording();
// Element: path
} else if (name.equals(PATH_ELEMENT)
&& this.state == STATE_INSERT) {
this.state = STATE_PATH;
this.startTextRecording();
// Element: replace
} else if (name.equals(REPLACE_ELEMENT)
&& this.state == STATE_INSERT) {
this.state = STATE_REPLACE;
this.startTextRecording();
// Element: fragment
} else if (name.equals(FRAGMENT_ELEMENT)
&& this.state == STATE_INSERT) {
this.state = STATE_FRAGMENT;
this.startRecording();
// Element: reinsert
} else if (name.equals(REINSERT_ELEMENT)
&& this.state == STATE_INSERT) {
this.state = STATE_REINSERT;
this.startTextRecording();
} else if (name.equals(SWT_ELEMENT)) {
this.failed = false;
this.message = null;
this.target = "";
// look for the Source
String src = attr.getValue("",SWT_SRC_ATTRIBUTE);
try {
this.message = "The src attribute could not be resolved";
this.source = this.resolver.resolveURI(src);
this.target = this.source.getSystemId();
this.message = "The src attribute doesn't resolve to a
writeable source";
this.wsource = (WriteableSource)this.source;
this.exists = this.wsource.exists();
// has a Serializer been specified?
String local_serializer =
attr.getValue("",SWT_SERIALIZER_ATTRIBUTE);
if (local_serializer != null) this.serializer_name =
local_serializer;
if (this.serializer_name != null) {
// Lookup the Serializer
this.message = "that Serializer does not exist";
ComponentSelector selector = null;
try {
selector =
(ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
this.ch =
(Serializer)selector.select(this.serializer_name);
this.message = "Could not open the source for
writing";
this.os = this.wsource.getOutputStream();
this.message = "could not write the file";
((Serializer)this.ch).setOutputStream(this.os);
// Is there a way to avoid this casting?
this.isSerializer = true;
} finally {
this.manager.release( selector );
}
} else {
this.message = "could not get a ContentHandler";
this.ch =
(XMLConsumer)((WriteableSAXSource)wsource).getContentHandler();
}
this.addRecorder( this.ch );
this.startDocument();
this.sendStartPrefixMapping();
} catch (Exception e) {
getLogger().warn("failed, " + this.message, e);
this.failed = true;
try {
if (this.isSerializer) {
this.wsource.cancel(this.os);
} else {
((WriteableSAXSource)this.wsource).cancel(this.ch);
}
} catch (Exception e2) {
getLogger().warn("failed to cancel: " + this.target, e2);
this.message += " and failed to cancel";
}
}
// default
} else {
super.startTransformingElement(uri, name, raw, attr);
}
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("END startTransformingElement");
}
}
/**
* Receive notification of the end of an element.
*
* @param uri The Namespace URI, or the empty string if the element has no
* Namespace URI or if Namespace
* processing is not being performed.
* @param loc The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
* @param raw The raw XML 1.0 name (with prefix), or the empty string if
* raw names are not available.
*/
public void endTransformingElement(String uri, String name, String raw)
throws SAXException, IOException, ProcessingException {
System.out.println("endTransformingElement: " + name + " - " +
this.state);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("BEGIN endTransformingElement uri=" + uri +
", name=" + name +
", raw=" + raw);
}
if (name.equals(INSERT_ELEMENT) == true && this.state ==
STATE_INSERT) {
this.state = STATE_OUTSIDE;
// get the information from the stack
String tag;
String fileName = null;
DocumentFragment fragment = null;
String path = null;
String replacePath = null;
String reinsert = null;
do {
tag = (String)this.stack.pop();
if (tag.equals("PATH") == true) {
path = (String)this.stack.pop();
} else if (tag.equals("FILE") == true) {
fileName = (String)this.stack.pop();
} else if (tag.equals("FRAGMENT") == true) {
fragment = (DocumentFragment)this.stack.pop();
} else if (tag.equals("REPLACE") == true) {
replacePath = (String)this.stack.pop();
} else if (tag.equals("REINSERT") == true) {
reinsert = (String)this.stack.pop();
}
} while (tag.equals("INSERT") == false);
final boolean overwrite = this.stack.pop().equals("true");
final boolean create = this.stack.pop().equals("true");
this.insertFragment(fileName,
path,
fragment,
replacePath,
create,
overwrite,
reinsert);
// Element: file
} else if (name.equals(FILE_ELEMENT) == true && this.state ==
STATE_FILE) {
this.state = STATE_INSERT;
this.stack.push(this.endTextRecording());
this.stack.push("FILE");
// Element: path
} else if (name.equals(PATH_ELEMENT) == true && this.state ==
STATE_PATH) {
this.state = STATE_INSERT;
this.stack.push(this.endTextRecording());
this.stack.push("PATH");
// Element: replace
} else if (name.equals(REPLACE_ELEMENT) == true && this.state ==
STATE_REPLACE) {
this.state = STATE_INSERT;
this.stack.push(this.endTextRecording());
this.stack.push("REPLACE");
// Element: fragment
} else if (name.equals(FRAGMENT_ELEMENT) == true && this.state ==
STATE_FRAGMENT) {
this.state = STATE_INSERT;
this.stack.push(this.endRecording());
this.stack.push("FRAGMENT");
// Element: reinsert
} else if (name.equals(REINSERT_ELEMENT) == true
&& this.state == STATE_REINSERT) {
this.state = STATE_INSERT;
this.stack.push(this.endTextRecording());
this.stack.push("REINSERT");
} else if (name.equals(SWT_ELEMENT)) {
if (!this.failed) {
this.sendEndPrefixMapping();
this.endDocument();
this.removeRecorder();
// close the OutputStream
try {
if (this.os != null) {
this.os.close();
this.os = null;
}
} catch(Exception e) {
getLogger().warn("Failed to close source", e);
this.message = "Failed to close source";
this.failed = true;
try {
this.message = "Failed to cancel source";
if (this.isSerializer) {
this.wsource.cancel(this.os);
} else {
((WriteableSAXSource)this.wsource).cancel(this.ch);
}
} catch (Exception e2) {
getLogger().warn("failed to cancel: " + this.target,
e2);
}
} finally {
if (this.source != null) {
this.resolver.release( this.source );
this.source = null;
}
}
if (!this.failed) {
this.wsource = null;
}
// Report result
String result = (this.failed) ? SWT_RESULT_FAILED :
SWT_RESULT_SUCCESS;
String action = SWT_ACTION_NONE;
if (!this.failed){
if (this.exists) {
action = SWT_ACTION_OVER;
} else {
action = SWT_ACTION_NEW;
}
}
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute(null, SWT_SRC_ATTRIBUTE,
SWT_SRC_ATTRIBUTE, "CDATA", this.target);
attrs.addAttribute(null, SWT_ACTION_ATTRIBUTE,
SWT_ACTION_ATTRIBUTE, "CDATA", action);
attrs.addAttribute(null, SWT_RESULT_ATTRIBUTE,
SWT_RESULT_ATTRIBUTE, "CDATA", result);
if (this.serializer_name != null) attrs.addAttribute(null,
SWT_SERIALIZER_ATTRIBUTE, SWT_SERIALIZER_ATTRIBUTE, "CDATA",
this.serializer_name);
super.startElement(uri, name, raw, attrs);
if (this.message != null && this.failed == true)
super.characters(this.message.toCharArray(), 0, this.message.length());
super.endElement(uri, name, raw);
getLogger().debug("Source Written");
}
// default
} else {
super.endTransformingElement(uri, name, raw);
}
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("END endTransformingElement");
}
}
public void recycle() {
if (this.wsource != null) {
getLogger().error("cancelled by recycle() method");
if (this.os != null) {
try {
this.wsource.cancel(this.os);
} catch (Exception e) {
getLogger().error("failed to cancel in recycle() method:
OutputStream");
}
} else if (this.ch != null) {
try {
((WriteableSAXSource)this.wsource).cancel(this.ch);
} catch (Exception e) {
getLogger().error("failed to cancel in recycle() method:
ContentHandler");
}
}
}
if (this.source != null) {
this.resolver.release( this.source );
this.source = null;
}
if (isSerializer) this.manager.release((Component)this.ch);
this.ch = null;
super.recycle();
}
/**
* Insert a fragment into a file.
* The file is loaded by the resource connector.
*
* @param fileName The name of the xml file.
* @param path The XPath specifying the node under which the data is
inserted
* @param fragment The data to be inserted.
* @param replacePath Optional XPath relative to <CODE>path</CODE>. This
path
* can specify a node which will be removed if it
exists.
* So insertFragment can be used as a replace utility.
* @param create If the file does not exists and this is set to
* <CODE>false</CODE> nothing is inserted. If it is set
* to <CODE>true</CODE> the file is created and the
data
* is inserted.
* @param overwrite If this is set to <CODE>true</CODE> the data is only
* inserted if the node specified by the
<CODE>replacePath</CODE>
* does not exists.
* @param reinsertPath If specified and a node is replaced , all children
of
* this replaced node will be reinserted at the given
path.
*/
public void insertFragment(String fileName,
String path,
DocumentFragment fragment,
String replacePath,
boolean create,
boolean overwrite,
String reinsertPath)
throws SAXException, IOException, ProcessingException {
// no sync req
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("BEGIN insertFragment fileName="+fileName+
", path="+path+
", replace="+replacePath+
", create="+create+
", overwrite="+overwrite+
", resinsert="+reinsertPath+
", fragment="+(fragment == null ? "null" :
XMLUtils.serializeNodeToXML(fragment)));
}
// test parameter
if (fileName == null) {
throw new ProcessingException("insertFragment: file name is
required.");
}
if (path == null) {
throw new ProcessingException("insertFragment: path is
required.");
}
if (fragment == null) {
throw new ProcessingException("insertFragment: fragment is
required.");
}
Source fileSource = null;
String systemId = null;
try {
fileSource = this.resolver.resolveURI( fileName );
systemId = fileSource.getSystemId();
if (systemId.startsWith("file:") == false) {
throw new ProcessingException("insertFragment: this is not a
file: " + systemId);
}
} catch (SourceException se) {
throw new ProcessingException("Error during resolving.", se);
} finally {
if (fileSource != null) this.resolver.release(fileSource);
}
if (path.startsWith("/") == true) path = path.substring(1);
File file = new File(systemId.substring(5));
DocumentFragment resource = null;
if (file.exists() == true) {
resource =
this.getResourceConnector().loadXML(ResourceConnector.RESOURCE_TYPE_FILE, null,
fileName, null);
// import the fragment
Node importNode =
resource.getOwnerDocument().importNode(fragment, true);
// get the node
Node parent = XMLUtil.selectSingleNode(resource, path);
// replace?
if (replacePath != null) {
try {
Node replaceNode = XMLUtil.getSingleNode(parent,
replacePath);
// now get the parent of this node until it is the parent
node for insertion
while (replaceNode != null &&
replaceNode.getParentNode().equals(parent) == false) {
replaceNode = replaceNode.getParentNode();
}
if (replaceNode != null) {
if (overwrite == true) {
parent.replaceChild(importNode, replaceNode);
if (reinsertPath != null) {
Node insertAt =
XMLUtil.getSingleNode(importNode, reinsertPath);
if (insertAt != null) {
while (replaceNode.hasChildNodes() ==
true) {
insertAt.appendChild(replaceNode.getFirstChild());
}
}
}
}
} else {
parent.appendChild(importNode);
}
} catch (javax.xml.transform.TransformerException sax) {
throw new ProcessingException("TransformerException: " +
sax, sax);
}
} else { // no replace
parent.appendChild(importNode);
}
} else {
if (create == true) {
Document doc = XMLUtil.createDocument();
resource = doc.createDocumentFragment();
// import the fragment
Node importNode =
resource.getOwnerDocument().importNode(fragment, true);
// get the node
Node parent = XMLUtil.selectSingleNode(resource, path);
// add fragment
parent.appendChild(importNode);
}
}
if (resource != null) {
// finally: save resource
resource.normalize();
this.getResourceConnector().saveXML(ResourceConnector.RESOURCE_TYPE_FILE, null,
fileName, null,
resource);
}
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("END insertFragment");
}
}
}
1.7 +2 -2
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/sunshine-int.xpipe
Index: sunshine-int.xpipe
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/sunshine-int.xpipe,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- sunshine-int.xpipe 20 Apr 2002 03:47:00 -0000 1.6
+++ sunshine-int.xpipe 8 May 2002 07:55:50 -0000 1.7
@@ -20,7 +20,7 @@
<map:generate
src="sunspotdemo/resources/sunrise-changeuser.xml"/>
<map:transform type="session"/>
<map:transform src="sunspotdemo/styles/changeuser.xsl"/>
- <map:transform type="sunShineInsert"/>
+ <map:transform type="write-source"/>
<map:transform src="sunspotdemo/styles/portal.xsl"/>
<map:serialize type="xml"/>
</map:match>
@@ -28,7 +28,7 @@
<map:match pattern="sunspotdemoresource-*">
<map:generate src="sunspotdemo/resources/{1}.xml"/>
<map:transform type="session"/>
- <map:transform type="sunShineInsert"/>
+ <map:transform type="write-source"/>
<map:transform src="sunspotdemo/styles/portal.xsl"/>
<map:serialize type="xml"/>
</map:match>
1.5 +3 -3
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/sunshine.xpipe
Index: sunshine.xpipe
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/sunshine.xpipe,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sunshine.xpipe 18 Apr 2002 08:17:29 -0000 1.4
+++ sunshine.xpipe 8 May 2002 07:55:50 -0000 1.5
@@ -70,13 +70,13 @@
<map:match pattern="sunspotdemoresource-save*">
<map:generate
src="sunspotdemo/resources/save{1}.xml"/>
<map:transform type="session"/>
- <map:transform type="sunShineInsert"/>
+ <map:transform type="write-source"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="sunspotdemoresource-*">
<map:generate
src="sunspotdemo/resources/{1}.xml"/>
<map:transform type="session"/>
- <map:transform type="sunShineInsert"/>
+ <map:transform type="write-source"/>
<map:transform
src="sunspotdemo/styles/portal.xsl"/>
<map:serialize type="xml"/>
</map:match>
@@ -174,7 +174,7 @@
<map:match pattern="sunspotdemo-*">
<map:generate
src="sunspotdemo/resources/auth/{1}.xml"/>
<map:transform type="session"/>
- <map:transform type="sunShineInsert"/>
+ <map:transform type="write-source"/>
<map:transform
src="sunspotdemo/styles/TO-html.xsl"/>
<map:transform type="encodeURL"/>
<map:serialize/>
1.3 +9 -8
xml-cocoon2/src/webapp/sunspotdemo/resources/saveglobalprofile.xml
Index: saveglobalprofile.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/saveglobalprofile.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- saveglobalprofile.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ saveglobalprofile.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,13 +1,14 @@
<?xml version="1.0"?>
-<!-- $Id: saveglobalprofile.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: saveglobalprofile.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: This resource saves the global delta.
-->
-<userdelta xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
-
<session:file>sunspotdemo/profiles/globalprofile.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><session:getxml context="request"
path="/parameter/content"/></session:fragment>
- <session:replace>global-delta</session:replace>
- </session:insert>
+<userdelta xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <source:insert>
+ <source:file>sunspotdemo/profiles/globalprofile.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><session:getxml context="request"
path="/parameter/content"/></source:fragment>
+ <source:replace>global-delta</source:replace>
+ </source:insert>
</userdelta>
1.3 +9 -8
xml-cocoon2/src/webapp/sunspotdemo/resources/saveroleprofile.xml
Index: saveroleprofile.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/saveroleprofile.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- saveroleprofile.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ saveroleprofile.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,13 +1,14 @@
<?xml version="1.0"?>
-<!-- $Id: saveroleprofile.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: saveroleprofile.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: This resource saves the role profile delta to a file with the
name of the role.
-->
-<userdelta xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
- <session:file>sunspotdemo/profiles/roleprofile-<session:getxml
context="request" path="/parameter/role"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><session:getxml context="request"
path="/parameter/content"/></session:fragment>
- <session:replace>role-delta</session:replace>
- </session:insert>
+<userdelta xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <session:source>
+ <source:file>sunspotdemo/profiles/roleprofile-<session:getxml
context="request" path="/parameter/role"/>.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><session:getxml context="request"
path="/parameter/content"/></source:fragment>
+ <source:replace>role-delta</source:replace>
+ </source:insert>
</userdelta>
1.3 +9 -8
xml-cocoon2/src/webapp/sunspotdemo/resources/saveuserprofile.xml
Index: saveuserprofile.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/saveuserprofile.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- saveuserprofile.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ saveuserprofile.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,15 +1,16 @@
<?xml version="1.0"?>
-<!-- $Id: saveuserprofile.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: saveuserprofile.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: This resource save the user profile delta to a file with the
name of the user.
-->
-<userdelta xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
- <session:file>sunspotdemo/profiles/userprofile-<session:getxml
context="request" path="/parameter/ID"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><session:getxml context="request"
path="/parameter/content"/></session:fragment>
- <session:replace>user-delta</session:replace>
- </session:insert>
+<userdelta xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <source:insert>
+ <source:file>sunspotdemo/profiles/userprofile-<session:getxml
context="request" path="/parameter/ID"/>.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><session:getxml context="request"
path="/parameter/content"/></source:fragment>
+ <source:replace>user-delta</source:replace>
+ </source:insert>
</userdelta>
1.3 +9 -8
xml-cocoon2/src/webapp/sunspotdemo/resources/saveuserstatus.xml
Index: saveuserstatus.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/saveuserstatus.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- saveuserstatus.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ saveuserstatus.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,14 +1,15 @@
<?xml version="1.0"?>
-<!-- $Id: saveuserstatus.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: saveuserstatus.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: This resource save the user status profile to a file with the
name of the user.
-->
-<userdelta xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
- <session:file>sunspotdemo/profiles/userstatus-<session:getxml
context="request" path="/parameter/ID"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><session:getxml context="request"
path="/parameter/content"/></session:fragment>
- <session:replace>status-profile</session:replace>
- </session:insert>
+<userdelta xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <source:insert>
+ <source:file>sunspotdemo/profiles/userstatus-<session:getxml
context="request" path="/parameter/ID"/>.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><session:getxml context="request"
path="/parameter/content"/></source:fragment>
+ <source:replace>status-profile</source:replace>
+ </source:insert>
</userdelta>
1.3 +10 -9
xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-changeuser.xml
Index: sunrise-changeuser.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-changeuser.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sunrise-changeuser.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ sunrise-changeuser.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,16 +1,17 @@
<?xml version="1.0"?>
-<!-- $Id: sunrise-changeuser.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: sunrise-changeuser.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: Add a new user
-->
-<adduser xmlns:session="http://cocoon.apache.org/session/1.0">
+<adduser xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
<!-- add to authentication users -->
- <session:insert>
-
<session:file>sunspotdemo/resources/sunrise-user.xml</session:file>
- <session:path>/authentication/users</session:path>
- <session:fragment>
+ <source:insert>
+
<source:file>sunspotdemo/resources/sunrise-user.xml</source:file>
+ <source:path>/authentication/users</source:path>
+ <source:fragment>
<user>
<name><session:getxml context="request"
path="/parameter/ID"/></name>
<password>
@@ -34,7 +35,7 @@
<bankname><session:getxml context="request"
path="/parameter/bankname"/></bankname>
<accountid><session:getxml context="request"
path="/parameter/accountid"/></accountid>
</user>
- </session:fragment>
- <session:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</session:replace>
- </session:insert>
+ </source:fragment>
+ <source:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</source:replace>
+ </source:insert>
</adduser>
1.3 +16 -15
xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-delrole.xml
Index: sunrise-delrole.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-delrole.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sunrise-delrole.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ sunrise-delrole.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,23 +1,24 @@
<?xml version="1.0"?>
-<!-- $Id: sunrise-delrole.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: sunrise-delrole.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: Delete a role
-->
-<addrole xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
-
<session:file>sunspotdemo/resources/sunrise-roles.xml</session:file>
- <session:path>roles</session:path>
- <session:fragment></session:fragment>
- <session:replace>role[. = '<session:getxml context="request"
path="/parameter/role"/>']</session:replace>
- </session:insert>
+<addrole xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <source:insert>
+
<source:file>sunspotdemo/resources/sunrise-roles.xml</source:file>
+ <source:path>roles</source:path>
+ <source:fragment></source:fragment>
+ <source:replace>role[. = '<session:getxml context="request"
path="/parameter/role"/>']</source:replace>
+ </source:insert>
<!-- delete role profile -->
- <session:insert>
- <session:file>sunspotdemo/profiles/roleprofile-<session:getxml
context="request" path="/parameter/role"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><role-delta/>
- </session:fragment>
- <session:replace>role-delta</session:replace>
- </session:insert>
+ <source:insert>
+ <source:file>sunspotdemo/profiles/roleprofile-<session:getxml
context="request" path="/parameter/role"/>.xml</source:file>
+ <source:path>/</session:path>
+ <source:fragment><role-delta/>
+ </source:fragment>
+ <source:replace>role-delta</source:replace>
+ </source:insert>
</addrole>
1.3 +24 -23
xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-deluser.xml
Index: sunrise-deluser.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-deluser.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sunrise-deluser.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ sunrise-deluser.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,32 +1,33 @@
<?xml version="1.0"?>
-<!-- $Id: sunrise-deluser.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: sunrise-deluser.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: Delete a user
-->
-<adduser xmlns:session="http://cocoon.apache.org/session/1.0">
+<adduser xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
<!-- delete from authentication users -->
- <session:insert>
-
<session:file>sunspotdemo/resources/sunrise-user.xml</session:file>
- <session:path>/authentication/users</session:path>
- <session:fragment>
- </session:fragment>
- <session:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</session:replace>
- </session:insert>
+ <source:insert>
+
<source:file>sunspotdemo/resources/sunrise-user.xml</source:file>
+ <source:path>/authentication/users</source:path>
+ <source:fragment>
+ </source:fragment>
+ <source:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</source:replace>
+ </source:insert>
<!-- delete user profile -->
- <session:insert>
- <session:file>sunspotdemo/profiles/userprofile-<session:getxml
context="request" path="/parameter/ID"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><user-delta/>
- </session:fragment>
- <session:replace>user-delta</session:replace>
- </session:insert>
+ <source:insert>
+ <source:file>sunspotdemo/profiles/userprofile-<session:getxml
context="request" path="/parameter/ID"/>.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><user-delta/>
+ </source:fragment>
+ <source:replace>user-delta</source:replace>
+ </source:insert>
<!-- delete user status profile -->
- <session:insert>
- <session:file>sunspotdemo/profiles/userstatus-<session:getxml
context="request" path="/parameter/ID"/>.xml</session:file>
- <session:path>/</session:path>
- <session:fragment><user-delta/>
- </session:fragment>
- <session:replace>status-profile</session:replace>
- </session:insert>
+ <source:insert>
+ <source:file>sunspotdemo/profiles/userstatus-<session:getxml
context="request" path="/parameter/ID"/>.xml</source:file>
+ <source:path>/</source:path>
+ <source:fragment><user-delta/>
+ </source:fragment>
+ <source:replace>status-profile</source:replace>
+ </source:insert>
</adduser>
1.3 +8 -7
xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-newrole.xml
Index: sunrise-newrole.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-newrole.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sunrise-newrole.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ sunrise-newrole.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,14 +1,15 @@
<?xml version="1.0"?>
-<!-- $Id: sunrise-newrole.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: sunrise-newrole.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: Add a new role
-->
-<addrole xmlns:session="http://cocoon.apache.org/session/1.0">
- <session:insert>
-
<session:file>sunspotdemo/resources/sunrise-roles.xml</session:file>
- <session:path>roles</session:path>
- <session:fragment><role><session:getxml context="request"
path="/parameter/role"/></role></session:fragment>
- </session:insert>
+<addrole xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
+ <source:insert>
+
<source:file>sunspotdemo/resources/sunrise-roles.xml</source:file>
+ <source:path>roles</source:path>
+ <source:fragment><role><session:getxml context="request"
path="/parameter/role"/></role></source:fragment>
+ </source:insert>
</addrole>
1.3 +10 -9
xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-newuser.xml
Index: sunrise-newuser.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/webapp/sunspotdemo/resources/sunrise-newuser.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sunrise-newuser.xml 18 Apr 2002 08:13:41 -0000 1.2
+++ sunrise-newuser.xml 8 May 2002 07:55:51 -0000 1.3
@@ -1,16 +1,17 @@
<?xml version="1.0"?>
-<!-- $Id: sunrise-newuser.xml,v 1.2 2002/04/18 08:13:41 cziegeler Exp $
+<!-- $Id: sunrise-newuser.xml,v 1.3 2002/05/08 07:55:51 cziegeler Exp $
Description: Add a new user
-->
-<adduser xmlns:session="http://cocoon.apache.org/session/1.0">
+<adduser xmlns:source="http://apache.org/cocoon/source/1.0"
+ xmlns:session="http://cocoon.apache.org/session/1.0">
<!-- add to authentication users -->
- <session:insert>
-
<session:file>sunspotdemo/resources/sunrise-user.xml</session:file>
- <session:path>/authentication/users</session:path>
- <session:fragment>
+ <source:insert>
+
<source:file>sunspotdemo/resources/sunrise-user.xml</source:file>
+ <source:path>/authentication/users</source:path>
+ <source:fragment>
<user>
<name><session:getxml context="request"
path="/parameter/ID"/></name>
<password><session:getxml context="request"
path="/parameter/password"/></password>
@@ -30,7 +31,7 @@
<bankname><session:getxml context="request"
path="/parameter/bankname"/></bankname>
<accountid><session:getxml context="request"
path="/parameter/accountid"/></accountid>
</user>
- </session:fragment>
- <session:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</session:replace>
- </session:insert>
+ </source:fragment>
+ <source:replace>user[name='<session:getxml context="request"
path="/parameter/ID"/>']</source:replace>
+ </source:insert>
</adduser>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]