void processOperation ( HierarchyWrapperOperation operation ) { // Hook for start operation . startOfProcess ( ) ; // Hook to process other content (newlines and comments) otherContentList . forEach ( operation :: processOtherContent ) ; if ( elementContent != null && elementContent . isContentElement ( ) ) { // Hook to process element operation . processElement ( elementContent ) ; } // Hook to manipulate the order of the children operation . manipulateChildElements ( children ) ; // Hook to modify the operation before traversing sub levels HierarchyWrapperOperation subOperation = operation . createSubOperation ( ) ; for ( HierarchyWrapper child : children ) { child . processOperation ( subOperation ) ; } // Hook for end of process operation . endOfProcess ( ) ; }
Template method to traverse xml hierarchy