|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "cactionparser.h" |
|
17 #include <upnpdescriptionschema.h> |
|
18 #include "cargumentparser.h" |
|
19 |
|
20 CActionParser* CActionParser::NewL(CUPnPAction* aAction, const RStringPool& aStringPool) |
|
21 { |
|
22 CActionParser* self = new (ELeave) CActionParser(aAction, aStringPool); |
|
23 return self; |
|
24 } |
|
25 |
|
26 CActionParser::CActionParser(CUPnPAction* aAction, const RStringPool& aStringPool) : iAction(aAction), iStringPool(aStringPool) |
|
27 { |
|
28 } |
|
29 |
|
30 CActionParser::~CActionParser() |
|
31 { |
|
32 } |
|
33 |
|
34 void CActionParser::ParseStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes) |
|
35 { |
|
36 iSiblingsCount++; |
|
37 iString = iStringPool.OpenStringL(aElement.LocalName().DesC()); |
|
38 TInt tblIndex = iString.Index ( UPNPDESCRIPTIONXMLTAGS::Table ); |
|
39 |
|
40 if (tblIndex >= 0) |
|
41 { |
|
42 if ( tblIndex ==UPNPDESCRIPTIONXMLTAGS::EArgument) |
|
43 { |
|
44 iSiblingsCount--; |
|
45 CUPnPArgument* argument = CUPnPArgument::NewL(); |
|
46 CleanupStack::PushL(argument); |
|
47 iAction->AppendL( argument ); |
|
48 CleanupStack::Pop( argument ); |
|
49 CArgumentParser* argumentParser = CArgumentParser::NewL(argument, iStringPool); |
|
50 CleanupStack::PushL(argumentParser); |
|
51 StartChildParserL( argumentParser, aElement, aAttributes ); |
|
52 CleanupStack::Pop( argumentParser); |
|
53 } |
|
54 } |
|
55 } |
|
56 |
|
57 |
|
58 void CActionParser::ParseEndElementL(const RTagInfo& /*aElement*/) |
|
59 { |
|
60 iSiblingsCount--; |
|
61 iAction->SetPropertyStatus(iString,ETrue); |
|
62 iString.Close(); |
|
63 } |
|
64 |
|
65 void CActionParser::ParseContentL(const TDesC8& aBytes) |
|
66 { |
|
67 if ( !IsBlankSpace( aBytes ) ) |
|
68 iAction->SetPropertyL(iString, aBytes); |
|
69 } |