File indexing completed on 2025-01-30 10:27:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMNORMALIZER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMNORMALIZER_HPP
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include <xercesc/util/XercesDefs.hpp>
0035 #include <xercesc/util/RefHashTableOf.hpp>
0036 #include <xercesc/util/RefVectorOf.hpp>
0037 #include <xercesc/framework/XMLErrorCodes.hpp>
0038
0039
0040 XERCES_CPP_NAMESPACE_BEGIN
0041
0042 class DOMConfigurationImpl;
0043 class DOMErrorHandler;
0044 class DOMDocumentImpl;
0045 class DOMNode;
0046 class DOMElementImpl;
0047 class DOMAttr;
0048 class DOMNamedNodeMap;
0049
0050 class DOMNormalizer : public XMemory {
0051
0052
0053 class InScopeNamespaces : public XMemory {
0054 class Scope : public XMemory {
0055 public:
0056 Scope(Scope *baseScopeWithBindings);
0057 ~Scope();
0058 void addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri,
0059 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0060 const XMLCh* getUri(const XMLCh *prefix) const;
0061 const XMLCh* getPrefix(const XMLCh* uri) const;
0062 Scope *fBaseScopeWithBindings;
0063
0064 private:
0065 RefHashTableOf<XMLCh> *fPrefixHash;
0066 RefHashTableOf<XMLCh> *fUriHash;
0067
0068 Scope ( const Scope& toCopy);
0069 Scope& operator= (const Scope& other);
0070 };
0071
0072 public:
0073 InScopeNamespaces(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0074 ~InScopeNamespaces();
0075 void addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri,
0076 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0077 void addScope(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0078 void removeScope();
0079 bool isValidBinding(const XMLCh* prefix, const XMLCh* uri) const;
0080 const XMLCh* getOrDeclarePrefix(const XMLCh* uri);
0081 const XMLCh* getPrefix(const XMLCh* uri) const;
0082 const XMLCh* getUri(const XMLCh* prefix) const;
0083 XMLSize_t size();
0084
0085 private:
0086 RefVectorOf<Scope> *fScopes;
0087 Scope *lastScopeWithBindings;
0088
0089 InScopeNamespaces ( const InScopeNamespaces& toCopy);
0090 InScopeNamespaces& operator= (const InScopeNamespaces& other);
0091 };
0092
0093 public:
0094 DOMNormalizer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0095 ~DOMNormalizer();
0096
0097
0098
0099
0100 void normalizeDocument(DOMDocumentImpl *doc);
0101
0102 private:
0103
0104 DOMNormalizer ( const DOMNormalizer& toCopy);
0105 DOMNormalizer& operator= (const DOMNormalizer& other);
0106
0107 protected:
0108
0109
0110
0111 DOMNode * normalizeNode(DOMNode *node) const;
0112
0113
0114
0115
0116
0117 void namespaceFixUp(DOMElementImpl *ele) const;
0118
0119
0120
0121
0122 const XMLCh * integerToXMLCh(unsigned int i) const;
0123
0124
0125
0126
0127
0128
0129 void addOrChangeNamespaceDecl(const XMLCh* prefix, const XMLCh* uri, DOMElementImpl *element) const;
0130
0131
0132
0133
0134
0135 const XMLCh* addCustomNamespaceDecl(const XMLCh* uri, DOMElementImpl *element) const;
0136
0137
0138
0139
0140
0141 void error(const XMLErrs::Codes code, const DOMNode *node) const;
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154 DOMDocumentImpl *fDocument;
0155 DOMConfigurationImpl *fConfiguration;
0156 DOMErrorHandler *fErrorHandler;
0157 InScopeNamespaces *fNSScope;
0158 unsigned int fNewNamespaceCount;
0159 MemoryManager* fMemoryManager;
0160 };
0161
0162
0163
0164 XERCES_CPP_NAMESPACE_END
0165
0166 #endif