michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0:
michael@0: /*
michael@0:
michael@0: Interfaces for the RDF/XML sink, which parses RDF/XML into
michael@0: a graph representation.
michael@0:
michael@0: */
michael@0:
michael@0: #include "nsISupports.idl"
michael@0:
michael@0: // XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace()
michael@0: [ptr] native nsIAtomPtr(nsIAtom);
michael@0: [ref] native nsStringRef(nsString);
michael@0: %{C++
michael@0: class nsIAtom;
michael@0: class nsString;
michael@0: %}
michael@0:
michael@0: interface nsIRDFXMLSink;
michael@0:
michael@0: /**
michael@0: * An observer that is notified as progress is made on the load
michael@0: * of an RDF/XML document in an nsIRDFXMLSink
.
michael@0: */
michael@0: [scriptable, uuid(EB1A5D30-AB33-11D2-8EC6-00805F29F370)]
michael@0: interface nsIRDFXMLSinkObserver : nsISupports
michael@0: {
michael@0: /**
michael@0: * Called when the load begins.
michael@0: * @param aSink the RDF/XML sink on which the load is beginning.
michael@0: */
michael@0: void onBeginLoad(in nsIRDFXMLSink aSink);
michael@0:
michael@0: /**
michael@0: * Called when the load is suspended (e.g., for network quantization).
michael@0: * @param aSink the RDF/XML sink that is being interrupted.
michael@0: */
michael@0: void onInterrupt(in nsIRDFXMLSink aSink);
michael@0:
michael@0: /**
michael@0: * Called when a suspended load is resuming.
michael@0: * @param aSink the RDF/XML sink that is resuming.
michael@0: */
michael@0: void onResume(in nsIRDFXMLSink aSink);
michael@0:
michael@0: /**
michael@0: * Called when an RDF/XML load completes successfully.
michael@0: * @param aSink the RDF/XML sink that has finished loading.
michael@0: */
michael@0: void onEndLoad(in nsIRDFXMLSink aSink);
michael@0:
michael@0: /**
michael@0: * Called when an error occurs during the load
michael@0: * @param aSink the RDF/XML sink in which the error occurred
michael@0: * @param aStatus the networking result code
michael@0: * @param aErrorMsg an error message, if applicable
michael@0: */
michael@0: void onError(in nsIRDFXMLSink aSink, in nsresult aStatus, in wstring aErrorMsg);
michael@0: };
michael@0:
michael@0:
michael@0:
michael@0: /**
michael@0: * A "sink" that receives and processes RDF/XML. This interface is used
michael@0: * by the RDF/XML parser.
michael@0: */
michael@0: [scriptable, uuid(EB1A5D31-AB33-11D2-8EC6-00805F29F370)]
michael@0: interface nsIRDFXMLSink : nsISupports
michael@0: {
michael@0: /**
michael@0: * Set to true
if the sink is read-only and cannot
michael@0: * be modified
michael@0: */
michael@0: attribute boolean readOnly;
michael@0:
michael@0: /**
michael@0: * Initiate the RDF/XML load.
michael@0: */
michael@0: void beginLoad();
michael@0:
michael@0: /**
michael@0: * Suspend the RDF/XML load.
michael@0: */
michael@0: void interrupt();
michael@0:
michael@0: /**
michael@0: * Resume the RDF/XML load.
michael@0: */
michael@0: void resume();
michael@0:
michael@0: /**
michael@0: * Complete the RDF/XML load.
michael@0: */
michael@0: void endLoad();
michael@0:
michael@0: /**
michael@0: * Add namespace information to the RDF/XML sink.
michael@0: * @param aPrefix the namespace prefix
michael@0: * @param aURI the namespace URI
michael@0: */
michael@0: [noscript] void addNameSpace(in nsIAtomPtr aPrefix,
michael@0: [const] in nsStringRef aURI);
michael@0:
michael@0: /**
michael@0: * Add an observer that will be notified as the RDF/XML load
michael@0: * progresses.
michael@0: *
michael@0: * michael@0: * Note that the sink will acquire a strong reference to the michael@0: * observer, so care should be taken to avoid cyclical references michael@0: * that cannot be released (i.e., if the observer holds a michael@0: * reference to the sink, it should be sure that it eventually michael@0: * clears the reference). michael@0: * michael@0: * @param aObserver the observer to add to the sink's set of michael@0: * load observers. michael@0: */ michael@0: void addXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver); michael@0: michael@0: /** michael@0: * Remove an observer from the sink's set of observers. michael@0: * @param aObserver the observer to remove. michael@0: */ michael@0: void removeXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver); michael@0: }; michael@0: