XMLBuilderfeatures logic to construct a tree structure using instances of
DOMBuildercontains the exact same tree-construction logic, only it uses instances of classes that implement the
Elementinterface (from the Document Object Model).There is a great deal of duplicated tree-construction code in each of the builders because
Elementdon't share a common interface.
Elementshared a common interface, the builder logic would become identical, thereby allowing it to be shared in a builder superclass. Sounds like a job for the Adapter pattern.