Element createTopicMeta ( final Element topic ) { final Document doc = rootTopicref . getOwnerDocument ( ) ; final Element topicmeta = doc . createElement ( MAP_TOPICMETA . localName ) ; topicmeta . setAttribute ( ATTRIBUTE_NAME_CLASS , MAP_TOPICMETA . toString ( ) ) ; // iterate the node. if ( topic != null ) { final Element title = getElementNode ( topic , TOPIC_TITLE ) ; final Element titlealts = getElementNode ( topic , TOPIC_TITLEALTS ) ; final Element navtitle = titlealts != null ? getElementNode ( titlealts , TOPIC_NAVTITLE ) : null ; final Element shortDesc = getElementNode ( topic , TOPIC_SHORTDESC ) ; final Element navtitleNode = doc . createElement ( TOPIC_NAVTITLE . localName ) ; navtitleNode . setAttribute ( ATTRIBUTE_NAME_CLASS , TOPIC_NAVTITLE . toString ( ) ) ; // append navtitle node if ( navtitle != null ) { final String text = getText ( navtitle ) ; final Text titleText = doc . createTextNode ( text ) ; navtitleNode . appendChild ( titleText ) ; topicmeta . appendChild ( navtitleNode ) ; } else { final String text = getText ( title ) ; final Text titleText = doc . createTextNode ( text ) ; navtitleNode . appendChild ( titleText ) ; topicmeta . appendChild ( navtitleNode ) ; } // append gentext pi final Node pi = doc . createProcessingInstruction ( "ditaot" , "gentext" ) ; topicmeta . appendChild ( pi ) ; // append linktext final Element linkTextNode = doc . createElement ( TOPIC_LINKTEXT . localName ) ; linkTextNode . setAttribute ( ATTRIBUTE_NAME_CLASS , MAP_LINKTEXT . toString ( ) ) ; final String text = getText ( title ) ; final Text textNode = doc . createTextNode ( text ) ; linkTextNode . appendChild ( textNode ) ; topicmeta . appendChild ( linkTextNode ) ; // append genshortdesc pi final Node pii = doc . createProcessingInstruction ( "ditaot" , "genshortdesc" ) ; topicmeta . appendChild ( pii ) ; // append shortdesc final Element shortDescNode = doc . createElement ( TOPIC_SHORTDESC . localName ) ; shortDescNode . setAttribute ( ATTRIBUTE_NAME_CLASS , MAP_SHORTDESC . toString ( ) ) ; final String shortDescText = getText ( shortDesc ) ; final Text shortDescTextNode = doc . createTextNode ( shortDescText ) ; shortDescNode . appendChild ( shortDescTextNode ) ; topicmeta . appendChild ( shortDescNode ) ; } return topicmeta ; }
Create topicmeta node .