00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SEN_BASE_FRAGMENT_H
00022 #define SEN_BASE_FRAGMENT_H
00023
00024
00025 #include <MSenContentHandlerClient.h>
00026 #include <SenElement.h>
00027 #include <SenFragment.h>
00028
00029
00030
00031
00032 const TInt KStateNotSet = -1;
00033 const TInt KStateIgnore = 0;
00034 const TInt KStateSave = 1;
00035 const TInt KStateResume = 2;
00036
00037
00038 class CSenXmlReader;
00039
00040
00041
00057 class CSenBaseFragment : public CSenFragment, public MSenContentHandlerClient
00058 {
00059 public:
00060
00067 IMPORT_C static CSenBaseFragment* NewL(const CSenElement& aElement);
00068
00078 IMPORT_C static CSenBaseFragment* NewL(const TDesC8& aLocalName);
00079
00090 IMPORT_C static CSenBaseFragment* NewL(const TDesC8& aNsUri,
00091 const TDesC8& aLocalName);
00092
00104 IMPORT_C static CSenBaseFragment* NewL(const TDesC8& aNsUri,
00105 const TDesC8& aLocalName,
00106 const TDesC8& aQName);
00107
00120 IMPORT_C static CSenBaseFragment* NewL(const TDesC8& aNsUri,
00121 const TDesC8& aLocalName,
00122 const TDesC8& aQName,
00123 const RAttributeArray& apAttrs);
00124
00140 IMPORT_C static CSenBaseFragment* NewL(const TDesC8& aNsUri,
00141 const TDesC8& aLocalName,
00142 const TDesC8& aQName,
00143 const RAttributeArray& apAttrs,
00144 CSenElement& aParent);
00145
00149 IMPORT_C virtual ~CSenBaseFragment();
00150
00151
00152
00153
00159 IMPORT_C virtual TPtrC8 Content();
00167 IMPORT_C virtual CSenNamespace* Namespace(const TDesC8& aPrefix);
00168
00173 IMPORT_C virtual void EnsureNamespace(const TDesC8& aPrefix);
00174
00181 IMPORT_C virtual void DetachL();
00182
00191 IMPORT_C virtual void SaveNamespacesL(const RAttributeArray& aAttrs,
00192 TBool aEnsure);
00193
00198 IMPORT_C virtual void ResetContentL();
00199
00200
00201
00202
00203
00208 IMPORT_C virtual const TDesC8& LocalName() const;
00209
00215 IMPORT_C virtual const TDesC8& NsUri() const;
00216
00222 IMPORT_C virtual const TDesC8& NsPrefix() const;
00223
00230 IMPORT_C virtual CSenElement& AsElement();
00231
00241 IMPORT_C virtual CSenElement* ExtractElement();
00242
00249 IMPORT_C virtual CSenXmlReader* Reader();
00250
00257 IMPORT_C virtual void SetReader(CSenXmlReader& aReader);
00258
00271 IMPORT_C virtual void ParseL(const TDesC8& aXml);
00272
00281 IMPORT_C virtual TInt BuildFrom(const TDesC8& aXml);
00282
00293 IMPORT_C virtual void DelegateParsingL(MSenFragment& aDelegate);
00294
00308 IMPORT_C virtual void DelegateParsingL(const TDesC8& aNsUri,
00309 const TDesC8& aLocalName,
00310 const TDesC8& aQName,
00311 const RAttributeArray& aAttrs);
00312
00319 IMPORT_C virtual void ParseWithL(CSenXmlReader& aReader);
00320
00326 IMPORT_C virtual void SetOwner(MSenFragment& aFragment);
00327
00339 IMPORT_C virtual void ResumeParsingFromL(const TDesC8& aNsUri,
00340 const TDesC8& aLocalName,
00341 const TDesC8& aQName);
00342
00352 IMPORT_C virtual void SetAttributesL(const RAttributeArray& aAttrs);
00353
00363 IMPORT_C void WriteStartElementL(const TDesC8& aNsUri,
00364 const TDesC8& aLocalName,
00365 const TDesC8& aQName,
00366 const RAttributeArray& aAttrs);
00367
00376 IMPORT_C void WriteEndElementL(const TDesC8& aNsUri,
00377 const TDesC8& aLocalName,
00378 const TDesC8& aQName);
00379
00385 IMPORT_C virtual HBufC* AsXmlUnicodeL();
00386
00392 IMPORT_C virtual HBufC8* AsXmlL();
00393
00400 IMPORT_C virtual void WriteAsXMLToL(RWriteStream& aWs);
00401
00412 IMPORT_C virtual TBool ConsistsOfL(MSenFragment& aCandidate);
00413
00414 protected:
00415
00419 IMPORT_C CSenBaseFragment();
00420
00431 IMPORT_C void BaseConstructL(const CSenElement& aElement);
00432
00438 IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
00439
00446 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00447 const TDesC8& aLocalName);
00448
00456 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00457 const TDesC8& aLocalName,
00458 const TDesC8& aQName);
00467 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00468 const TDesC8& aLocalName,
00469 const TDesC8& aQName,
00470 const RAttributeArray& aAttrs);
00471
00481 IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
00482 const TDesC8& aLocalName,
00483 const TDesC8& aQName,
00484 const RAttributeArray& aAttrs,
00485 CSenElement& aParent);
00486
00492 IMPORT_C void BaseConstructL(CSenXmlReader& aReader);
00493
00494
00495
00500 IMPORT_C virtual void AllocContentSaverL();
00501
00511 IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
00512 const TDesC8& aLocalName,
00513 const TDesC8& aQName,
00514 const RAttributeArray& aAttrs);
00515
00524 IMPORT_C virtual void EndElementL(const TDesC8& aNsUri,
00525 const TDesC8& aLocalName,
00526 const TDesC8& aQName);
00527
00537 IMPORT_C virtual void CharactersL(const TDesC8& aChars,
00538 TInt aStart,
00539 TInt aLength);
00540
00547 IMPORT_C TInt StartEntity(TDesC8& aName);
00548
00561 IMPORT_C MSenElement& SetContentOfL(const TDesC8& aLocalName,
00562 const TDesC8 &aContent);
00570 IMPORT_C TPtrC8 ContentOf(const TDesC8& aLocalName);
00571
00572 private:
00573
00577 TPtrC8 ContentL();
00578
00579
00580
00581
00582
00583 IMPORT_C virtual TInt StartDocument();
00584 IMPORT_C virtual TInt EndDocument();
00585 IMPORT_C virtual TInt StartElement(const TDesC8& aNsUri,
00586 const TDesC8& aLocalName,
00587 const TDesC8& aQName,
00588 const RAttributeArray& aAttrs);
00589
00590 IMPORT_C virtual TInt EndElement(const TDesC8& aNsUri,
00591 const TDesC8& aLocalName,
00592 const TDesC8& aQName);
00593
00594 IMPORT_C virtual TInt Characters(const TDesC8& aChars,
00595 const TInt aStart,
00596 const TInt aLength);
00597
00598 IMPORT_C virtual TInt Error(TInt aErrorCode);
00599
00600 protected:
00601
00602
00603
00604
00605
00606
00607 TInt iState;
00608
00609 CSenElement* ipElement;
00610
00611 CSenXmlReader* iXmlReader;
00612
00613 MSenFragment* ipOwner;
00614
00615 RWriteStream iWs;
00616
00617 private:
00618
00619
00620 CSenFragment* ipDelegate;
00621
00622
00623
00624 RPointerArray<CSenNamespace> iNamespaces;
00625
00626
00627 RPointerArray<HBufC8> iPrefixes;
00628
00629 CBufFlat* ipContentWithNamespaces;
00630
00631 TBool hasContentWriteStream;
00632
00633 TBool iElementOwned;
00634 };
00635
00636
00637 #endif
00638
00639
00640
00641
00642