Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XercesParserLiaison.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XercesPARSERLIAISON_HEADER_GUARD_1357924680)
17 #define XercesPARSERLIAISON_HEADER_GUARD_1357924680
18 
19 
20 // Base include file. Must be first.
22 
23 
24 
25 // Standard Library header files.
27 
28 
29 
30 // Xerces DOM header files
31 #include <xercesc/sax/ErrorHandler.hpp>
32 
33 
34 
35 // Base class header file.
37 
38 
39 
40 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
42 #endif
44 
45 
46 
47 #if XERCES_VERSION_MAJOR >= 2
48 XALAN_DECLARE_XERCES_CLASS(XercesDOMParser)
49 #else
50 XALAN_DECLARE_XERCES_CLASS(DOMParser)
51 #endif
52 XALAN_DECLARE_XERCES_CLASS(SAXParser)
53 
54 
55 
56 XALAN_CPP_NAMESPACE_BEGIN
57 
58 
59 
60 class XercesDOMSupport;
61 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
63 #endif
65 
66 
67 typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException SAXParseExceptionType;
68 
69 
71  public XMLParserLiaison,
72  public ErrorHandlerType
73 {
74 
75 public:
76 
77  typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParser SAXParserType;
78 
86  XercesParserLiaison( XercesDOMSupport& theSupport, MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
87 
92 
93  virtual
95 
96 
97 
98  // These interfaces are inherited from XMLParserLiaison...
101  {
102  return m_externalSchemaLocation.getMemoryManager();
103  }
104 
105  virtual void
106  reset();
107 
108  virtual ExecutionContext*
109  getExecutionContext() const;
110 
111  virtual void
113 
114  virtual XalanDocument*
116  const InputSourceType& reader,
118 
119  virtual void
121  const InputSourceType& urlInputSource,
122  DocumentHandlerType& handler,
124 
125  virtual void
126  destroyDocument(XalanDocument* theDocument);
127 
128  virtual int
129  getIndent() const;
130 
131  virtual void
132  setIndent(int i);
133 
134  virtual bool
135  getUseValidation() const;
136 
137  virtual void
138  setUseValidation(bool b);
139 
140  virtual const XalanDOMString&
141  getParserDescription(XalanDOMString& theResult) const;
142 
143  virtual EntityResolverType*
144  getEntityResolver() const;
145 
146  virtual void
148 
149 
150  // These interfaces are new to XercesParserLiaison...
151 
161  virtual DOMDocument_Type*
162  createDOMFactory();
163 
169  virtual void
170  destroyDocument(DOMDocument_Type* theDocument);
171 
182  virtual bool
183  getIncludeIgnorableWhitespace() const;
184 
203  virtual void
204  setIncludeIgnorableWhitespace(bool include);
205 
211  virtual ErrorHandlerType*
212  getErrorHandler() const;
213 
222  virtual void
224 
234  virtual bool
235  getDoNamespaces() const;
236 
254  virtual void
255  setDoNamespaces(bool newState);
256 
266  virtual bool
267  getExitOnFirstFatalError() const;
268 
284  virtual void
285  setExitOnFirstFatalError(bool newState);
286 
293  virtual const XalanDOMChar*
294  getExternalSchemaLocation() const;
295 
302  virtual void
303  setExternalSchemaLocation(const XalanDOMChar* location);
304 
311  virtual const XalanDOMChar*
312  getExternalNoNamespaceSchemaLocation() const;
313 
320  virtual void
321  setExternalNoNamespaceSchemaLocation(const XalanDOMChar* location);
322 
323 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
324 
337  createDocument(const DOM_Document_Type& theXercesDocument)
338  {
339  return createDocument(theXercesDocument, m_threadSafe, m_buildBridge);
340  }
341 
357  createDocument(
358  const DOM_Document_Type& theXercesDocument,
359  bool threadSafe,
360  bool buildBridge);
361 #endif
362 
373  createDocument(const DOMDocument_Type* theXercesDocument)
374  {
375  return createDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps);
376  }
377 
391  createDocument(
392  const DOMDocument_Type* theXercesDocument,
393  bool threadSafe,
394  bool buildWrapper,
395  bool buildMaps = false);
396 
397 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
398 
411  mapDocument(const XalanDocument* theDocument) const;
412 #endif
413 
424  mapDocumentToWrapper(const XalanDocument* theDocument) const;
425 
426 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
427 
440  mapXercesDocument(const XalanDocument* theDocument) const;
441 #endif
442 
452  const DOMDocument_Type*
453  mapToXercesDocument(const XalanDocument* theDocument) const;
454 
455  // Implementations for SAX ErrorHandler
456 
457  virtual void
458  warning(const SAXParseExceptionType& exception);
459 
460  virtual void
461  error(const SAXParseExceptionType& exception);
462 
463  virtual void
464  fatalError(const SAXParseExceptionType& exception);
465 
466  virtual void
467  resetErrors();
468 
470  {
471 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
472  bool m_isDeprecated;
473 
474  bool
475  isDeprecated() const
476  {
477  return m_isDeprecated;
478  }
479 #else
480  bool
481  isDeprecated() const
482  {
483  return false;
484  }
485 #endif
486 
487  bool m_isOwned;
488 
489  bool
490  isOwned() const
491  {
492  return m_isOwned;
493  }
494 
495 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
496  union
497  {
498  XercesDocumentBridge* m_bridge;
499  XercesDocumentWrapper* m_wrapper;
500  };
501 
502  DocumentEntry&
503  operator=(XercesDocumentBridge* theBridge)
504  {
505  m_isDeprecated = true;
506 
507  m_bridge = theBridge;
508 
509  m_isOwned = true;
510 
511  return *this;
512  }
513 
514  DocumentEntry&
515  operator=(XercesDocumentWrapper* theWrapper)
516  {
517  m_isDeprecated = false;
518 
519  m_wrapper = theWrapper;
520 
521  m_isOwned = true;
522 
523  return *this;
524  }
525 #else
527 
530  {
531  m_wrapper = theWrapper;
532 
533  m_isOwned = true;
534 
535  return *this;
536  }
537 #endif
538  };
539 
541 
550  bool
552 
553  {
554  return m_buildBridge;
555  }
556 
569  void
570  setBuildBridgeNodes(bool newState)
571  {
572  m_buildBridge = newState;
573 
574  if (newState == false)
575  {
576  m_threadSafe = false;
577  }
578  }
579 
585  bool
587 
588  {
589  return m_buildWrapper;
590  }
591 
601  void
602  setBuildWrapperNodes(bool newState)
603  {
604  m_buildWrapper = newState;
605 
606  if (newState == false)
607  {
608  m_threadSafe = false;
609  }
610  }
611 
621  bool
623 
624  {
625  return m_threadSafe;
626  }
627 
637  void
638  setThreadSafe(bool newState)
639  {
640  m_threadSafe = newState;
641 
642  if (m_threadSafe == true)
643  {
644  m_buildWrapper = true;
645  m_buildBridge = true;
646  }
647  }
648 
656  bool
657  getBuildMaps() const
658 
659  {
660  return m_buildMaps;
661  }
662 
674  void
675  setBuildMaps(bool newState)
676  {
677  m_buildMaps = newState;
678  }
679 
680 #if XERCES_VERSION_MAJOR >= 2
681  typedef XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser DOMParserType;
682 #else
683  typedef XERCES_CPP_NAMESPACE_QUALIFIER DOMParser DOMParserType;
684 #endif
685 
686 protected:
687 
688  static void
689  formatErrorMessage(
690  const SAXParseExceptionType& e,
691  XalanDOMString& theMessage);
692 
693 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
694 
705  doCreateDocument(
706  const DOM_Document_Type& theXercesDocument,
707  bool threadSafe,
708  bool buildBridge);
709 #endif
710 
721  doCreateDocument(
722  const DOMDocument_Type* theXercesDocument,
723  bool threadSafe,
724  bool buildWrapper,
725  bool buildMaps,
726  bool isOwned);
727 
728 private:
729 
730  void
731  ensureSAXParser();
732 
733  void
734  ensureDOMParser();
735 
737  createDOMParser();
738 
740  createSAXParser();
741 
742 
743 
744  // Data members...
745  int m_indent;
746 
747  bool m_useValidation;
748 
749  bool m_includeIgnorableWhitespace;
750 
751  bool m_doNamespaces;
752 
753  bool m_exitOnFirstFatalError;
754 
755  EntityResolverType* m_entityResolver;
756 
757  ErrorHandlerType* m_errorHandler;
758 
759  XalanDOMString m_externalSchemaLocation;
760 
761  XalanDOMString m_externalNoNamespaceSchemaLocation;
762 
763  DocumentMapType m_documentMap;
764 
765  bool m_buildWrapper;
766 
767  bool m_buildBridge;
768 
769  bool m_threadSafe;
770 
771  bool m_buildMaps;
772 
773  ExecutionContext* m_executionContext;
774 
775  SAXParserType* m_saxParser;
776 
777  DOMParserType* m_domParser;
778 };
779 
780 
781 
782 XALAN_CPP_NAMESPACE_END
783 
784 
785 
786 #endif // XercesPARSERLIAISON_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo