Task Description: Implement XML ChangeLog Serialization
Functionality to be Implemented:
You are required to implement the functionality for the XMLChangeLogSerializer class, which provides methods for serialization of various components related to database change logs in an XML format. In particular, you will need to ensure that the createNode(SqlVisitor visitor) method correctly constructs an XML Element that represents the properties of the SqlVisitor object.
Input/Output Requirements:
Input:
A SqlVisitor object passed to the createNode(SqlVisitor visitor) method, which may contain several fields annotated with ChangeProperty.
Output:
The method should return an Element that has:
A namespace defined by XMLChangeLogSAXParser.getDatabaseChangeLogNameSpace().
Attributes corresponding to the fields of the SqlVisitor object that are not excluded from serialization (i.e., not marked with ChangeProperty.includeInSerialization()).
Additional fields serialVersionUID and $VRc should be ignored.
Implementation Details:
Add the method public Element createNode(SqlVisitor visitor) in the XMLChangeLogSerializer class.
Ensure to:
Reflectively access all declared fields (including inherited ones) of the SqlVisitor class.
Set the appropriate attributes on the XML Element based on the field values.
Handle any exceptions with a proper throw of UnexpectedLiquibaseException.
Location:
Place your implementation in the /app/ directory under the XMLChangeLogSerializer class file. Make sure to perform any necessary imports and ensure the code adheres to standard coding practices.
Additional Notes:
Consider writing unit tests to verify that the createNode method behaves as expected for different SqlVisitor instances.