PRInt32         PushContext(nsIRDFResource *aContext, RDFContentSinkState aState); nsresult        PopContext(nsIRDFResource*& rContext, RDFContentSinkState& rState);
PRInt32 PushContext(nsIRDFResource *aContext, RDFContentSinkState aState, RDFContentSinkParseMode aParseMode);  nsresult PopContext(nsIRDFResource         *&aContext, RDFContentSinkState     &aState, RDFContentSinkParseMode &aParseMode);
MOZ_DECL_CTOR_COUNTER(RDFContentSinkImpl::NameSpaceEntry)class RDFContentSinkImpl : public nsIRDFContentSink,                           public nsIExpatSink{public:    RDFContentSinkImpl();    virtual ~RDFContentSinkImpl();    // nsISupports    NS_DECL_ISUPPORTS    NS_DECL_NSIEXPATSINK    // nsIContentSink    NS_IMETHOD WillBuildModel(void);    NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel);    NS_IMETHOD WillInterrupt(void);    NS_IMETHOD WillResume(void);    NS_IMETHOD SetParser(nsIParser* aParser);      NS_IMETHOD FlushPendingNotifications() { return NS_OK; }    NS_IMETHOD SetDocumentCharset(nsAWritableString& aCharset) { return NS_OK; }    // nsIRDFContentSink    NS_IMETHOD Init(nsIURI* aURL);    NS_IMETHOD SetDataSource(nsIRDFDataSource* aDataSource);    NS_IMETHOD GetDataSource(nsIRDFDataSource*& aDataSource);    // pseudo constants    static PRInt32 gRefCnt;    static nsIRDFService* gRDFService;    static nsIRDFContainerUtils* gRDFContainerUtils;    static nsIRDFResource* kRDF_type;    static nsIRDFResource* kRDF_instanceOf; // XXX should be RDF:type    static nsIRDFResource* kRDF_Alt;    static nsIRDFResource* kRDF_Bag;    static nsIRDFResource* kRDF_Seq;    static nsIRDFResource* kRDF_nextVal;    static nsIAtom* kAboutAtom;    static nsIAtom* kIdAtom;    static nsIAtom* kAboutEachAtom;    static nsIAtom* kResourceAtom;    static nsIAtom* kRDFAtom;    static nsIAtom* kDescriptionAtom;    static nsIAtom* kBagAtom;    static nsIAtom* kSeqAtom;    static nsIAtom* kAltAtom;    static nsIAtom* kLiAtom;    static nsIAtom* kXMLNSAtom;protected:    // Text management    nsresult FlushText(PRBool aCreateTextNode=PR_TRUE,                       PRBool* aDidFlush=nsnull);    nsresult AddText(const PRUnichar* aText, PRInt32 aLength);    nsresult ParseTagString(const PRUnichar* aTagName, const char** aNameSpaceURI, nsIAtom** aTagAtom);        // RDF-specific parsing    nsresult OpenRDF(const PRUnichar* aName);    nsresult OpenObject(const PRUnichar* aName ,const PRUnichar** aAttributes);    nsresult OpenProperty(const PRUnichar* aName, const PRUnichar** aAttributes);    nsresult OpenMember(const PRUnichar* aName, const PRUnichar** aAttributes);    nsresult OpenValue(const PRUnichar* aName, const PRUnichar** aAttributes);        nsresult GetIdAboutAttribute(const PRUnichar** aAttributes, nsIRDFResource** aResource, PRBool* aIsAnonymous = nsnull);    nsresult GetResourceAttribute(const PRUnichar** aAttributes, nsIRDFResource** aResource);    nsresult AddProperties(const PRUnichar** aAttributes, nsIRDFResource* aSubject, PRInt32* aCount = nsnull);    // namespace management    nsresult PushNameSpacesFrom(const PRUnichar** aAttributes);    PRBool   IsXMLNSDirective(const nsAReadableString& aAttributeKey, nsIAtom** aPrefix = nsnull);    nsresult PopNameSpaces();    PRUnichar* mText;    PRInt32 mTextLength;    PRInt32 mTextSize;    PRBool mConstrainSize;    struct NameSpaceEntry {    public:        NameSpaceEntry(nsIAtom* aPrefix, const char* aNameSpaceURI)            : mPrefix(aPrefix), mNext(nsnull) {            MOZ_COUNT_CTOR(RDFContentSinkImpl::NameSpaceEntry);            mNameSpaceURI = PL_strdup(aNameSpaceURI);        }        ~NameSpaceEntry() {            MOZ_COUNT_DTOR(RDFContentSinkImpl::NameSpaceEntry);            PL_strfree(mNameSpaceURI);        }        nsCOMPtr<nsIAtom> mPrefix;        char*             mNameSpaceURI;        NameSpaceEntry*   mNext;    };    NameSpaceEntry* mNameSpaceStack;    nsAutoVoidArray mNameSpaceScopes;    nsIAtom*    CutNameSpacePrefix(nsString& aString);    nsresult    GetNameSpaceURI(nsIAtom* aPrefix, const char** aNameSpaceURI);    nsresult    ParseTagString(const nsAReadableString& aTagName,                   const char** aNameSpaceURI,                   nsIAtom** aTag);    nsresult    ParseAttributeString(const nsAReadableString& aAttributeName,                         const char** aNameSpaceURI,                         nsIAtom** aAttribute);    enum eContainerType { eBag, eSeq, eAlt };    nsresult InitContainer(nsIRDFResource* aContainerType, nsIRDFResource* aContainer);    nsresult ReinitContainer(nsIRDFResource* aContainerType, nsIRDFResource* aContainer);    // The datasource in which we're assigning assertions    nsCOMPtr<nsIRDFDataSource> mDataSource;    // The current state of the content sink    RDFContentSinkState mState;    // content stack management    PRInt32         PushContext(nsIRDFResource *aContext, RDFContentSinkState aState);    nsresult        PopContext(nsIRDFResource*& rContext, RDFContentSinkState& rState);    nsIRDFResource* GetContextElement(PRInt32 ancestor = 0);    nsAutoVoidArray* mContextStack;    nsIURI*      mDocumentURL;};