Ejemplo n.º 1
0
// --------------------------------------------------------------------------
// CUPnPXMLParserLite::SetAttributesL
// See upnpxmlparser.h
// --------------------------------------------------------------------------
void CUPnPXMLParserLite::SetAttributesL( CUpnpObjectLite& aObject, 
    const RAttributeArray& aAttributes )
    {
    __LOG( "CUPnPXMLParserLite::SetAttributesL" );
    
    if ( iStack->Count() )
        {
        // Object has a parent.
        // Should not really happen
        __LOG( "Object has a parent!" );
        __PANICD(__FILE__, __LINE__);      
        }
        
    RAttribute attribute;
    TInt count = aAttributes.Count();
    for ( TInt i = 0 ; i < count; i++ ) // Read attributes.
        {
        attribute = aAttributes[ i ];
        const TDesC8& name = attribute.Attribute().LocalName().DesC();
        
        if( !name.CompareF( KId ) )
            {
            aObject.SetObjectIdL( attribute.Value().DesC() );
            }
        }
    __LOG( "CUPnPXMLParserLite::SetAttributesL - End" );
    }
/**
This method is a callback to indicate an element has been parsed.
@param				aElement is a handle to the element's details.
@param				aAttributes contains the attributes for the element.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
								 TInt aErrorCode)
{
	_LIT8(KOnStartElementFuncName,"OnStartElement()\r\n");
	_LIT8(KInfoOnStartElePU,"\tElement start namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnAttributePU,"\t\tAttribute namaspace: %S \t prefix: %S \tname: %S \t value: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	iLog.Write(KOnStartElementFuncName);
	
	if (aErrorCode == KErrNone)
	{
		
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		TBuf8<KShortInfoSize> info3;
		TBuf8<KShortInfoSize> info4;
		TBuf8<KShortInfoSize> info5;

		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnStartElePU,&info3,&info4,&info2);	
		iLog.Write(info);
		
		RArray <RAttribute> array = aAttributes;
		TInt size = array.Count();
		
		RAttribute attr;
		
		if ( size > 0 )
		{
			for ( TInt i = 0; i < size; i++)
			{
				attr = array[i];
				
				info2.Copy(attr.Attribute().LocalName().DesC());
				info3.Copy(attr.Attribute().Uri().DesC());		
				info4.Copy(attr.Attribute().Prefix().DesC());		
				info5.Copy(attr.Value().DesC());		
				
				info.Format(KInfoOnAttributePU,&info3,&info4,&info2,&info5);
				iLog.Write(info);
			}
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
Ejemplo n.º 3
0
// -----------------------------------------------------------------------------
// CRoapParser::GetAttributeValueL
// -----------------------------------------------------------------------------
//
HBufC8* CRoapParser::GetAttributeValueL(
    const RAttributeArray& aAttrList,
    const TDesC8& aAttrName)
    {
    HBufC8* r = NULL;
    RAttribute a;
    TInt i;

    for (i = 0; !r && i < aAttrList.Count(); i++)
        {
        a = aAttrList[i];
        if (a.Attribute().LocalName().DesC().Compare(aAttrName) == 0)
            {
            r = a.Value().DesC().AllocL();
            }
        }
    return r;
    }
Ejemplo n.º 4
0
void CTFXConfigParser::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode)
    {
    if (iFileType == EConfigFileManifest)
        {
        OnMfStartElementL(aElement, aAttributes, aErrorCode);
        return;
        }
    else if (iFileType == EConfigFileSel)
        {
        OnSelStartElementL(aElement, aAttributes, aErrorCode);
        return;
        }


    if (!aElement.LocalName().DesC().CompareF(KManifestTag))
        {
        iFileType = EConfigFileManifest;
        return;
        }
    else if (!aElement.LocalName().DesC().CompareF(KSelTag))
        {
        iFileType = EConfigFileSel;

        // find if there's baseskin attribute
        // if baseskin is found then parsing is stopped and
        // baseskin is parsed and registered first
        TInt attrCount( aAttributes.Count() );
        for( TInt i( 0 ); i < attrCount; i++ )
            {
            RAttribute attribute = aAttributes[i];
            RTagInfo tag = attribute.Attribute();
            if (!tag.LocalName().DesC().CompareF(KBaseSkinTag))
                {
                // base skin can be found once per parser
                if( iBaseSkinSelFile.Length() == 0 )
                    {
                    iBaseSkinSelFile.Copy( attribute.Value().DesC() );
                    User::Leave( KBaseSkinParserLeave );
                    }
                }
            }
        return;
        }
    }
Ejemplo n.º 5
0
void CBLParser::OnStartElementL( const RTagInfo &aElement, const RAttributeArray &aAttributes, TInt aErrorCode )
    {
    (void)aErrorCode;
    TBuf<KMaxFileName> name;
    RAttribute attr;
    TBuf<10> num;
    TLex lex;
    TInt err(KErrNone);
    TUint32 scan(0);    
    
    name.Copy(aElement.LocalName().DesC());
    if(aAttributes.Count())
        {
        attr = aAttributes[0];
        num.Copy(attr.Value().DesC());
        lex.Assign(num);
        
        if(name == KBlacklist)
            {
            err = lex.Val(scan,EHex);
            iObserver.AddToBlacklist(scan);
            }
        }    
    }
Ejemplo n.º 6
0
void CTFXConfigParser::OnSelStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt /*aErrorCode*/)
    {
    if (!aElement.LocalName().DesC().CompareF(KFullSCRTransTag))
        {
        iFsTransitionArray = new (ELeave) RPointerArray<CTFxTransition>;
        iParserState = EStateParsingFs;
        return;
        }
    else if (!aElement.LocalName().DesC().CompareF(KCtrlTransTag))
        {
        iCtrlTransitionArray = new (ELeave) RPointerArray<CTFxCtrlTransition>;
        iParserState = EStateParsingCtrl;
        return;
        }
    else if(!aElement.LocalName().DesC().CompareF(KListTransTag))
        {
        iListTransitionArray = new (ELeave) RPointerArray<CTFxTransition>;
        iParserState = EStateParsingList;
        }

   else if (!aElement.LocalName().DesC().CompareF(KTransitionTag))
        {
        if (iParserState == EStateParsingFs && !iFsTransitionArray)
            {
            User::Leave(KErrCorrupt);
            }
        else if (iParserState == EStateParsingCtrl && !iCtrlTransitionArray)
            {
            User::Leave(KErrCorrupt);
            }
        else if (iParserState == EStateParsingList && !iListTransitionArray)
            {
            User::Leave(KErrCorrupt);
            }
        // list transition has same params as fs transition
        if (iParserState == EStateParsingFs
            || iParserState == EStateParsingList)
            {
            iCurrentTransition = new (ELeave) CTFxTransition;

            for (TInt count = 0; count < aAttributes.Count(); count++)
                {
                RAttribute attribute = aAttributes[count];
                RTagInfo tag = attribute.Attribute();
                if (!tag.LocalName().DesC().CompareF(KContextTag))
                    {
                    iCurrentTransition->SetContextId(attribute.Value().DesC());
                    }
                else if (!tag.LocalName().DesC().CompareF(KEffectTag))
                    {
                    iCurrentTransition->SetEffectNameL(attribute.Value().DesC());
                    }
                else if (!tag.LocalName().DesC().CompareF(KUidTag))
                    {
                    iCurrentTransition->SetUid(attribute.Value().DesC());
                    }
                else if( !tag.LocalName().DesC().CompareF(KTypeTag))
                    {
                    iCurrentTransition->SetType(attribute.Value().DesC());
                    }
                }
            }
        else if (iParserState == EStateParsingCtrl)
            {
            iCurrentCtrlTransition = new (ELeave) CTFxCtrlTransition;
            for (TInt count = 0; count < aAttributes.Count(); count++)
                {
                RAttribute attribute = aAttributes[count];
                RTagInfo tag = attribute.Attribute();
                if (!tag.LocalName().DesC().CompareF(KContextUidTag))
                    {
                    iCurrentCtrlTransition->SetContextUidL(attribute.Value().DesC());
                    }
                else if (!tag.LocalName().DesC().CompareF(KEffectTag))
                    {
                    iCurrentCtrlTransition->SetEffectNameL(attribute.Value().DesC());
                    }
                else if (!tag.LocalName().DesC().CompareF(KActionTag))
                    {
                    iCurrentCtrlTransition->SetActionL(attribute.Value().DesC());
                    }
                else if (!tag.LocalName().DesC().CompareF(KActionStringTag))
                    {
                    iCurrentCtrlTransition->SetActionStringL(attribute.Value().DesC());
                    }
                }
            }
        }
    }
