protected void setUpRootElement ( final BuildData buildData , final Level level , final Document doc , Element ele ) { final Element titleNode = doc . createElement ( "title" ) ; if ( buildData . isTranslationBuild ( ) && ! isNullOrEmpty ( level . getTranslatedTitle ( ) ) ) { titleNode . setTextContent ( DocBookUtilities . escapeForXML ( level . getTranslatedTitle ( ) ) ) ; } else { titleNode . setTextContent ( DocBookUtilities . escapeForXML ( level . getTitle ( ) ) ) ; } // Add the info if the container has one final Element infoElement ; if ( level . getInfoTopic ( ) != null ) { final InfoTopic infoTopic = level . getInfoTopic ( ) ; final Node info = doc . importNode ( infoTopic . getXMLDocument ( ) . getDocumentElement ( ) , true ) ; // Generate the info node final String elementInfoName ; if ( buildData . getDocBookVersion ( ) == DocBookVersion . DOCBOOK_50 ) { elementInfoName = "info" ; } else { elementInfoName = ele . getNodeName ( ) + "info" ; } infoElement = doc . createElement ( elementInfoName ) ; // Move the contents of the info to the chapter/level final NodeList infoChildren = info . getChildNodes ( ) ; while ( infoChildren . getLength ( ) > 0 ) { infoElement . appendChild ( infoChildren . item ( 0 ) ) ; } } else { infoElement = null ; } if ( buildData . getDocBookVersion ( ) == DocBookVersion . DOCBOOK_50 ) { ele . appendChild ( titleNode ) ; if ( infoElement != null ) { ele . appendChild ( infoElement ) ; } } else { if ( infoElement != null ) { ele . appendChild ( infoElement ) ; } ele . appendChild ( titleNode ) ; } DocBookBuildUtilities . setDOMElementId ( buildData . getDocBookVersion ( ) , ele , level . getUniqueLinkId ( buildData . isUseFixedUrls ( ) ) ) ; }
Sets up an elements title info and id based on the passed level .