private Document mergeAdditionalTranslatedXML ( BuildData buildData , final Document topicDoc , final TranslatedTopicWrapper translatedTopic , final TopicType topicType ) throws BuildProcessingException { Document retValue = topicDoc ; if ( ! isNullOrEmpty ( translatedTopic . getTranslatedAdditionalXML ( ) ) ) { Document additionalXMLDoc = null ; try { additionalXMLDoc = XMLUtilities . convertStringToDocument ( translatedTopic . getTranslatedAdditionalXML ( ) ) ; } catch ( Exception ex ) { buildData . getErrorDatabase ( ) . addError ( translatedTopic , ErrorType . INVALID_CONTENT , BuilderConstants . ERROR_INVALID_TOPIC_XML + " " + StringUtilities . escapeForXML ( ex . getMessage ( ) ) ) ; retValue = DocBookBuildUtilities . setTopicXMLForError ( buildData , translatedTopic , getErrorInvalidValidationTopicTemplate ( ) . getValue ( ) ) ; } if ( additionalXMLDoc != null ) { // Merge the two together try { if ( TopicType . AUTHOR_GROUP . equals ( topicType ) ) { DocBookBuildUtilities . mergeAuthorGroups ( topicDoc , additionalXMLDoc ) ; } else if ( TopicType . REVISION_HISTORY . equals ( topicType ) ) { DocBookBuildUtilities . mergeRevisionHistories ( topicDoc , additionalXMLDoc ) ; } } catch ( BuildProcessingException ex ) { final String xmlStringInCDATA = XMLUtilities . wrapStringInCDATA ( translatedTopic . getTranslatedAdditionalXML ( ) ) ; buildData . getErrorDatabase ( ) . addError ( translatedTopic , ErrorType . INVALID_CONTENT , BuilderConstants . ERROR_BAD_XML_STRUCTURE + " " + StringUtilities . escapeForXML ( ex . getMessage ( ) ) + " The processed XML is <programlisting>" + xmlStringInCDATA + "</programlisting>" ) ; retValue = DocBookBuildUtilities . setTopicXMLForError ( buildData , translatedTopic , getErrorInvalidValidationTopicTemplate ( ) . getValue ( ) ) ; } } else { final String xmlStringInCDATA = XMLUtilities . wrapStringInCDATA ( translatedTopic . getTranslatedAdditionalXML ( ) ) ; buildData . getErrorDatabase ( ) . addError ( translatedTopic , ErrorType . INVALID_CONTENT , BuilderConstants . ERROR_INVALID_XML_CONTENT + " The processed XML is <programlisting>" + xmlStringInCDATA + "</programlisting>" ) ; retValue = DocBookBuildUtilities . setTopicXMLForError ( buildData , translatedTopic , getErrorInvalidValidationTopicTemplate ( ) . getValue ( ) ) ; } } return retValue ; }
Merges the Additional Translated XML of a Translated Topic into the original Topic XML content .