/**
This method is a callback to indicate the end of the element has been reached.
@param				aElement is a handle to the element's details.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
{
	_LIT8(KOnEndElementFuncName,"OnEndElement()\r\n");
	_LIT8(KInfoOnEndElePU,"\tElement end namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	TBuf8<KShortInfoSize> info3;
	TBuf8<KShortInfoSize> info4;
	
	iLog.Write(KOnEndElementFuncName);
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnEndElePU,&info3,&info4,&info2);	
		iLog.Write(info);
	}
	else
	{
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
void CTFXConfigParser::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
    {
    if (!aElement.LocalName().DesC().CompareF(KManifestTag))
        {
        iFileType = EConfigFileUndefined;
        iManifestParsed = ETrue;
        return;
        }
    else if (!aElement.LocalName().DesC().CompareF(KSelTag))
        {
        iFileType = EConfigFileUndefined;
        return;
        }

    if (iFileType == EConfigFileManifest)
        {
        OnMfEndElementL(aElement, aErrorCode);
        iExtensionParsed = ETrue;
        return;
        }
    else if (iFileType == EConfigFileSel)
        {
        OnSelEndElementL(aElement, aErrorCode);
        return;
        }
    }
void CContainerParser::ParseEndElementL(const RTagInfo& aElement)
		{
		if(KContainerTag().CompareF(aElement.LocalName().DesC()) == 0)
			{
			// Validate any container that is not the root container
			if(iCurrentContainer.ParentContainer())
				{
				// Containers must have a name and unique Id specified
				if(iName && iUniqueId)
					{
					iCurrentContainer.SetNameL(*iName);
					iCurrentContainer.SetUniqueIdL(*iUniqueId);
					LogL(_L("  End element </container>"));	
					}
				else
					{
					LogL(_L("ERROR: </container> tag not expected yet, name and uniqueid must be specified first"));	
					User::Leave(KErrCorrupt);
					}
				}
			}
		else
			{
			LogL(_L("ERROR: Unexpected tag <%S>, expected </container> tag "), aElement.LocalName().DesC());	
			// We expect <\container> to be the closing tag
			User::Leave(KErrCorrupt);	
			}
		}
void CContextparser::ParseEndElementL(const RTagInfo& aElement)
	{
	TPtrC8 tag(aElement.LocalName().DesC());
	// Check the end tag is </context>. The version and uid flags should be false.
	if(KContexttag().CompareF(tag)==0 && !iVersionparsed && !iUidParsed)
		{
		iContextParsed=EFalse;
		iSiblingsCount--;		
		}
	else if(KVersion().CompareF(tag)==0 && iVersionparsed)
		{
		iVersionparsed=EFalse;
		iSiblingsCount--;		
		}
	else if(KUid().CompareF(tag)==0 && iUidParsed)
		{
		iUidParsed=EFalse;
		iSiblingsCount--;		
		}
	else
		{
		LogL(_L("  End Element <%S> not expected"), aElement.LocalName().DesC());
		User::Leave(KErrCorrupt);		
		}
	}
void TCapsContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aError)
	{
	TSimpleContentHandler::OnStartElementL(aElement, aAttributes, aError);

	// Test file should contain the following:
	//		<PREFIX:NAME xlmns:PREFIX="HTTP://UPPERCASE.COM" 
	//		xlmns:ATTPREFIX="HTTP://STILLUPPERCASE.COM" ATTPREFIX:ATTNAME="VALUE"/>

	// Expat should deliver it to us as:
	//		prefix, name, "HTTP://UPPERCASE.COM"
	//		attprefix, attname, "HTTP://STILLUPPERCASE.COM", "VALUE"

	_LIT8(KPrefix, "prefix");
	_LIT8(KName, "name");
	_LIT8(KUri, "HTTP://UPPERCASE.COM");
	_LIT8(KAttprefix, "attprefix");
	_LIT8(KAttname, "attname");
	_LIT8(KAtturi, "HTTP://STILLUPPERCASE.COM");
	_LIT8(KValue, "VALUE");

	test(aElement.Prefix().DesC() == KPrefix);
	test(aElement.LocalName().DesC() == KName);
	test(aElement.Uri().DesC() == KUri);

	test(aAttributes.Count() == 1);
	const RAttribute& attribute = aAttributes[0];
	const RTagInfo& nameInfo = attribute.Attribute();

	test(nameInfo.Prefix().DesC() == KAttprefix);
	test(nameInfo.LocalName().DesC() == KAttname);
	test(nameInfo.Uri().DesC() == KAtturi);
	test(attribute.Value().DesC() == KValue);
	}
void TRebuildingContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode)
	{
	User::LeaveIfError(aErrorCode);

	const TDesC8& localPart8 = aElement.LocalName().DesC();
	const TDesC8& prefix8 = aElement.Prefix().DesC();

	if(prefix8.Length())
		{
		iOutFile.Write(_L8("<"));
		iOutFile.Write(prefix8);
		iOutFile.Write(_L8(":"));
		iOutFile.Write(localPart8);
		}
	else
		{
		iOutFile.Write(_L8("<"));
		iOutFile.Write(localPart8);
		}	

	TInt nAttributes = aAttributes.Count();
	for(TInt i=0; i<nAttributes; i++)
		{
		const RAttribute& attribute = aAttributes[i];
		const RTagInfo& nameInfo = attribute.Attribute();

		const TDesC8& localPart8 = nameInfo.LocalName().DesC();
		const TDesC8& prefix8 = nameInfo.Prefix().DesC();
		const TDesC8& value8 = attribute.Value().DesC();

		if(prefix8.Length())
			{
			iOutFile.Write(_L8(" "));
			iOutFile.Write(prefix8);
			iOutFile.Write(_L8(":"));
			iOutFile.Write(localPart8);
			}
		else
			{
			iOutFile.Write(_L8(" "));
			iOutFile.Write(localPart8);
			}	

		iOutFile.Write(_L8("=\""));
		iOutFile.Write(value8);
		iOutFile.Write(_L8("\""));
		}
	
	if ( IsForbiddenTagL ( localPart8 ) )
		{
		iOutFile.Write(_L8(" /"));	
		}
		
	iOutFile.Write(_L8(">"));
	}
/**
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);
	}
}
void CTFXConfigParser::OnMfEndElementL(const RTagInfo& aElement, TInt /*aErrorCode*/)
    {
    if (!aElement.LocalName().DesC().CompareF(KEffectDefinitionsTag))
        {
        }
    else if (!aElement.LocalName().DesC().CompareF(KEffectTag))
        {
        iFsEffectArray->Append(iCurrentEffect);
        iCurrentEffect = NULL;
        }
    }
