22 #include "FeedParserObserver.h" |
22 #include "FeedParserObserver.h" |
23 #include "FeedInfo.h" |
23 #include "FeedInfo.h" |
24 #include <xml/parser.h> // for CParser |
24 #include <xml/parser.h> // for CParser |
25 #include <xml/contenthandler.h> // for Xml::MContentHandler |
25 #include <xml/contenthandler.h> // for Xml::MContentHandler |
26 #include <xml/documentparameters.h> |
26 #include <xml/documentparameters.h> |
|
27 |
27 |
28 |
28 _LIT(KTagItem, "item"); |
29 _LIT(KTagItem, "item"); |
29 _LIT(KTagTitle, "title"); |
30 _LIT(KTagTitle, "title"); |
30 _LIT(KTagImage, "image"); |
31 _LIT(KTagImage, "image"); |
31 _LIT(KTagLink, "link"); |
32 _LIT(KTagLink, "link"); |
60 ELatin1 |
61 ELatin1 |
61 }; |
62 }; |
62 |
63 |
63 const int KBufferLength = 1024; |
64 const int KBufferLength = 1024; |
64 |
65 |
65 class CFeedParser : public CBase, public Xml::MContentHandler |
66 class CFeedParser : public CActive, public Xml::MContentHandler |
66 { |
67 { |
67 public: |
68 public: |
|
69 static CFeedParser* NewL(MFeedParserObserver& aCallbacks, RFs& aFs); |
|
70 static CFeedParser* NewLC(MFeedParserObserver& aCallbacks, RFs& aFs); |
|
71 virtual ~CFeedParser(); |
|
72 |
|
73 private: |
68 CFeedParser(MFeedParserObserver& aCallbacks, RFs& aFs); |
74 CFeedParser(MFeedParserObserver& aCallbacks, RFs& aFs); |
69 virtual ~CFeedParser(); |
75 void ConstructL(); |
70 |
76 |
71 public: |
77 public: |
72 void ParseFeedL(const TFileName &feedFileName, CFeedInfo *item, TUint aMaxItems); |
78 void ParseFeedL(const TFileName &feedFileName, CFeedInfo *item, TUint aMaxItems); |
73 |
79 void ParseFeedAoL(const TFileName &feedFileName, CFeedInfo *item, TUint aMaxItems); |
|
80 |
74 public: // from MContentHandler |
81 public: // from MContentHandler |
75 void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); |
82 void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); |
76 void OnEndDocumentL(TInt aErrorCode); |
83 void OnEndDocumentL(TInt aErrorCode); |
77 void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); |
84 void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); |
78 void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); |
85 void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); |
83 void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
90 void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
84 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
91 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
85 void OnError(TInt aErrorCode); |
92 void OnError(TInt aErrorCode); |
86 TAny* GetExtendedInterface(const TInt32 aUid); |
93 TAny* GetExtendedInterface(const TInt32 aUid); |
87 CFeedInfo& ActiveFeed(); |
94 CFeedInfo& ActiveFeed(); |
|
95 |
|
96 private: |
|
97 void DoCancel(); |
|
98 void RunL(); |
|
99 TInt RunError(TInt aError); |
|
100 |
88 private: |
101 private: |
89 MFeedParserObserver& iCallbacks; |
102 MFeedParserObserver& iCallbacks; |
90 TFeedState iFeedState; |
103 TFeedState iFeedState; |
91 |
104 |
92 CShowInfo* iActiveShow; |
105 CShowInfo* iActiveShow; |