InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CSAXContentHandler Class Reference

#include <CSAXContentHandler.h>

Inheritance diagram for CSAXContentHandler:
CPMUnknown< ISAXContentHandler >ISAXContentHandlerIPMUnknownBasePanelSAXHandlerCHLUserDictContentHandlerXCatHndSAXContentHandlerDCLSizPanelSAXHandler

Public Member Functions

 CSAXContentHandler (IPMUnknown *boss)
 
virtual void Register (ISAXServices *saxServices, IPMUnknown *importer=nil)
 
virtual bool16 HandlesSubElements () const
 
virtual void Characters (const WideString &chars)
 
virtual void StartDocument (ISAXServices *saxServices)
 
virtual void EndDocument ()
 
virtual void StartElement (const WideString &uri, const WideString &localname, const WideString &qname, ISAXAttributes *attrs)
 
virtual void EndElement (const WideString &uri, const WideString &localname, const WideString &qname)
 
virtual void StartPrefixMapping (const WideString &prefix, const WideString &uri)
 
virtual void EndPrefixMapping (const WideString &prefix)
 
virtual void IgnorableWhitespace (const WideString &chars)
 
virtual void ProcessingInstruction (const WideString &target, const WideString &data)
 
virtual void SkippedEntity (const WideString &name)
 
virtual void ExtComment (const WideString &comment)
 
virtual void ExtXMLDecl (const WideString &version, const WideString &encoding, const WideString &standalone, const WideString &actualEncoding)
 
virtual void SetDocumentLocator (ISAXLocator *locator)
 
virtual ISAXLocatorGetDocumentLocator () const
 
- Public Member Functions inherited from CPMUnknown< ISAXContentHandler >
IPMUnknownQueryInterface (PMIID interfaceID) const
 
void AddRef () const
 
void Release () const
 
