cookxml.core.creator
Class IncludeCreator
java.lang.Object
cookxml.core.creator.IncludeCreator
- All Implemented Interfaces:
- Creator
- public class IncludeCreator
- extends Object
- implements Creator
This class attempt to load another XML file. This tag is different from idref in that
idref retrieves the same object of the element referenced, while this creator creates
a new object for the element. The constructor of this tag is in the format of
"resourcename" or "resourcename#id", or "#id". Thus, this tag is able to include the
entire content of an XML document, or the element of having the specified id, or the
current document which have the specified id. If the XML document is not the current
document, the document is parsed using the same DocumentBuilder used to parse the
current document.
It is necessary to be aware that if the included document also contains include tags,
include using local id will not work as expected.
- Since:
- CookXml 2.0
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ID_SEPARATOR
public static final String ID_SEPARATOR
- See Also:
- Constant Field Values
IncludeCreator
public IncludeCreator()
getInstance
public static Creator getInstance()
create
public Object create(String parentNS,
String parentTag,
Element elm,
Object parentObj,
DecodeEngine decodeEngine)
throws CreatorException
- Description copied from interface:
Creator
- This function is called whenever decodeEngine starts processing an element. It should return
an object that corresponds to the tag, or null to indicate no object could be created.
If the object returned is of NoAdd type, then the object is not added to the parent object
by decodeEngine.
There can be creative use of this function. For example, one could create another instance
of CookXml that process the element differently, then call this instanceof decodeEngine to
add the processed object to the parent, and then return null to tell this instance of
decodeEngine/CookXml to stop processing the element.
- Specified by:
create
in interface Creator
- Parameters:
parentNS
- the parent tag namespace.parentTag
- the parent tag that contains this elementelm
- the DOM element that contains all the information regarding this node.parentObj
- the parent object in the nodedecodeEngine
- the decode engine that is being used @throws CreatorException
- Returns:
- the object created, or null to tell decodeEngine to stop processing this node
- Throws:
CreatorException
editFinished
public Object editFinished(String parentNS,
String parentTag,
Element elm,
Object parentObj,
Object obj,
DecodeEngine decodeEngine)
throws CreatorException
- Description copied from interface:
Creator
- This function is called when the element and its subnodes have all been processed. and about
to be returned. For many helper objects that implement NoAdd, this is a great time to generate
the real object and call the decodeEngine.addChild to add the real object to the parent.
- Specified by:
editFinished
in interface Creator
- Parameters:
parentNS
- the parent tag namespace.parentTag
- the parent element tagelm
- the DOM element that contains all the information regarding this node.parentObj
- the parent object of the parent elementobj
- the object that was created by this create functiondecodeEngine
- the decode engine that is being used.
- Returns:
- the object. The purpose is to allow a helper object to return the real object.
- Throws:
CreatorException