/*
* (c) Copyright 2004 by Heng Yuan
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* ITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package cookxml.common.creator;
import org.w3c.dom.Element;
import cookxml.common.helper.NoAddHelper;
import cookxml.core.DecodeEngine;
import cookxml.core.interfaces.Creator;
/**
* @cxdoc
* This tag is only useful as the document root when one needs to work on multiple
* elements.
*
* @cxexample
* <codeblock type="xml">
* <base>
* <string text="one" id="1"/>
* <string text="two" id="two"/>
* <string text="three" id="three"/>
* </base>
* </codeblock>
*
* @author Heng Yuan
* @version $Id: BaseCreator.java 249 2007-06-07 07:18:23Z coconut $
* @since CookXml 1.0
*/
public class BaseCreator implements Creator
{
public Object create (String parentNS, String parentTag, Element elm, Object parentObj, DecodeEngine decodeEngine)
{
if (parentObj == null)
return new NoAddHelper ();
decodeEngine.setDoAdd (false);
if (parentTag != null)
decodeEngine.setCurrentTag (parentTag);
return parentObj;
}
public Object editFinished (String parentNS, String parentTag, Element elm, Object parentObj, Object obj, DecodeEngine decodeEngine)
{
return obj;
}
}