void
SysComponentLoader::updateComponentContext(
    RefCountedPtr<SysContext> &ctx,
    const DOMDocument* doc )
{

    std::vector<DOMProcessingInstruction*> pis;
    DomUtils::findProcessingInstructions( doc, TARGET_NAME, pis );

    for ( std::vector<DOMProcessingInstruction*>::const_iterator it = pis.begin();
            it != pis.end(); it++ )
    {
        // check to see if the processing instruction has the
        // following attributes:
        // "component-name" - name of the class to create
        // "component-config" - path of the config tree for the component
        //
        Mapping attrs;
        if ( DomUtils::getAttributes( (*it), attrs ) )
        {
            String cmpName;
            attrs.getIfAvailable(CMP_NAME_ATTR, cmpName);

            RefCountedPtr<iSysComponent> cmp = ctx->getComponent( cmpName );
            if ( cmp != NULL )
            {
                // locate it's configuration and call it to initialize
                String xmlIsland;
                attrs.getIfAvailable(CMP_CFG_ATTR, xmlIsland);

                if ( xmlIsland.length() > 0 )
                {
                    const DOMNode* theNode = (const DOMNode*)doc->getDocumentElement();

                    DOMElement* xmlNode = NULL;
                    DomUtils::selectSingleNode( theNode, xmlIsland, (DOMNode**)&xmlNode );

                    cmp->update( xmlNode );
                }
            }
        }
    }
}