Then, activity bindings might access the processDefinition like this:
public class MyNodeBinding implements Binding { public Object parse(Element element, Parse parse, Parser parser) { // instantiate the object for this binding MyNode myNode = new MyNode(); // add the activity to the processDefinition MyProcess myProcess = parse.findObject(MyProcess.class); myProcess.addNode(myNode); myNode.setMyProcess(myProcess); return myNode; } }
A parser implementation will typically have a static Bindings object that is leveraged in all parser objects. To customize bindings for a such a parser be sure to make a deep copy with {@link Bindings#Bindings(Bindings)} beforeyou start adding more bindings to the specialized parser. Otherwise the base parser's bindings will be updated as well.
This parser is build for inheritance. Overriding method {@link #parseDocumentElement(Element,Parse)} can be an easy way to start writing your own logic on walking the Document Object Model (DOM). Such customizations can still be combined with the usage of bindings.
A parser can be configured with a set of entities with the {@link #addEntity(String,Entity)} method. The {@link UrlEntity} hasa convenience method to build entities from resources {@link UrlEntity#UrlEntity(String,ClassLoader)}.
When a document builder is created, the default implementation of the {@link #setEntityResolver(DocumentBuilder)} will set this parser as the entity resolver.The implementation method of {@link EntityResolver} ({@link #resolveEntity(String,String)}will use the added {@link Entity}s to try and find a match based on the publicId. If one is found, the {@link Entity} inputSource is returned, otherwisethe systemId is used.
This class is intended to be used with aggregation as well as inheritence.
@author Tom Baeyens
|
|
|
|
|
|
|
|