EXPORT_C void CSenSoapMessage2::ParseHeaderL( const RTagInfo& aElement,
                                              const RAttributeArray& aAttributes)
    {
    TLSLOG_L(KSenMessagesLogChannel, KMinLogLevel, "CSenSoapMessage2::ParseHeaderL");
    const TPtrC8 saxLocalName   = aElement.LocalName().DesC();
    const TPtrC8 saxNsUri       = aElement.Uri().DesC();
    const TPtrC8 saxPrefix      = aElement.Prefix().DesC();
    
    TXmlEngElement element = AsElementL();
    RSenDocument document = AsDocumentL();
    
    CSenWsSecurityHeader2* pTemp = NewSecurityHeaderLC(NULL, document, element);

    if ((pTemp->XmlNs() == saxNsUri) && (KSecurityName() == saxLocalName))
        {
        // Remove existing <Security> header
        TXmlEngElement header = HeaderL();
        RXmlEngNodeList<TXmlEngElement> list;
        CleanupClosePushL(list);
        header.GetElementsByTagNameL(list, KSecurityName, pTemp->XmlNs());
        while ( list.HasNext() )
            {
            TXmlEngElement element = list.Next();
            element.Remove();
            }
            
        CleanupStack::PopAndDestroy(&list);

        if ( ipSecurityHeader )
            {
            delete ipSecurityHeader;
            ipSecurityHeader = NULL;
            }
            
        ipSecurityHeader = pTemp;
        CleanupStack::Pop(); // pTemp
        
        TXmlEngElement wsSecurityHeader = ipSecurityHeader->AsElementL();
        wsSecurityHeader.MoveTo(header);
        OnDelegateParsingL(*ipSecurityHeader);        
        }
    else
        {
        TXmlEngElement rootElement = pTemp->AsElementL();
        rootElement.Remove();
        CleanupStack::PopAndDestroy(); // pTemp
        CSenSoapEnvelope2::ParseHeaderL(aElement, aAttributes);
        }
    }
Beispiel #10
0
EXPORT_C RAttribute RAttribute::Copy()
/**
Copy method. The original and copy must be closed seperately.

*/
	{
	RAttribute copy;
	RTagInfo tagCopy = iAttribute.Copy();
	copy.Open(const_cast <RString&> (tagCopy.Uri()),
			  const_cast <RString&> (tagCopy.Prefix()),
			  const_cast <RString&> (tagCopy.LocalName()),
			  iValue.Copy(),
			  iType);
	return copy;
	}
Beispiel #11
0
// -----------------------------------------------------------------------------
// CRoapParser::OnStartElementL
// -----------------------------------------------------------------------------
//
void CRoapParser::OnStartElementL(
    const RTagInfo& aElement,
    const RAttributeArray& aAttributes,
    TInt /*aErrorCode*/)
    {
    TInt i;
    TInt state;

    if (iContent)
        {
        delete iContent;
        iContent = NULL;
        iContent = HBufC8::NewL(0);
        }

    for (i = 0; i < KRoapElementCount; i++)
        {
        if (aElement.LocalName() == iRoapElements[i])
            {
            iElementStack[iElementStackDepth] =
                static_cast<TRoapElementEnum>(i);
            iElementStackDepth++;
            state = MatchStackState();
            iResponseParser->OnStartElementL(*this, state, aElement,
                aAttributes);
            if (iElementStackDepth == KMaxElementNesting)
                {
                User::Leave(EXmlUnexpectedState);
                }
            }
        }
    }
void CContextparser::ParseStartElementL(const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/)
	{
	TPtrC8 tag(aElement.LocalName().DesC());
	if(KContexttag().CompareF(tag) == 0)
		{
		//Parse the context
		iContextParsed=ETrue;
		iSiblingsCount++;
		}
	else if(KVersion().CompareF(tag)==0 && iContextParsed)
		{
		//Parse the version 
		iVersionparsed=ETrue;
		iSiblingsCount++;
		}
	else if(KUid().CompareF(tag)==0 && iContextParsed)
		{
		//Parse the Uid
		iUidParsed=ETrue;
		iSiblingsCount++;
		}
	else
		{
		LogL(_L("ERROR: Unexpected Start Element <%S>"), tag);
		
		// unexpected start tag
		User::Leave(KErrCorrupt);	
		}
	}
	void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
		{
		User::LeaveIfError(aErrorCode);

		const TDesC8& localPart8 = aElement.LocalName().DesC();
		const TDesC8& prefix8 = aElement.Prefix().DesC();

		iOut.Append(_L8("</"));

		if(prefix8.Length())
			{
			iOut.Append(prefix8);
			iOut.Append(_L8(":"));
			}
		iOut.Append(localPart8);
		iOut.Append(_L8(">"));
		};
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;
        }
    }
void CRightsParser::ParseEndElementL(const RTagInfo& aElement)
	{
	// Check the end tag is </rights> and that we now have a rights element we can add
	if(KRightsTag().CompareF(aElement.LocalName().DesC()) != 0 || !iRights)
		{
		#ifdef _DEBUG
		LogL(_L("  End Element <%S> not expected"), aElement.LocalName().DesC());
		#endif

		User::Leave(KErrCorrupt);
		}
	
	#ifdef _DEBUG
	LogL(_L("  End Element </rights>"));
	#endif

	// Validate and add rights object to iDrmRights
	iDrmRights.AddL(iRights);
	iRights = NULL;
	}
// ---------------------------------------------------------------------------------
// CUpnpTmServerDeviceXmlParser::OnEndElementL
// Called when parser hits the closing tag
// ---------------------------------------------------------------------------------
//
void CUpnpTmServerDeviceXmlParser::OnEndElementL( const RTagInfo& aElement, TInt aErrorCode )
	{
	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDELEMENTL_ENTRY );
	User::LeaveIfError(aErrorCode);
	
	iDeviceDescription.Append( UpnpCD::KKorp );
	iDeviceDescription.Append( UpnpString::KSlash );
	iDeviceDescription.Append( aElement.LocalName().DesC() );
	iDeviceDescription.Append( UpnpCD::KProk );
	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONENDELEMENTL_EXIT );
	}
void TNamespaceContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aError)
	{
	TSimpleContentHandler::OnStartElementL(aElement, aAttributes, aError);

	if(iState==KNothingMapped)
		test(aElement.Prefix().DesC().Length()==0 && aElement.Uri().DesC().Length()==0);
	else
		 if(aElement.Prefix().DesC().Length()==0)
			test(aElement.Uri().DesC()==iDefaultUri);
		else
			test(aElement.Prefix().DesC()==iElementPrefix && aElement.Uri().DesC()==iElementUri);

	if(aAttributes.Count())
		{
		const RTagInfo& attribute = aAttributes[0].Attribute();

		if(attribute.Prefix().DesC().Length()==0)
			test(attribute.Uri().DesC().Length()==0);
		else
			{
			test(iState!=KNothingMapped);
			test(attribute.Prefix().DesC()==iAttributePrefix && attribute.Uri().DesC()==iAttributeUri);
			}
		}
	}
// -----------------------------------------------------------------------------
// CUpnpServiceStateTableContentHandler::OnEndElementL
// This method is a callback to indicate the end of the element has been reached.
// -----------------------------------------------------------------------------
//
void CUpnpServiceStateTableContentHandler::OnEndElementL(
    const RTagInfo& aElement )
    {
    ASSERT( aElement.LocalName().DesC().Compare(KUpnpServiceStateTable) == 0 );
    //if ( iStateVariableFound )
        //{
        iController.SetPreviousContentHandler();
        //}
    //else
        //{
        //User::Leave( KErrArgument ) //required but not checked now 
        //}
    }
void CSenXmlReader::OnEndElementL(const RTagInfo& aElement, TInt /* aErrorCode */)
    {
    if(!iContentHandler)
        {
        SENDEBUG_L("OnEndElementL: KErrSenXmlContentHandlerNotSet");
        User::Leave(KErrSenXmlContentHandlerNotSet);
        }


    const TPtrC8 localName = aElement.LocalName().DesC();
    const TPtrC8 nsUri = aElement.Uri().DesC();
    const TPtrC8 prefix = aElement.Prefix().DesC();

    TPtrC8 qualifiedName = localName;

    if (prefix != KNullDesC8)
        {
        HBufC8* pQName = HBufC8::NewLC(prefix.Length()+localName.Length()+
                                        KSenColon().Length());
        TPtr8 qName = pQName->Des();
        qName.Append(prefix);
        qName.Append(KSenColon);
        qName.Append(localName);
        qualifiedName.Set(qName);
        }


    iContentHandler->EndElement(nsUri,
                                localName,
                                qualifiedName);

    if (prefix != KNullDesC8)
        {
        CleanupStack::PopAndDestroy(); // pQName
        }

    }
void CContentParser::ParseEndElementL(const RTagInfo& aElement)
	{
	TInt err = KErrNone;
	TBuf <KMaxDataTypeLength> mimeType;
	if(KContentTag().CompareF(aElement.LocalName().DesC()) == 0)
		{
		// Validate and add to iCurrentContainer
		// iCurrentContainer has ownership of the content
		if(iCid && iName && iUniqueId && iFileName)
			{
			LogL(_L("  End Element </content>"));
			
			err = iStringAttributeSet.GetValue(EMimeType, mimeType);
			if(err != KErrNone || mimeType.Length() == 0)
				{
				LogL(_L("ERROR: A string attribute \"mimetype\" not specified for content with cid: %S"), *iCid);
				User::Leave(KErrCorrupt);
				}
			else
				{
				iCurrentContainer.AddContentL(*iCid, *iName, *iUniqueId, *iFileName, iAttributeSet, iStringAttributeSet);
				}
			}
		else
			{
			LogL(_L("ERROR: </content> tag not expected yet, name, uniqueid, filename and the mimetype stringattribute must all be specified first"));
			User::Leave(KErrCorrupt);	
			}
		}
	else
		{
		LogL(_L("ERROR: Unexpected end element </%S>, expected </content>"),aElement.LocalName().DesC());
		// We were expecting the <\content> tag
		User::Leave(KErrCorrupt);	
		}
	}
void CDrmFilesParser::ParseEndElementL(const RTagInfo& aElement)
	{
	TPtrC8 tag(aElement.LocalName().DesC());	
	
	// Check the end tag is </drmfiles>
	if(KDrmFileTag().CompareF(tag) != 0)
		{
		LogL(_L("ERROR: Unexpected End element <%S>, expected </drmfiles>"), tag);
		User::Leave(KErrCorrupt);
		}

	LogL(_L("  End element </drmfiles>"));
	iParseComplete = ETrue;
	iDrmFiles->UpdateContentL();
	}
void TRebuildingContentHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
	{
	User::LeaveIfError(aErrorCode);


	const TDesC8& localPart8 = aElement.LocalName().DesC();
	const TDesC8& prefix8 = aElement.Prefix().DesC();
	
	if ( IsForbiddenTagL ( localPart8 ) )
		{
		return; // The end tag has been already inserted for forbidden tags
		}


	iOutFile.Write(_L8("</"));

	if(prefix8.Length())
		{
		iOutFile.Write(prefix8);
		iOutFile.Write(_L8(":"));
		}
	iOutFile.Write(localPart8);
	iOutFile.Write(_L8(">"));
	}
// -----------------------------------------------------------------------------
// CUpnpContentHandlersController::OnStartElementL
// This method is a callback to indicate an element has been parsed.
// -----------------------------------------------------------------------------
//
void CUpnpContentHandlersController::OnStartElementL(
    const RTagInfo& aElement, const RAttributeArray& aAttributes,
    TInt aErrorCode )
    {
    User::LeaveIfError( aErrorCode );
    ChunksMergingEndL();
    if ( iCurrentContentHandler->InterestedInAllNamespaces()
            || aElement.Uri().DesC().Compare( iCorrectUri ) == 0 )
        {
        iCurrentContentHandler->OnStartElementL( aElement, aAttributes );
        }
    else
        {
        SetCurrentContentHandlerL( CUpnpIgnoreContentHandler::NewL( *this ) );
        }
    }
void TNamespaceContentHandler::OnEndElementL(const RTagInfo& aElement, TInt aError)
	{
	TSimpleContentHandler::OnEndElementL(aElement, aError);

	if(iState==KNothingMapped)
		test(aElement.Prefix().DesC().Length()==0 && aElement.Uri().DesC().Length()==0);
	else
		if(aElement.Prefix().DesC().Length()==0)
			test(aElement.Uri().DesC()==iDefaultUri);
		else
			test(aElement.Prefix().DesC()==iElementPrefix && aElement.Uri().DesC()==iElementUri);
	}
// -----------------------------------------------------------------------------
// CUpnpArgumentListContentHandler::OnStartElementL
// This method is a callback to indicate an element has been parsed.
// -----------------------------------------------------------------------------
//
void CUpnpArgumentListContentHandler::OnStartElementL(
    const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/ )
    {
    TPtrC8 elementName(aElement.LocalName().DesC() );
    if ( elementName.Compare( KUpnpArgument ) == 0 )
        {
        CUpnpArgument* argument = CUpnpArgument::NewL( iResultService );
        CleanupStack::PushL( argument );
        iResultAction.AddArgumentL( *argument );
        CleanupStack::Pop( argument );
        iController.SetCurrentContentHandlerL( 
            CUpnpArgumentContentHandler::NewL( iController, *argument ) );
        }
    else
        {
        iController.SetCurrentContentHandlerL( 
            CUpnpIgnoreContentHandler::NewL( iController ) );
        }
    }
// -----------------------------------------------------------------------------
// CUpnpServiceStateTableContentHandler::OnStartElementL
// This method is a callback to indicate an element has been parsed.
// -----------------------------------------------------------------------------
//
void CUpnpServiceStateTableContentHandler::OnStartElementL(
    const RTagInfo& aElement, const RAttributeArray& aAttributes )
    {
    if ( aElement.LocalName().DesC().Compare(KUpnpStateVariable) == 0 )
        {
        iStateVariableFound = ETrue;
        CUpnpStateVariable* stateVariable = CUpnpStateVariable::NewL();
        CleanupStack::PushL( stateVariable );
        iResultService.AddStateVariableL( stateVariable );
        CleanupStack::Pop( stateVariable );
        ParseAttributesL( *stateVariable, aAttributes );
        iController.SetCurrentContentHandlerL( 
            CUpnpStateVariableContentHandler::NewL( iController, *stateVariable ) );
        }
    else
        {
        iController.SetCurrentContentHandlerL( 
            CUpnpIgnoreContentHandler::NewL( iController ) );
        }
    }
Beispiel #27
0
// -----------------------------------------------------------------------------
// CRoapParser::OnEndElementL
// -----------------------------------------------------------------------------
//
void CRoapParser::OnEndElementL(
    const RTagInfo& aElement,
    TInt /*aErrorCode*/)
    {
    TInt i;
    TInt state;

    for (i = 0; i < KRoapElementCount; i++)
        {
        if (aElement.LocalName() == iRoapElements[i])
            {
            state = MatchStackState();
            iResponseParser->OnEndElementL(*this, state, aElement);
            iElementStackDepth--;
            if (iElementStackDepth < 0)
                {
                User::Leave(EXmlUnexpectedState);
                }
            }
        }
    }
// ---------------------------------------------------------------------------------
// CUpnpTmServerDeviceXmlParser::OnStartElementL
// Called when parser hits the opening tag
// ---------------------------------------------------------------------------------
//
void CUpnpTmServerDeviceXmlParser::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/, TInt aErrorCode)
	{
	OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTELEMENTL_ENTRY );
	User::LeaveIfError(aErrorCode);

	iDeviceDescription.Append(UpnpCD::KKorp);
	iDeviceDescription.Append(aElement.LocalName().DesC());
	
    if(aElement.LocalName().DesC().Compare(KUpnpDeviceRoot) == 0)
        {
        iDeviceDescription.Append(KRootAttrb());    
        }       
    iDeviceDescription.Append(UpnpCD::KProk);

    if(aElement.LocalName().DesC().Compare(KPhoneManufacturer) == 0)
        {
        iDeviceDescription.Append(iPhoneId.iManufacturer);   
        }
	else if(aElement.LocalName().DesC().Compare(KPhoneModel) == 0)
        {
        iDeviceDescription.Append(iPhoneId.iModel);   
        }
	else if(aElement.LocalName().DesC().Compare(KPhoneSerialNumber) == 0)
        {
        iDeviceDescription.Append(iPhoneId.iSerialNumber);   
        }
    else if(aElement.LocalName().DesC().Compare(KBtAddress) == 0)
        {
        iDeviceDescription.Append(iDeviceInfo.BtAddress());   
        }
    else if(aElement.LocalName().DesC().Compare(KStartConnection) == 0)
        {
        if ( iDeviceInfo.StartConn() )
            {
            iDeviceDescription.Append(KConnTrue);    
            }
        else
            {
            iDeviceDescription.Append(KConnFalse);    
            }       
        }
	OstTraceFunctionExit0( CUPNPTMSERVERDEVICEXMLPARSER_ONSTARTELEMENTL_EXIT );
	}
void CDrmFilesParser::ParseStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes)
	{
	TPtrC8 tag(aElement.LocalName().DesC());
	if(KDrmFileTag().CompareF(tag) == 0)
		{
		if(iFoundStartTag)
			{
			LogL(_L("ERROR: <drmfiles> tag found inside <drmfiles> tag"));
			// We have already found the <DRMFiles> tag, there shouldn't be two of them
			User::Leave(KErrCorrupt);
			}
		iFoundStartTag = ETrue;
		LogL(_L("Start element <drmfiles>"));
		}
	else if(KContainerTag().CompareF(tag) == 0)
		{
		// <container>

		// add a new container to the root container
		CDrmFileContainer& newContainer = iDrmFiles->RootContainer().AddContainerL();
				
		// create a parser for the new container
		StartChildParserL(CContainerParser::NewL(newContainer), aElement, aAttributes);
		}
	else if(KContentTag().CompareF(tag) == 0)
		{
		// <content cid = "...."> 
		// Create a parser for the content object
		StartChildParserL(CContentParser::NewL(iDrmFiles->RootContainer()), aElement, aAttributes);
		}
	else
		{
		LogL(_L("ERROR: Unexpected start element <%S>"), tag);
		// unexpected start tag
		User::Leave(KErrCorrupt);	
		}
	}
Beispiel #30
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);
            }
        }    
    }