Ejemplo n.º 7
0
void CTFXConfigParser::OnMfStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt /*aErrorCode*/)
    {
    if (!aElement.LocalName().DesC().CompareF(KEffectDefinitionsTag))
        {
        if (!iFsEffectArray)
            {
            iFsEffectArray = new (ELeave) RPointerArray<CTFxEffect>;
            }
        if (!iEffectDefPathArray)
            {
            iEffectDefPathArray = new (ELeave) RPointerArray<HBufC>;
            }
        for (TInt count = 0; count < aAttributes.Count(); count++)
            {
            RAttribute attribute = aAttributes[count];
            RTagInfo tag = attribute.Attribute();
            if (!tag.LocalName().DesC().CompareF(KPathTag))
                {
                HBufC* path;
                path = HBufC::NewL(attribute.Value().DesC().Length()*2);
                path->Des().Copy(attribute.Value().DesC());
                iEffectDefPathArray->Append(path);
                }
            else if (!tag.LocalName().DesC().CompareF(KMaxTransCacheSizeTag))
                {
                SetMaxTransCacheSizeL(attribute.Value().DesC());
                }
            else if (!tag.LocalName().DesC().CompareF(KMaxCacheSizeTag))
                {
                SetMaxCacheSizeL(attribute.Value().DesC());
                }
            }
        return;
        }
    else if (!aElement.LocalName().DesC().CompareF(KEffectTag))
        {
        if (!iFsEffectArray)
            {
            User::Leave(KErrCorrupt);
            }
        iCurrentEffect = new (ELeave) CTFxEffect;
        iCurrentEffect->SetPathIndex(iEffectDefPathArray->Count()-1);
        iCurrentEffect->SetMaxTransCacheSize(iMaxTransCacheSize);
        iCurrentEffect->SetMaxCacheSize(iMaxCacheSize);
        }

    for (TInt count = 0; count < aAttributes.Count(); count++)
        {
        RAttribute attribute = aAttributes[count];
        RTagInfo tag = attribute.Attribute();
        if (!tag.LocalName().DesC().CompareF(KEffectNameTag))
            {
            iCurrentEffect->SetName(attribute.Value().DesC());
            }
        else if (!tag.LocalName().DesC().CompareF(KEffectFileTag))
            {
            iCurrentEffect->SetFilename(attribute.Value().DesC());
            }
        else if (!tag.LocalName().DesC().CompareF(KEffectWantedTimeTag))
            {
            iCurrentEffect->SetWantedTime(attribute.Value().DesC());
            }
        else if (!tag.LocalName().DesC().CompareF(KEffectMinTimeTag))
            {
            iCurrentEffect->SetMinTime(attribute.Value().DesC());
            }
        else if (!tag.LocalName().DesC().CompareF(KEffectCachePriorityTag))
            {
            iCurrentEffect->SetCachePriority(attribute.Value().DesC());
            }
        }
    }