InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CSAXDOMSerializerHandler.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Lin Xia
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 __CSAXDOMSerializerHandler_h__
29 #define __CSAXDOMSerializerHandler_h__
30 
31 #include "CPMUnknown.h"
32 #include "ISAXDOMSerializerHandler.h"
33 
41 class CSAXDOMSerializerHandler : public CPMUnknown<ISAXDOMSerializerHandler>
42 {
43 public:
45  virtual ~CSAXDOMSerializerHandler();
46 
47  virtual void Register(ISAXDOMSerializerServices* saxServices, IPMUnknown *importer = nil);
48  virtual bool16 HandlesSubElements() const;
49 
50  virtual void Characters(const WideString& chars, IIDXMLDOMNode* currentNode);
51 
52  virtual void StartDocument(ISAXDOMSerializerServices* saxServices);
53  virtual void EndDocument();
54 
55  virtual void StartElement(const WideString& uri, const WideString& localname,
56  const WideString& qname, ISAXAttributeList* attrs, IIDXMLDOMNode* currentNode);
57  virtual void EndElement(const WideString& uri, const WideString& localname, const WideString& qname, IIDXMLDOMNode* currentNode);
58 
59  virtual void StartPrefixMapping(const WideString& prefix, const WideString& uri);
60  virtual void EndPrefixMapping(const WideString& prefix);
61 
62  virtual void ProcessingInstruction(const WideString& target, const WideString& data, IIDXMLDOMNode* currentNode);
63  virtual void ExtComment(const WideString& comment, IIDXMLDOMNode* currentNode);
64 
65 protected:
66  // Helper methods to easily extract basic types from attributes list. If the attribute exists, it will extract
67  // the basic type from it. If it doesn't exist, it returns the default value you passed in.
68  bool16 HasAttribute( ISAXAttributeList* attrs, const WideString& key);
69  WideString GetAttributeString( ISAXAttributeList* attrs, const WideString& key, const WideString& defaultValue = WideString());
70  bool16 GetAttributeBool( ISAXAttributeList* attrs, const WideString& key, bool16 defaultValue = kFalse);
71  int32 GetAttributeInt( ISAXAttributeList* attrs, const WideString& key, int32 defaultValue = 0);
72 };
73 
74 #endif