Workflow Manual / Version 2207
Table Of ContentsThe XML files used to configure CoreMedia CMS components are processed by the BeanParser, which is a basic part of the system. As such, it is used to
read the license,
define document types and workflows,
configure Site Manager.
The BeanParser processes the XML files as follows:
For each XML element it tries to instantiate an object of a class, which is determined by a factory or via the
class
attribute. The object is created via Java Reflection and a zero-argument constructor.If the XML element occurs inside another XML element, it tries to set the object created by the inner element on the object created by the outer element. For this, it calls a setter method and passes the object. The setter method may be named
set<Element Name>()
,add<ElementName>()
or simplyset()
oradd().
For each attribute of an element it calls a setter method on the object that was created when parsing the element start tag. The setter method may be named
set<AttributeName>()
,add<AttributeName>()
or simplyset()
oradd().
Example:
Assume the following XML file:
<FirstElement class="com.example.FirstElement" attribute1="Ho"> <SecondElement class="com.example.SecondElement" attribute="Hi"/> </FirstElement>
Example 4.1. Example of a BeanParser XML file
The BeanParser will execute the following steps:
Create an instance of class
com.example.FirstElement
.Call
setAttribute1("Ho")
on that instance.Create an instance of class
com.example.SecondElement
.Call
setAttribute("Hi")
on that second instance.Call
firstElement.setSecondElement(secondElement)
, that is, set the object created in step 3 on the object created in step 1.
Advanced features:
The class attribute has a special meaning as it determines the name of the class to instantiate objects from. For this attribute, no setter methods has to be defined inside the class.
The BeanParser works without an XML Document Type
Definition (DTD), but in connection with a DTD, it makes use of ID
and
IDREF
feature of the XML parsers. The object, that has been created by the
element with the IDREF
attribute, is substituted by the object that is defined
the corresponding ID
attribute. Again, no setter methods have to be defined
inside the involved classes.