InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CSAXContentHandler.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Lonnie Millett
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // A default implementation of ISAXContentHandler. This provides an empty implementation
24 // of each method so that clients can only override those that they really care about.
25 //
26 //========================================================================================
27 
28 #ifndef __CSAXContentHandler_h__
29 #define __CSAXContentHandler_h__
30 
31 #include "CPMUnknown.h"
32 #include "ISaxContentHandler.h"
33 
41 #ifdef __clang__
42 template class CPMUnknown<ISAXContentHandler>;
43 #endif
44 
46 {
47 public:
49  virtual ~CSAXContentHandler();
50 
51  virtual void Register(ISAXServices* saxServices, IPMUnknown *importer = nil);
52  virtual bool16 HandlesSubElements() const;
53 
54  virtual void Characters(const WideString& chars);
55 
56  virtual void StartDocument(ISAXServices* saxServices);
57  virtual void EndDocument();
58 
59  virtual void StartElement(const WideString& uri, const WideString& localname,
60  const WideString& qname, ISAXAttributes* attrs);
61  virtual void EndElement(const WideString& uri, const WideString& localname, const WideString& qname);
62 
63  virtual void StartPrefixMapping(const WideString& prefix, const WideString& uri);
64  virtual void EndPrefixMapping(const WideString& prefix);
65 
66  virtual void IgnorableWhitespace(const WideString& chars);
67  virtual void ProcessingInstruction(const WideString& target, const WideString& data);
68  virtual void SkippedEntity(const WideString& name);
69  virtual void ExtComment(const WideString& comment);
70  virtual void ExtXMLDecl(const WideString& version, const WideString& encoding,
71  const WideString& standalone, const WideString& actualEncoding);
72 
73  virtual void SetDocumentLocator(ISAXLocator* locator);
74  virtual ISAXLocator* GetDocumentLocator() const;
75 
76 protected:
77  // Helper methods to easily extract basic types from attributes list. If the attribute exists, it will extract
78  // the basic type from it. If it doesn't exist, it returns the default value you passed in.
79  bool16 HasAttribute( ISAXAttributes* attrs, const PMString& key);
80  bool16 HasAttribute( ISAXAttributes* attrs, const WideString& key);
81 
82  PMString GetAttributeString( ISAXAttributes* attrs, const PMString& key, const PMString& defaultValue = "");
83  WideString GetAttributeString( ISAXAttributes* attrs, const WideString& key, const WideString* defaultValue = nil);
84 
85  bool16 GetAttributeBool( ISAXAttributes* attrs, const PMString& key, bool16 defaultValue = kFalse);
86  bool16 GetAttributeBool( ISAXAttributes* attrs, const WideString& key, bool16 defaultValue = kFalse);
87 
88  int32 GetAttributeInt( ISAXAttributes* attrs, const PMString& key, int32 defaultValue = 0);
89  int32 GetAttributeInt( ISAXAttributes* attrs, const WideString& key, int32 defaultValue = 0);
90 
91 private:
92  ISAXLocator* fLocator;
93 };
94 
95 #endif