InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISAXServices Class Referenceabstract

#include <ISAXServices.h>

Inheritance diagram for ISAXServices:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ISAXSERVICES }
 

Public Member Functions

virtual bool16 ParseStream (IPMStream *stream, ISAXContentHandler *defaultHandler, ISAXEntityResolver *entityResolver=nil, ISAXDTDHandler *dtdHandler=nil, IXMLDTDTokenHandler *dtdTokenHandler=nil, BaseProgressBar *progressBar=nil)=0
 
virtual ISAXContentHandlerGetDefaultContentHandler () const =0
 
virtual void RegisterElementHandler (const WideString &uri, const WideString &localName, ISAXContentHandler *handler)=0
 
virtual ISAXContentHandlerQueryElementHandler (const WideString &uri, const WideString &localName) const =0
 
virtual void RegisterAttributeHandler (const WideString &uri, const WideString &localName, ISAXContentHandler *handler)=0
 
virtual ISAXContentHandlerQueryAttributeHandler (const WideString &uri, const WideString &localName) const =0
 
virtual void RegisterPIHandler (const WideString &targetName, ISAXContentHandler *handler)=0
 
virtual ISAXContentHandlerQueryPIHandler (const WideString &targetName) const =0
 
virtual IXMLParsingContextQueryCurrentParsingContext ()=0
 
virtual void Push_Back (IXMLParsingContext *parsingContext)=0
 
virtual IXMLParsingContextPop_Back ()=0
 
virtual IXMLParsingContextBack ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Class responsible for SAX parsing of an XML-based stream. Clients pass in custom handlers. SAX (Simple API for XML) specifies an abstract set of interfaces a conforming parser should implement; it is an example of an event based API for parsing XML. The contrast between an event-based API like SAX, versus DOM-based APIs, which construct in-memory parse trees, is described in some detail at the SAX Projects site.

InDesign constructs something akin to a DOM based representation of the logical structure of a document, using the services of the SAX based XML parser. One occasion where you may need to use this class from client code is to use IXMLStructureSuite::Import. You can construct an object supporting ISAXServices for use in these situations with code like this:


InterfacePtr<IK2ServiceRegistry> serviceRegistry(GetExecutionContextSession(), UseDefaultIID());

InterfacePtr<IK2ServiceProvider> xmlProvider(

    serviceRegistry->QueryServiceProviderByClassID(kXMLParserService, 

        kXMLParserServiceBoss));

InterfacePtr<ISAXServices> saxServices(xmlProvider, UseDefaultIID());

Member Function Documentation

virtual IXMLParsingContext* ISAXServices::Back ()
pure virtual

Peek at the parsing context information on the top of the stack. This does not remove the context information from the stack. Useful for examining parent information.

Returns
instance of IXMLParsingContext.
virtual ISAXContentHandler* ISAXServices::GetDefaultContentHandler () const
pure virtual

Return the default content handler that was supplied at the beginning of the parse. This is only valid during a parse. Otherwise this will return nil.

Returns
the instance of the default content handler. This is not addref'ed.
virtual bool16 ISAXServices::ParseStream (IPMStreamstream,
ISAXContentHandlerdefaultHandler,
ISAXEntityResolverentityResolver = nil,
ISAXDTDHandlerdtdHandler = nil,
IXMLDTDTokenHandler * dtdTokenHandler = nil,
BaseProgressBarprogressBar = nil 
)
pure virtual

Parse the XML data in the incoming stream, calling out to the DocumentHandler as elements are encountered.

Parameters
streamspecifies the stream containing the XML content to parse
progressBarthe progress bar to use when importing XML content.
Returns
bool16
virtual IXMLParsingContext* ISAXServices::Pop_Back ()
pure virtual

Remove the specified set of parsing context information on a stack.

Returns
instance of IXMLParsingContext.
virtual void ISAXServices::Push_Back (IXMLParsingContextparsingContext)
pure virtual

Save the specified set of parsing context information on a stack. When parsing an imported XML file parent/child element parsing information is maintained on this stack. For example StartElement pushes the current parsing context information on the stack before creating a new element.

Parameters
parsingContexta set of parsing context information, usually the current information.
virtual ISAXContentHandler* ISAXServices::QueryAttributeHandler (const WideStringuri,
const WideStringlocalName 
) const
pure virtual

Return the content handler registered for this attribute.

Parameters
urithe uri (namespace) of the attribute
localNamethe unqualifed portion of the attribute
Returns
addref'ed instance of the content handler
virtual IXMLParsingContext* ISAXServices::QueryCurrentParsingContext ()
pure virtual

Returns the current parsing context information. This includes the current element, tag name, child index, story reference, and text insertion position. Additional parsing context information can be accessed via this interface if content handlers have data interfaces to kXMLParsingLocatorBoss.

Returns
instance of IXMLParsingContext.
virtual ISAXContentHandler* ISAXServices::QueryElementHandler (const WideStringuri,
const WideStringlocalName 
) const
pure virtual

Return the content handler registered for this element tag name.

Parameters
urithe uri (namespace) of the tag name
localNamethe unqualifed portion of the tag name
Returns
addref'ed instance of the content handler
virtual ISAXContentHandler* ISAXServices::QueryPIHandler (const WideStringtargetName) const
pure virtual

Return the content handler registered for this processing instruction target name.

Parameters
targetNamethe name of the target
Returns
addref'ed instance of the content handler
virtual void ISAXServices::RegisterAttributeHandler (const WideStringuri,
const WideStringlocalName,
ISAXContentHandlerhandler 
)
pure virtual

Register a content handler for a given attribute. When the parser encounters an element with the specified attribute it will use this content handler to deal with it.

Parameters
urithe uri (namespace) of the attribute
localNamethe unqualifed portion of the attribute
handleran instance of ISAXContentHandler that handle this element
virtual void ISAXServices::RegisterElementHandler (const WideStringuri,
const WideStringlocalName,
ISAXContentHandlerhandler 
)
pure virtual

Register a content handler for a given element. When the parser encounters an element with the specified name it will use this content handler to deal with it.

Parameters
urithe uri (namespace) of the tag name
localNamethe unqualifed portion of the tag name
handleran instance of ISAXContentHandler that handle this element
virtual void ISAXServices::RegisterPIHandler (const WideStringtargetName,
ISAXContentHandlerhandler 
)
pure virtual

Register a content handler for a given processing instruction target. When the parser encounters a PI with the specified target name it will use this content handler to deal with it.

Parameters
targetNamethe name of the processing instruction target
handleran instance of ISAXContentHandler that handle this PI