Esempio n. 1
0
void SelectorMatcher::startElement(const XMLElementDecl& elemDecl,
                                   const unsigned int urlId,
                                   const XMLCh* const elemPrefix,
                                   const RefVectorOf<XMLAttr>& attrList,
                                   const unsigned int attrCount) {

    XPathMatcher::startElement(elemDecl, urlId, elemPrefix, attrList, attrCount);
    fElementDepth++;

    // activate the fields, if selector is matched
    int matched = isMatched();
    if ((fMatchedDepth == -1 && ((matched & XP_MATCHED) == XP_MATCHED))
            || ((matched & XP_MATCHED_D) == XP_MATCHED_D)) {

        IdentityConstraint* ic = fSelector->getIdentityConstraint();
        int count = ic->getFieldCount();

        fMatchedDepth = fElementDepth;
        fFieldActivator->startValueScopeFor(ic, fInitialDepth);

        for (int i = 0; i < count; i++) {

            XPathMatcher* matcher = fFieldActivator->activateField(ic->getFieldAt(i), fInitialDepth);
            matcher->startElement(elemDecl, urlId, elemPrefix, attrList, attrCount);
        }
    }
}
void SelectorMatcher::startElement(const XMLElementDecl& elemDecl,
                                   const unsigned int urlId,
                                   const XMLCh* const elemPrefix,
                                   const RefVectorOf<XMLAttr>& attrList,
                                   const XMLSize_t attrCount,
                                   ValidationContext* validationContext /*=0*/) 
{

    XPathMatcher::startElement(elemDecl, urlId, elemPrefix, attrList, attrCount, validationContext);
    fElementDepth++;

    for(XMLSize_t k = 0;k<fLocationPathSize;k++)
    {
        // use the match flag of each member of the union
        unsigned char matched = 0;
        if (((fMatched[k] & XP_MATCHED) == XP_MATCHED)
            && ((fMatched[k] & XP_MATCHED_DP) != XP_MATCHED_DP))
            matched = fMatched[k];
        if ((fMatchedDepth[k] == -1 && ((matched & XP_MATCHED) == XP_MATCHED))
            || ((matched & XP_MATCHED_D) == XP_MATCHED_D)) {

            IdentityConstraint* ic = fSelector->getIdentityConstraint();
            XMLSize_t count = ic->getFieldCount();

            fMatchedDepth[k] = fElementDepth;
            fFieldActivator->startValueScopeFor(ic, fInitialDepth);

            for (XMLSize_t i = 0; i < count; i++) {

                XPathMatcher* matcher = fFieldActivator->activateField(ic->getFieldAt(i), fInitialDepth);
                matcher->startElement(elemDecl, urlId, elemPrefix, attrList, attrCount, validationContext);
            }
            break;
        }
    }
}