public void processPrerequisiteInjections(final SpecNodeWithRelationships specNode, final Document doc, final Element node,
            final boolean useFixedUrls) {
        // Make sure we have some links to inject
        if (specNode.getPrerequisiteRelationships().isEmpty()) return;

        // Get the title element so that it can be used later to add the prerequisite topic nodes
        Element titleEle = null;
        final NodeList titleList = node.getElementsByTagName("title");
        for (int i = 0; i < titleList.getLength(); i++) {
            if (titleList.item(i).getParentNode().equals(node)) {
                titleEle = (Element) titleList.item(i);
                break;
            }
        }

        if (titleEle != null) {
            // Create the paragraph and list of prerequisites.
            final Element itemisedListEle = doc.createElement("itemizedlist");
            itemisedListEle.setAttribute("role", ROLE_PREREQUISITE_LIST);
            final Element itemisedListTitleEle = doc.createElement("title");

            final String prerequisiteTranslation = translations.getString(PREREQUISITE_PROPERTY);
            itemisedListTitleEle.setTextContent(prerequisiteTranslation == null ? DEFAULT_PREREQUISITE : prerequisiteTranslation);

            itemisedListEle.appendChild(itemisedListTitleEle);
            final List<List<Element>> list = new LinkedList<List<Element>>();

            // Add the Relationships
            for (final Relationship prereq : specNode.getPrerequisiteRelationships()) {
                if (prereq instanceof TopicRelationship) {
                    final SpecTopic relatedTopic = ((TopicRelationship) prereq).getSecondaryRelationship();

                    list.add(DocBookUtilities.buildXRef(doc, relatedTopic.getUniqueLinkId(useFixedUrls),
                            ROLE_PREREQUISITE));
                } else {
                    final SpecNode relatedNode = ((TargetRelationship) prereq).getSecondaryRelationship();

                    list.add(DocBookUtilities.buildXRef(doc, relatedNode.getUniqueLinkId(useFixedUrls),
                            ROLE_PREREQUISITE));
                }
            }

            // Wrap the items into an itemized list
            final List<Element> items = DocBookUtilities.wrapItemsInListItems(doc, list);
            for (final Element ele : items) {
                itemisedListEle.appendChild(ele);
            }

            // Add the paragraph and list after the title node
            Node nextNode = titleEle.getNextSibling();
            while (nextNode != null && nextNode.getNodeType() != Node.ELEMENT_NODE && nextNode.getNodeType() != Node.COMMENT_NODE) {
                nextNode = nextNode.getNextSibling();
            }

            node.insertBefore(itemisedListEle, nextNode);
        }
    }
public void processPrerequisiteInjections ( final SpecNodeWithRelationships specNode , final Document doc , final Element node , final boolean useFixedUrls ) { if ( specNode . getPrerequisiteRelationships ( ) . isEmpty ( ) ) return ; Element titleEle = null ; final NodeList titleList = node . getElementsByTagName ( "title" ) ; for ( int i = 0 ; i < titleList . getLength ( ) ; i ++ ) { if ( titleList . item ( i ) . getParentNode ( ) . equals ( node ) ) { titleEle = ( Element ) titleList . item ( i ) ; break ; } } if ( titleEle != null ) { final Element itemisedListEle = doc . createElement ( "itemizedlist" ) ; itemisedListEle . setAttribute ( "role" , ROLE_PREREQUISITE_LIST ) ; final Element itemisedListTitleEle = doc . createElement ( "title" ) ; final String prerequisiteTranslation = translations . getString ( PREREQUISITE_PROPERTY ) ; itemisedListTitleEle . setTextContent ( prerequisiteTranslation == null ? DEFAULT_PREREQUISITE : prerequisiteTranslation ) ; itemisedListEle . appendChild ( itemisedListTitleEle ) ; final List < List < Element > > list = new LinkedList < List < Element > > ( ) ; for ( final Relationship prereq : specNode . getPrerequisiteRelationships ( ) ) { if ( prereq instanceof TopicRelationship ) { final SpecTopic relatedTopic = ( ( TopicRelationship ) prereq ) . getSecondaryRelationship ( ) ; list . add ( DocBookUtilities . buildXRef ( doc , relatedTopic . getUniqueLinkId ( useFixedUrls ) , ROLE_PREREQUISITE ) ) ; } else { final SpecNode relatedNode = ( ( TargetRelationship ) prereq ) . getSecondaryRelationship ( ) ; list . add ( DocBookUtilities . buildXRef ( doc , relatedNode . getUniqueLinkId ( useFixedUrls ) , ROLE_PREREQUISITE ) ) ; } } final List < Element > items = DocBookUtilities . wrapItemsInListItems ( doc , list ) ; for ( final Element ele : items ) { itemisedListEle . appendChild ( ele ) ; } Node nextNode = titleEle . getNextSibling ( ) ; while ( nextNode != null && nextNode . getNodeType ( ) != Node . ELEMENT_NODE && nextNode . getNodeType ( ) != Node . COMMENT_NODE ) { nextNode = nextNode . getNextSibling ( ) ; } node . insertBefore ( itemisedListEle , nextNode ) ; } }
Insert a itemized list into the start of the topic, below the title with any PREREQUISITE relationships that exists for
the Spec Topic. The title for the list is set to the "PREREQUISITE" property or "Prerequisites:" by default.

@param specNode              The content spec node to process the injection for.
@param doc                   The DOM Document object that represents the topics XML.
@param node                  The DOM Element to append the links to.
@param useFixedUrls          Whether fixed URL's should be used in the injected links.