void PreDirty (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
void PreDirtyNoMessage (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
 CPMUnknown (const CPMUnknown &)=delete
 
CPMUnknownoperator= (const CPMUnknown &)=delete
 

Protected Member Functions

bool16 HasAttribute (ISAXAttributes *attrs, const PMString &key)
 
bool16 HasAttribute (ISAXAttributes *attrs, const WideString &key)
 
PMString GetAttributeString (ISAXAttributes *attrs, const PMString &key, const PMString &defaultValue="")
 
WideString GetAttributeString (ISAXAttributes *attrs, const WideString &key, const WideString *defaultValue=nil)
 
bool16 GetAttributeBool (ISAXAttributes *attrs, const PMString &key, bool16 defaultValue=kFalse)
 
bool16 GetAttributeBool (ISAXAttributes *attrs, const WideString &key, bool16 defaultValue=kFalse)
 
int32 GetAttributeInt (ISAXAttributes *attrs, const PMString &key, int32 defaultValue=0)
 
int32 GetAttributeInt (ISAXAttributes *attrs, const WideString &key, int32 defaultValue=0)
 
- Protected Member Functions inherited from CPMUnknown< ISAXContentHandler >
 CPMUnknown (IPMUnknown *boss)
 

Additional Inherited Members

- Public Types inherited from ISAXContentHandler
enum  { kDefaultIID = IID_ISAXCONTENTHANDLER }
 
- Protected Attributes inherited from CPMUnknown< ISAXContentHandler >
HelperInterface fHelperInterface
 

Detailed Description

A empty base class implementation of ISAXContentHandler. Clients who wish to parse XML content should implement new classes derived from this class.

For a description of each method

See Also
ISAXContentHandler

Member Function Documentation

virtual void CSAXContentHandler::Characters (const WideStringchars)
virtual

Receives character data

The parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks. But all characters in any single event must come from the same external entity so the Locator provides useful information.

Note some parsers will report whitespace using the IgnorableWhitespace() method rather than this one (validating parsers must do so).

Parameters
CharsThe characters from the XML document.

Implements ISAXContentHandler.

Reimplemented in XCatHndSAXContentHandler, and CHLUserDictContentHandler.

virtual void CSAXContentHandler::EndDocument ()
virtual

Receive end of document notification

The SAX parser will invoke this method only once and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::EndElement (const WideStringuri,
const WideStringlocalname,
const WideStringqname 
)
virtual

Receive end of element notification

The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement() event for every endElement() event (even when the element is empty).

Parameters
uriThe URI of the associated namespace for this element
localnameThe local part of the element name
qnameThe QName of this element

Implements ISAXContentHandler.

Reimplemented in XCatHndSAXContentHandler, BasePanelSAXHandler, CHLUserDictContentHandler, and DCLSizPanelSAXHandler.

virtual void CSAXContentHandler::EndPrefixMapping (const WideStringprefix)
virtual

Receive end of namespace prefix mapping notification

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each namespace prefix mapping.

Parameters
prefixThe namespace prefix used

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::ExtComment (const WideStringcomment)
virtual

(Extension) Receive a comment

The parser will invoke this method when it encounters a comment.

Parameters
commentThe interior text of the comment.

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::ExtXMLDecl (const WideStringversion,
const WideStringencoding,
const WideStringstandalone,
const WideStringactualEncoding 
)
virtual

(Extension) Receive the XML declaration

The parser will invoke this method when it encounters a well-formed XML declaration. Any or all of these strings may be invalid, so check first before using them.

Parameters
versionThe XML version
encodingThe encoding specified in the declaration
standaloneThe value of the standalone indicator.
actualEncodingThe actual encoding detected by the parser

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual ISAXLocator* CSAXContentHandler::GetDocumentLocator () const
virtual

return a parser position locator

This is the document locator that was set before an parsing began

See Also
ISAXContentHandler::SetDocumentLocator

Implements ISAXContentHandler.

virtual bool16 CSAXContentHandler::HandlesSubElements () const
virtual

When this handler is registered to handle an element with a specific tagname, the handler can decide if it wants to handle any subelements of that element that don't have a handler for themselves. If true is returned, any elements that are child elements without their own ISAXContentHandler will cause StartElement() to be called on this handler. If, however, false is returned, next handler on the stack will be called with HandlesSubElements() until one returns tru or we get to the default handler.

Returns
true if this handler will handle subelements, false if doesn't handle subelements

Implements ISAXContentHandler.

Reimplemented in XCatHndSAXContentHandler, BasePanelSAXHandler, and DCLSizPanelSAXHandler.

virtual void CSAXContentHandler::IgnorableWhitespace (const WideStringchars)
virtual

Receive ignorable whitespace in element content

Validating parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10). Non-validating parsers may also use this method if they are capable of parsing and using content models.

SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks. But all characters in any single event must come from the same external entity so the Locator provides useful information.

Parameters
charsThe characters from the XML document.
See Also
Characters

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::ProcessingInstruction (const WideStringtarget,
const WideStringdata 
)
virtual

Receive a processing instruction

The parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.

A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.

Parameters
targetThe processing instruction target
dataThe processing instruction data, or null if none was supplied

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::Register (ISAXServicessaxServices,
IPMUnknownimporter = nil 
)
virtual

Register this content handler to handle specific elements, attributes, and processing instructions.

When combined with a service provider implementation SAXServices will call your Register method to allow the content handler to specify which elements, attributes, and/or processing instructions it is interested in handling. Registration is accomplished by calling RegisterElementHandler, RegisterAttributeHandler, and RegisterPIHandler.

Parameters
saxServicesThe instance of ISAXServices instantiated for this parse.
importerThe instance of XMLImporter being used for this import. The Content Handler needs to be able to get to the IMatchRecorder and IXMLImporterDOM from the interface passed in here.

Implements ISAXContentHandler.

Reimplemented in XCatHndSAXContentHandler, BasePanelSAXHandler, and DCLSizPanelSAXHandler.

virtual void CSAXContentHandler::SetDocumentLocator (ISAXLocatorlocator)
virtual

Receive a parser position locator

If this method is called at all, it is guaranteed to be called before invoking any of the other methods in this interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during each individual call to the functions in this interface. The application should not attempt to use it at any other time.

Parameters
locatorAn object that can return the location of any SAX document event.
See Also
ISAXLocator

Implements ISAXContentHandler.

virtual void CSAXContentHandler::SkippedEntity (const WideStringname)
virtual

Receive a skipped entity notification

The parser will invoke this method once for each entity skipped. All processors may skip external entities, depending on the values of the features:
http://xml.org/sax/features/external-general-entities
http://xml.org/sax/features/external-parameter-entities

Parameters
nameThe name of the skipped entity. If it is a parameter entity, the name will begin with %, and if it is the external DTD subset, it will be the string [dtd].

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::StartDocument (ISAXServicessaxServices)
virtual

Receive the beginning of document notification

The SAX parser will invoke this method once before other methods in this interface or in DTDHandler (except for setDocumentLocator).

Parameters
saxServicesThe instance of ISAXServices instantiated for this parse.

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.

virtual void CSAXContentHandler::StartElement (const WideStringuri,
const WideStringlocalname,
const WideStringqname,
ISAXAttributesattrs 
)
virtual

Receive the beginning of element notification

The parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement() event for every startElement() event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement() event.

Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted.

Parameters
uriThe URI of the asscioated namespace for this element
localnameThe local part of the element name
qnameThe QName of this element
attrsThe attributes attached to the element, if any.
See Also
EndElement
ISAXAttributes

Implements ISAXContentHandler.

Reimplemented in XCatHndSAXContentHandler, CHLUserDictContentHandler, BasePanelSAXHandler, and DCLSizPanelSAXHandler.

virtual void CSAXContentHandler::StartPrefixMapping (const WideStringprefix,
const WideStringuri 
)
virtual

Receive start of namespace prefix mapping notification

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each namespace prefix mapping.

Parameters
prefixThe namespace prefix used
uriThe namespace URI used.

Implements ISAXContentHandler.

Reimplemented in CHLUserDictContentHandler.