public static List < String > checkTopicRootElement ( final ServerSettingsWrapper serverSettings , final BaseTopicWrapper < ? > topic , final Document doc ) { final List < String > xmlErrors = new ArrayList < String > ( ) ; final ServerEntitiesWrapper serverEntities = serverSettings . getEntities ( ) ; if ( isTopicANormalTopic ( topic , serverSettings ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( DocBookUtilities . TOPIC_ROOT_NODE_NAME ) ) { xmlErrors . add ( "Topics must be a <" + DocBookUtilities . TOPIC_ROOT_NODE_NAME + ">." ) ; } } else { if ( topic . hasTag ( serverEntities . getRevisionHistoryTagId ( ) ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "appendix" ) ) { xmlErrors . add ( "Revision History topics must be an <appendix>." ) ; } // Check to make sure that a revhistory entry exists final NodeList revHistoryList = doc . getElementsByTagName ( "revhistory" ) ; if ( revHistoryList . getLength ( ) == 0 ) { xmlErrors . add ( "No <revhistory> element found. A <revhistory> must exist for Revision Histories." ) ; } } else if ( topic . hasTag ( serverEntities . getLegalNoticeTagId ( ) ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "legalnotice" ) ) { xmlErrors . add ( "Legal Notice topics must be a <legalnotice>." ) ; } } else if ( topic . hasTag ( serverEntities . getAuthorGroupTagId ( ) ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "authorgroup" ) ) { xmlErrors . add ( "Author Group topics must be an <authorgroup>." ) ; } } else if ( topic . hasTag ( serverEntities . getAbstractTagId ( ) ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "abstract" ) ) { xmlErrors . add ( "Abstract topics must be an <abstract>." ) ; } } else if ( topic . hasTag ( serverEntities . getInfoTagId ( ) ) ) { if ( DocBookVersion . DOCBOOK_50 . getId ( ) . equals ( topic . getXmlFormat ( ) ) ) { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "info" ) ) { xmlErrors . add ( "Info topics must be an <info>." ) ; } } else { if ( ! doc . getDocumentElement ( ) . getNodeName ( ) . equals ( "sectioninfo" ) ) { xmlErrors . add ( "Info topics must be a <sectioninfo>." ) ; } } } } return xmlErrors ; }
Checks that the topics root element matches the topic type .