pelican/utility/src/Config.cpp
/**
 * @details
 * Pre-processes the given XML document, expanding any <import> tags.
 * The contents of the destination are deep-copied into the current document.
 *
 * This pre-processor will add comments starting with '%' to record where
 * nodes have been imported. On import, nodes are appended to the end of the
 * current list of child nodes, so that local settings can override them.
 *
 * Valid use cases are:
 * - @verbatim <import nodeset=" [nodeset name] " /> @endverbatim
 * - @verbatim <import file=" [file name] " /> @endverbatim
 *
 * The following are reserved for future use:
 * - @verbatim <import url=" [address] " /> @endverbatim
 *
 * @param[in] document A reference to the document to process.
 */
@details
Pre-processes the given XML document, expanding any  tags.
The contents of the destination are deep-copied into the current document.

This pre-processor will add comments starting with '%' to record where
nodes have been imported. On import, nodes are appended to the end of the
current list of child nodes, so that local settings can override them.

Valid use cases are:
- @verbatim  @endverbatim
- @verbatim  @endverbatim

The following are reserved for future use:
- @verbatim  @endverbatim

@param[in] document A reference to the document to process.
@details Pre - processes the given XML document expanding any tags . The contents of the destination are deep - copied into the current document . This pre - processor will add comments starting with ' % ' to record where nodes have been imported . On import nodes are appended to the end of the current list of child nodes so that local settings can override them . Valid use cases are : - @verbatim @endverbatim - @verbatim @endverbatim The following are reserved for future use : - @verbatim @endverbatim @param [ in ] document A reference to the document to process .
void Config::preprocess(QDomDocument& document)
{
    for (;;) {
        QDomNodeList importNodes = document.elementsByTagName("import");
        if (importNodes.size() == 0) break;
        for (int i = 0; i < importNodes.size(); ++i) {
            QDomElement tag = importNodes.at(i).toElement();
            QDomNode parent = tag.parentNode();
            importNodeset(document, parent, tag.attribute("nodeset"));
            importFile(document, parent, tag.attribute("file"));
            importUrl(document, parent, tag.attribute("url"));
        }
        int nNodes = importNodes.size();
        for (int i = 0; i < nNodes; ++i) {
            QDomNode parent = importNodes.at(0).parentNode();
            parent.removeChild(importNodes.at(0));
        }
    }
}
void Config :: preprocess ( QDomDocument & document ) { for ( ; ; ) { QDomNodeList importNodes = document . elementsByTagName ( " " ) ; if ( importNodes . size ( ) == 0 ) break ; for ( int i = 0 ; i < importNodes . size ( ) ; ++ i ) { QDomElement tag = importNodes . at ( i ) . toElement ( ) ; QDomNode parent = tag . parentNode ( ) ; importNodeset ( document , parent , tag . attribute ( " " ) ) ; importFile ( document , parent , tag . attribute ( " " ) ) ; importUrl ( document , parent , tag . attribute ( " " ) ) ; } int nNodes = importNodes . size ( ) ; for ( int i = 0 ; i < nNodes ; ++ i ) { QDomNode parent = importNodes . at ( 0 ) . parentNode ( ) ; parent . removeChild ( importNodes . at ( 0 ) ) ; } } }
@details
 Pre-processes the given XML document, expanding any <import> tags.
@details Pre - processes the given XML document expanding any <import > tags .
// Get the list of import nodes. // Get the import tag. // Perform import as required. // Remove the import nodes.