Back to index

lightning-sunbird  0.9+nobinonly
Functions
DocumentFunctionCall.cpp File Reference
#include "txAtoms.h"
#include "txIXPathContext.h"
#include "XSLTFunctions.h"
#include "txExecutionState.h"
#include "txURIUtils.h"

Go to the source code of this file.

Functions

static void retrieveNode (txExecutionState *aExecutionState, const nsAString &aUri, const nsAString &aBaseUri, txNodeSet *aNodeSet)

Function Documentation

static void retrieveNode ( txExecutionState aExecutionState,
const nsAString &  aUri,
const nsAString &  aBaseUri,
txNodeSet aNodeSet 
) [static]

Definition at line 59 of file DocumentFunctionCall.cpp.

{
    nsAutoString absUrl;
    URIUtils::resolveHref(aUri, aBaseUri, absUrl);

    PRInt32 hash = absUrl.RFindChar(PRUnichar('#'));
    PRUint32 urlEnd, fragStart, fragEnd;
    if (hash == kNotFound) {
        urlEnd = absUrl.Length();
        fragStart = 0;
        fragEnd = 0;
    }
    else {
        urlEnd = hash;
        fragStart = hash + 1;
        fragEnd = absUrl.Length();
    }

    nsDependentSubstring docUrl(absUrl, 0, urlEnd);
    nsDependentSubstring frag(absUrl, fragStart, fragEnd);

    const txXPathNode* loadNode = aExecutionState->retrieveDocument(docUrl);
    if (loadNode) {
        if (frag.IsEmpty()) {
            aNodeSet->add(*loadNode);
        }
        else {
            txXPathTreeWalker walker(*loadNode);
            if (walker.moveToElementById(frag)) {
                aNodeSet->add(walker.getCurrentPosition());
            }
        }
    }
}

Here is the call graph for this function: