upnpavcontroller/upnpxmlparser/src/upnpxmlparserlite.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 0 7f85d04be362
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    19 
    19 
    20 
    20 
    21 
    21 
    22 
    22 
    23 // INCLUDE FILES
    23 // INCLUDE FILES
    24 // xml parser
    24 // system / xml parser
    25 #include <xml/parser.h>
    25 #include <xml/parser.h>
    26 #include <xml/parserfeature.h>
    26 #include <xml/parserfeature.h>
    27 #include <xml/matchdata.h>
    27 #include <xml/matchdata.h>
    28 
    28 
    29 // upnp stack api
    29 // upnp stack api
    30 #include <upnpstring.h>
    30 #include <upnpstring.h>
    31 
    31 
    32 // upnpframework / xmlparser api
    32 // dlnasrv / xmlparser api
    33 #include "upnpxmlparserlite.h"
    33 #include "upnpxmlparserlite.h"
    34 #include "upnpobjectlite.h"
    34 #include "upnpobjectlite.h"
    35 
    35 
    36 // xmlparser internal
    36 // dlnasrv / xmlparser internal
    37 #include "upnpobjectstacklite.h"
    37 #include "upnpobjectstacklite.h"
    38 
    38 
    39 
    39 
    40 _LIT( KComponentLogfile, "upnpxmlparser.txt");
    40 _LIT( KComponentLogfile, "upnpxmlparser.txt");
    41 #include "upnplog.h"
    41 #include "upnplog.h"
   184 // --------------------------------------------------------------------------
   184 // --------------------------------------------------------------------------
   185 void CUPnPXMLParserLite::OnStartElementL( const RTagInfo& aElement, 
   185 void CUPnPXMLParserLite::OnStartElementL( const RTagInfo& aElement, 
   186                                       const RAttributeArray& aAttributes,
   186                                       const RAttributeArray& aAttributes,
   187                                       TInt aErrorCode )
   187                                       TInt aErrorCode )
   188     {
   188     {
   189     __LOG1( "CUPnPXMLParserLite::OnStartElementL, error code: %d", aErrorCode );
   189     __LOG1( "CUPnPXMLParserLite::OnStartElementL, error code: %d",
       
   190             aErrorCode );
   190     if ( aErrorCode != KErrNone )
   191     if ( aErrorCode != KErrNone )
   191         {
   192         {
   192         return;
   193         return;
   193         }
   194         }
   194     const TDesC8& desName = aElement.LocalName().DesC();
   195     const TDesC8& desName = aElement.LocalName().DesC();
   287                 {
   288                 {
   288                 HBufC* tempBuf = UpnpString::ToUnicodeL( *iTitleBuf );
   289                 HBufC* tempBuf = UpnpString::ToUnicodeL( *iTitleBuf );
   289                 CleanupStack::PushL( tempBuf );
   290                 CleanupStack::PushL( tempBuf );
   290                 HBufC* buf = HBufC::NewL( iFormatString->Length() +
   291                 HBufC* buf = HBufC::NewL( iFormatString->Length() +
   291                     tempBuf->Length() );
   292                     tempBuf->Length() );
       
   293                 CleanupStack::PushL( buf );
   292                 buf->Des().Format( *iFormatString, tempBuf );
   294                 buf->Des().Format( *iFormatString, tempBuf );
   293                 CleanupStack::PopAndDestroy( tempBuf );
       
   294                 obj->SetTitleL( buf );
   295                 obj->SetTitleL( buf );
       
   296                 CleanupStack::Pop( buf );
       
   297                 CleanupStack::PopAndDestroy( tempBuf );	
   295                 }
   298                 }
   296             else
   299             else
   297                 {
   300                 {
   298                 HBufC* buf = HBufC::NewL( iTitleBuf->Length() );
   301                 HBufC* buf = HBufC::NewL( iTitleBuf->Length() );
       
   302                 CleanupStack::PushL( buf );
   299                 buf->Des().Copy( *iTitleBuf );
   303                 buf->Des().Copy( *iTitleBuf );
   300                 obj->SetTitleL( buf );
   304                 obj->SetTitleL( buf );
       
   305                 CleanupStack::Pop( buf );
   301                 }
   306                 }
   302             delete iTitleBuf; iTitleBuf = NULL;
   307             delete iTitleBuf; iTitleBuf = NULL;
   303             }
   308             }
   304                
   309                
   305         iResultRoot->AppendL( iStack->Top() );
   310         iResultRoot->AppendL( iStack->Top() );