You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2008/08/08 06:30:26 UTC
svn commit: r683844 [3/3] - in /xalan/c/trunk: Projects/Win32/VC8/
Projects/Win32/VC8/EntityResolver/ Projects/Win32/VC9/
Projects/Win32/VC9/EntityResolver/ samples/EntityResolver/
src/xalanc/XMLSupport/ src/xalanc/XSLT/ src/xalanc/XalanSourceTree/ src...
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp Thu Aug 7 21:30:24 2008
@@ -151,14 +151,15 @@
XalanDefaultParsedSource::XalanDefaultParsedSource(
- const InputSourceType& theInputSource,
+ const InputSource& theInputSource,
bool fValidate,
- ErrorHandlerType* theErrorHandler,
- EntityResolverType* theEntityResolver,
+ ErrorHandler* theErrorHandler,
+ EntityResolver* theEntityResolver,
+ XMLEntityResolver* theXMLEntityResolver,
const XalanDOMChar* theExternalSchemaLocation,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
bool fPoolAllTextNodes,
- MemoryManagerType& theManager) :
+ MemoryManager& theManager) :
XalanParsedSource(),
m_parserLiaison(theManager),
m_domSupport(m_parserLiaison),
@@ -167,6 +168,7 @@
{
m_parserLiaison.setUseValidation(fValidate);
m_parserLiaison.setEntityResolver(theEntityResolver);
+ m_parserLiaison.setXMLEntityResolver(theXMLEntityResolver);
m_parserLiaison.setErrorHandler(theErrorHandler);
m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
@@ -196,38 +198,45 @@
}
}
+
+
XalanDefaultParsedSource*
XalanDefaultParsedSource::create(
- MemoryManagerType& theManager,
- const InputSourceType& theInputSource,
+ MemoryManager& theManager,
+ const InputSource& theInputSource,
bool fValidate,
- ErrorHandlerType* theErrorHandler,
- EntityResolverType* theEntityResolver,
+ ErrorHandler* theErrorHandler,
+ EntityResolver* theEntityResolver,
+ XMLEntityResolver* theXMLEntityResolver,
const XalanDOMChar* theExternalSchemaLocation,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
bool fPoolAllTextNodes)
{
typedef XalanDefaultParsedSource ThisType;
- XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
-
- ThisType* theResult = theGuard.get();
-
- new (theResult) ThisType(
- theInputSource,
- fValidate,
- theErrorHandler,
- theEntityResolver,
- theExternalSchemaLocation,
- theExternalNoNamespaceSchemaLocation,
- fPoolAllTextNodes,
- theManager);
+ XalanAllocationGuard theGuard(
+ theManager,
+ theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult =
+ new (theGuard.get()) ThisType(
+ theInputSource,
+ fValidate,
+ theErrorHandler,
+ theEntityResolver,
+ theXMLEntityResolver,
+ theExternalSchemaLocation,
+ theExternalNoNamespaceSchemaLocation,
+ fPoolAllTextNodes,
+ theManager);
theGuard.release();
return theResult;
}
+
+
XalanDefaultParsedSource::~XalanDefaultParsedSource()
{
}
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp Thu Aug 7 21:30:24 2008
@@ -129,22 +129,24 @@
public:
XalanDefaultParsedSource(
- const InputSourceType& theInputSource,
+ const InputSource& theInputSource,
bool fValidate = false,
- ErrorHandlerType* theErrorHandler = 0,
- EntityResolverType* theEntityResolver = 0,
+ ErrorHandler* theErrorHandler = 0,
+ EntityResolver* theEntityResolver = 0,
+ XMLEntityResolver* theXMLEntityResolver = 0,
const XalanDOMChar* theExternalSchemaLocation = 0,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0,
bool fPoolAllTextNodes = XalanSourceTreeDocument::getPoolAllTextNodes(),
- MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+ MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
static XalanDefaultParsedSource*
create(
- MemoryManagerType& theManager,
- const InputSourceType& theInputSource,
+ MemoryManager& theManager,
+ const InputSource& theInputSource,
bool fValidate = false,
- ErrorHandlerType* theErrorHandler = 0,
- EntityResolverType* theEntityResolver = 0,
+ ErrorHandler* theErrorHandler = 0,
+ EntityResolver* theEntityResolver = 0,
+ XMLEntityResolver* theXMLEntityResolver = 0,
const XalanDOMChar* theExternalSchemaLocation = 0,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0,
bool fPoolAllTextNodes = XalanSourceTreeDocument::getPoolAllTextNodes());
@@ -156,7 +158,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper(MemoryManagerType& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR) const;
+ createHelper(MemoryManager& theManager) const;
virtual const XalanDOMString&
getURI() const;
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanParsedSource.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanParsedSource.hpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanParsedSource.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanParsedSource.hpp Thu Aug 7 21:30:24 2008
@@ -101,7 +101,7 @@
* @return A pointer to a XalanParsedSourceHelper instance.
*/
virtual XalanParsedSourceHelper*
- createHelper(MemoryManagerType& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR) const = 0;
+ createHelper(MemoryManager& theManager) const = 0;
/**
* Get the URI for the parsed source, if any.
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.cpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.cpp Thu Aug 7 21:30:24 2008
@@ -103,9 +103,11 @@
const XSLTInit* XalanTransformer::s_xsltInit = 0;
-static MemoryManagerType* s_initMemoryManager = 0;
+static MemoryManager* s_initMemoryManager = 0;
-XalanTransformer::XalanTransformer(MemoryManagerType& theManager):
+
+
+XalanTransformer::XalanTransformer(MemoryManager& theManager):
m_memoryManager(theManager),
m_compiledStylesheets(m_memoryManager),
m_parsedSources(m_memoryManager),
@@ -115,6 +117,7 @@
m_errorMessage(1, '\0', m_memoryManager),
m_useValidation(false),
m_entityResolver(0),
+ m_xmlEntityResolver(0),
m_errorHandler(0),
m_externalSchemaLocation(m_memoryManager),
m_externalNoNamespaceSchemaLocation(m_memoryManager),
@@ -181,7 +184,7 @@
void
-XalanTransformer::initialize(MemoryManagerType& theManager)
+XalanTransformer::initialize(MemoryManager& theManager)
{
// Initialize Xalan.
XalanMemMgrAutoPtr<XSLTInit, true> initGuard(theManager, XSLTInit::create(theManager));
@@ -227,20 +230,23 @@
#endif
}
+
+
#if defined(XALAN_USE_ICU)
void
-ICUStartUp(MemoryManagerType& theManager)
+ICUStartUp(MemoryManager& theManager)
{
ICUBridgeCleanup::startup(theManager);
}
#else
void
-ICUStartUp(MemoryManagerType& /*theManager*/)
+ICUStartUp(MemoryManager& /*theManager*/)
{
}
#endif
+
static void
addTraceListeners(
const XalanTransformer::TraceListenerVectorType& theTraceListeners,
@@ -548,6 +554,7 @@
XalanSourceTreeParserLiaison theParserLiaison(theDOMSupport, m_memoryManager);
theParserLiaison.setEntityResolver(m_entityResolver);
+ theParserLiaison.setXMLEntityResolver(m_xmlEntityResolver);
theParserLiaison.setErrorHandler(m_errorHandler);
// Hook the two together...
@@ -735,6 +742,7 @@
m_useValidation,
m_errorHandler,
m_entityResolver,
+ m_xmlEntityResolver,
getExternalSchemaLocation(),
getExternalNoNamespaceSchemaLocation());
}
@@ -747,6 +755,7 @@
m_useValidation,
m_errorHandler,
m_entityResolver,
+ m_xmlEntityResolver,
getExternalSchemaLocation(),
getExternalNoNamespaceSchemaLocation());
}
@@ -1170,6 +1179,7 @@
theParserLiaison.setExecutionContext(*m_stylesheetExecutionContext);
theParserLiaison.setEntityResolver(m_entityResolver);
+ theParserLiaison.setXMLEntityResolver(m_xmlEntityResolver);
theParserLiaison.setErrorHandler(m_errorHandler);
theParserLiaison.setUseValidation(m_useValidation);
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.hpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformer.hpp Thu Aug 7 21:30:24 2008
@@ -50,6 +50,7 @@
XALAN_DECLARE_XERCES_CLASS(EntityResolver)
XALAN_DECLARE_XERCES_CLASS(ErrorHandler)
+XALAN_DECLARE_XERCES_CLASS(XMLEntityResolver)
@@ -60,6 +61,10 @@
typedef XERCES_CPP_NAMESPACE_QUALIFIER EntityResolver EntityResolverType;
typedef XERCES_CPP_NAMESPACE_QUALIFIER ErrorHandler ErrorHandlerType;
+XALAN_USING_XERCES(EntityResolver)
+XALAN_USING_XERCES(ErrorHandler)
+XALAN_USING_XERCES(XMLEntityResolver)
+
class Function;
@@ -569,29 +574,63 @@
}
/**
- * This method returns the installed entity resolver.
+ * Returns the installed EntityResolver.
*
- * @return The pointer to the installed entity resolver object.
+ * @return The pointer to the installed EntityResolver.
*/
- EntityResolverType*
+ EntityResolver*
getEntityResolver() const
{
return m_entityResolver;
}
/**
- * This method installs the user-specified entity resolver.
- * It allows applications to trap and redirect calls to
- * external entities.
+ * Installs the supplied EntityResolver.
*
- * @param handler A pointer to the entity resolver to be called
- * when the parser comes across references to
- * entities in the XML file.
+ * A call to setEntityResolver with a non-null pointer will
+ * uninstall any XMLEntityResolver previously installed.
+ *
+ * @param theResolver A pointer to the EntityResolver.
*/
void
- setEntityResolver(EntityResolverType* theResolver)
+ setEntityResolver(EntityResolver* theResolver)
{
m_entityResolver = theResolver;
+
+ if (theResolver != 0 && m_xmlEntityResolver != 0)
+ {
+ m_xmlEntityResolver = 0;
+ }
+ }
+
+ /**
+ * Returns the installed XMLEntityResolver.
+ *
+ * @return The pointer to the installed XMLEntityResolver.
+ */
+ XMLEntityResolver*
+ getXMLEntityResolver() const
+ {
+ return m_xmlEntityResolver;
+ }
+
+ /**
+ * Installs the supplied XMLEntityResolver.
+ *
+ * A call to setXMLEntityResolver with a non-null pointer will
+ * uninstall any EntityResolver previously installed.
+ *
+ * @param theResolver A pointer to the XMLEntityResolver.
+ */
+ void
+ setXMLEntityResolver(XMLEntityResolver* theResolver)
+ {
+ m_xmlEntityResolver = theResolver;
+
+ if (theResolver != 0 && m_entityResolver != 0)
+ {
+ m_entityResolver = 0;
+ }
}
/**
@@ -599,7 +638,7 @@
*
* @return The pointer to the installed error handler object.
*/
- ErrorHandlerType*
+ ErrorHandler*
getErrorHandler() const
{
return m_errorHandler;
@@ -611,7 +650,7 @@
* @param handler A pointer to the error handler to be called upon error.
*/
void
- setErrorHandler(ErrorHandlerType* theErrorHandler)
+ setErrorHandler(ErrorHandler* theErrorHandler)
{
m_errorHandler = theErrorHandler;
}
@@ -918,8 +957,10 @@
const XalanParsedSource* const m_parsedSource;
};
- struct EnsureDestroyCompiledStylesheet
+ class EnsureDestroyCompiledStylesheet
{
+ public:
+
EnsureDestroyCompiledStylesheet(
XalanTransformer& theTransformer,
const XalanCompiledStylesheet* theCompiledStylesheet) :
@@ -1012,9 +1053,11 @@
bool m_useValidation;
- EntityResolverType* m_entityResolver;
+ EntityResolver* m_entityResolver;
+
+ XMLEntityResolver* m_xmlEntityResolver;
- ErrorHandlerType* m_errorHandler;
+ ErrorHandler* m_errorHandler;
XalanDOMString m_externalSchemaLocation;
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp Thu Aug 7 21:30:24 2008
@@ -79,13 +79,14 @@
XercesDOMParsedSource::XercesDOMParsedSource(
- const InputSourceType& theInputSource,
+ const InputSource& theInputSource,
bool fValidate,
- ErrorHandlerType* theErrorHandler,
- EntityResolverType* theEntityResolver,
+ ErrorHandler* theErrorHandler,
+ EntityResolver* theEntityResolver,
+ XMLEntityResolver* theXMLEntityResolver,
const XalanDOMChar* theExternalSchemaLocation,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
- MemoryManagerType& theManager) :
+ MemoryManager& theManager) :
XalanParsedSource(),
m_parserLiaison(theManager),
m_parsedSource(0),
@@ -93,6 +94,7 @@
{
m_parserLiaison.setUseValidation(fValidate);
m_parserLiaison.setEntityResolver(theEntityResolver);
+ m_parserLiaison.setXMLEntityResolver(theXMLEntityResolver);
m_parserLiaison.setErrorHandler(theErrorHandler);
m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
@@ -119,38 +121,44 @@
}
}
+
+
XercesDOMParsedSource*
XercesDOMParsedSource::create(
- MemoryManagerType& theManager,
- const InputSourceType& theInputSource,
+ MemoryManager& theManager,
+ const InputSource& theInputSource,
bool fValidate,
- ErrorHandlerType* theErrorHandler,
- EntityResolverType* theEntityResolver,
+ ErrorHandler* theErrorHandler,
+ EntityResolver* theEntityResolver,
+ XMLEntityResolver* theXMLEntityResolver,
const XalanDOMChar* theExternalSchemaLocation,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation)
{
typedef XercesDOMParsedSource ThisType;
- XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
-
- ThisType* theResult = theGuard.get();
+ XalanAllocationGuard theGuard(
+ theManager,
+ theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult =
+ new (theGuard.get()) ThisType(
+ theInputSource,
+ fValidate,
+ theErrorHandler,
+ theEntityResolver,
+ theXMLEntityResolver,
+ theExternalSchemaLocation,
+ theExternalNoNamespaceSchemaLocation,
+ theManager);
- new (theResult) ThisType(
- theInputSource,
- fValidate,
- theErrorHandler,
- theEntityResolver,
- theExternalSchemaLocation,
- theExternalNoNamespaceSchemaLocation,
- theManager);
-
- theGuard.release();
+ theGuard.release();
return theResult;
}
+
XercesDOMParsedSource::~XercesDOMParsedSource()
{
}
Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp Thu Aug 7 21:30:24 2008
@@ -76,21 +76,23 @@
public:
XercesDOMParsedSource(
- const InputSourceType& theInputSource,
+ const InputSource& theInputSource,
bool fValidate = false,
- ErrorHandlerType* theErrorHandler = 0,
- EntityResolverType* theEntityResolver = 0,
+ ErrorHandler* theErrorHandler = 0,
+ EntityResolver* theEntityResolver = 0,
+ XMLEntityResolver* theXMLEntityResolver = 0,
const XalanDOMChar* theExternalSchemaLocation = 0,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0,
- MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+ MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
static XercesDOMParsedSource*
create(
- MemoryManagerType& theManager,
- const InputSourceType& theInputSource,
+ MemoryManager& theManager,
+ const InputSource& theInputSource,
bool fValidate = false,
- ErrorHandlerType* theErrorHandler = 0,
- EntityResolverType* theEntityResolver = 0,
+ ErrorHandler* theErrorHandler = 0,
+ EntityResolver* theEntityResolver = 0,
+ XMLEntityResolver* theXMLEntityResolver = 0,
const XalanDOMChar* theExternalSchemaLocation = 0,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0);
@@ -101,7 +103,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper(MemoryManagerType& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMMGR) const;
+ createHelper(MemoryManager& theManager) const;
virtual const XalanDOMString&
getURI() const;
Modified: xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp (original)
+++ xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp Thu Aug 7 21:30:24 2008
@@ -29,11 +29,7 @@
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/framework/URLInputSource.hpp>
-#if XERCES_VERSION_MAJOR >= 2
#include <xercesc/parsers/XercesDOMParser.hpp>
-#else
-#include <xercesc/parsers/DOMParser.hpp>
-#endif
#include <xercesc/parsers/SAXParser.hpp>
#include <xercesc/sax/SAXParseException.hpp>
@@ -67,13 +63,16 @@
XALAN_CPP_NAMESPACE_BEGIN
-XercesParserLiaison::XercesParserLiaison( XercesDOMSupport& /* theSupport */, MemoryManagerType& theManager) :
+XercesParserLiaison::XercesParserLiaison(
+ XercesDOMSupport& /* theSupport */,
+ MemoryManager& theManager) :
m_indent(-1),
m_useValidation(false),
m_includeIgnorableWhitespace(true),
m_doNamespaces(true),
m_exitOnFirstFatalError(true),
m_entityResolver(0),
+ m_xmlEntityResolver(0),
m_errorHandler(this),
m_externalSchemaLocation(theManager),
m_externalNoNamespaceSchemaLocation(theManager),
@@ -83,20 +82,20 @@
m_threadSafe(false),
m_buildMaps(false),
m_executionContext(0),
- m_saxParser(0),
m_domParser(0)
{
}
-XercesParserLiaison::XercesParserLiaison(MemoryManagerType& theManager) :
+XercesParserLiaison::XercesParserLiaison(MemoryManager& theManager) :
m_indent(-1),
m_useValidation(false),
m_includeIgnorableWhitespace(true),
m_doNamespaces(true),
m_exitOnFirstFatalError(true),
m_entityResolver(0),
+ m_xmlEntityResolver(0),
m_errorHandler(this),
m_externalSchemaLocation(theManager),
m_externalNoNamespaceSchemaLocation(theManager),
@@ -106,7 +105,6 @@
m_threadSafe(false),
m_buildMaps(false),
m_executionContext(0),
- m_saxParser(0),
m_domParser(0)
{
}
@@ -117,8 +115,6 @@
{
reset();
- delete m_saxParser;
-
delete m_domParser;
}
@@ -173,26 +169,6 @@
void
-XercesParserLiaison::ensureSAXParser()
-{
- if (m_saxParser == 0)
- {
- m_saxParser = createSAXParser();
- }
-
- m_saxParser->setExitOnFirstFatalError(m_exitOnFirstFatalError);
-
- if (m_entityResolver != 0)
- {
- m_saxParser->setEntityResolver(m_entityResolver);
- }
-
- m_saxParser->setErrorHandler(m_errorHandler);
-}
-
-
-
-void
XercesParserLiaison::ensureDOMParser()
{
if (m_domParser == 0)
@@ -212,6 +188,10 @@
{
m_domParser->setEntityResolver(m_entityResolver);
}
+ else
+ {
+ m_domParser->setXMLEntityResolver(m_xmlEntityResolver);
+ }
m_domParser->setErrorHandler(m_errorHandler);
@@ -230,73 +210,53 @@
void
XercesParserLiaison::parseXMLStream(
- const InputSourceType& urlInputSource,
- DocumentHandlerType& handler,
+ const InputSource& inputSource,
+ DocumentHandler& handler,
const XalanDOMString& /* identifier */)
{
XalanAutoPtr<SAXParserType> theParser(createSAXParser());
- theParser->setDocumentHandler(&handler);
+ theParser->setExitOnFirstFatalError(m_exitOnFirstFatalError);
- if (m_errorHandler == 0)
+ if (m_entityResolver != 0)
{
- theParser->setErrorHandler(this);
+ theParser->setEntityResolver(m_entityResolver);
}
else
{
- theParser->setErrorHandler(m_errorHandler);
+ theParser->setXMLEntityResolver(m_xmlEntityResolver);
}
- theParser->parse(urlInputSource);
+ theParser->setErrorHandler(m_errorHandler);
+
+ theParser->setDocumentHandler(&handler);
+
+ theParser->parse(inputSource);
}
XalanDocument*
XercesParserLiaison::parseXMLStream(
- const InputSourceType& reader,
+ const InputSource& inputSource,
const XalanDOMString& /* identifier */)
{
- XalanAutoPtr<DOMParserType> theParser(createDOMParser());
+ ensureDOMParser();
- if (m_errorHandler == 0)
- {
- theParser->setErrorHandler(this);
- }
- else
- {
- theParser->setErrorHandler(m_errorHandler);
- }
+ m_domParser->parse(inputSource);
- theParser->parse(reader);
-
-#if XERCES_VERSION_MAJOR >= 2
DOMDocument_Type* const theXercesDocument =
- theParser->getDocument();
+ m_domParser->getDocument();
theXercesDocument->normalize();
-#else
- DOM_Document_Type theXercesDocument =
- theParser->getDocument();
- theXercesDocument.normalize();
-#endif
-
-#if XERCES_VERSION_MAJOR >= 2
XercesDocumentWrapper* theNewDocument = 0;
if (theXercesDocument != 0)
{
theNewDocument = doCreateDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps, true);
- theParser->adoptDocument();
-#else
- XercesDocumentBridge* theNewDocument = 0;
-
- if (theXercesDocument.isNull() == false)
- {
- theNewDocument = doCreateDocument(theXercesDocument, m_threadSafe, m_buildBridge, true);
-#endif
+ m_domParser->adoptDocument();
}
return theNewDocument;
@@ -362,6 +322,7 @@
}
+
DOMDocument_Type*
XercesParserLiaison::createDOMFactory()
{
@@ -409,7 +370,7 @@
-ErrorHandlerType*
+ErrorHandler*
XercesParserLiaison::getErrorHandler() const
{
return m_errorHandler;
@@ -418,9 +379,16 @@
void
-XercesParserLiaison::setErrorHandler(ErrorHandlerType* handler)
+XercesParserLiaison::setErrorHandler(ErrorHandler* handler)
{
- m_errorHandler = handler;
+ if (handler == 0)
+ {
+ m_errorHandler = this;
+ }
+ else
+ {
+ m_errorHandler = handler;
+ }
}
@@ -457,7 +425,7 @@
-EntityResolverType*
+EntityResolver*
XercesParserLiaison::getEntityResolver() const
{
return m_entityResolver;
@@ -466,13 +434,29 @@
void
-XercesParserLiaison::setEntityResolver(EntityResolverType* resolver)
+XercesParserLiaison::setEntityResolver(EntityResolver* resolver)
{
m_entityResolver = resolver;
}
+XMLEntityResolver*
+XercesParserLiaison::getXMLEntityResolver() const
+{
+ return m_xmlEntityResolver;
+}
+
+
+
+void
+XercesParserLiaison::setXMLEntityResolver(XMLEntityResolver* resolver)
+{
+ m_xmlEntityResolver = resolver;
+}
+
+
+
const XalanDOMChar*
XercesParserLiaison::getExternalSchemaLocation() const
{
@@ -732,7 +716,6 @@
#endif
theParser->setDoNamespaces(m_doNamespaces);
- theParser->setEntityResolver(m_entityResolver);
return theParser;
}
Modified: xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.hpp?rev=683844&r1=683843&r2=683844&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.hpp (original)
+++ xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.hpp Thu Aug 7 21:30:24 2008
@@ -71,7 +71,7 @@
class XALAN_XERCESPARSERLIAISON_EXPORT XercesParserLiaison :
public XMLParserLiaison,
- public ErrorHandlerType
+ public ErrorHandler
{
public:
@@ -85,12 +85,14 @@
*
* @deprecated This constructor is deprecated. Use the next constructor instead.
*/
- XercesParserLiaison( XercesDOMSupport& theSupport, MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+ XercesParserLiaison(
+ XercesDOMSupport& theSupport,
+ MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
/**
* Construct a XercesParserLiaison instance.
*/
- XercesParserLiaison(MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+ XercesParserLiaison(MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
virtual
~XercesParserLiaison();
@@ -98,7 +100,7 @@
// These interfaces are inherited from XMLParserLiaison...
- MemoryManagerType&
+ MemoryManager&
getMemoryManager()
{
return m_externalSchemaLocation.getMemoryManager();
@@ -115,13 +117,13 @@
virtual XalanDocument*
parseXMLStream(
- const InputSourceType& reader,
+ const InputSource& reader,
const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
virtual void
parseXMLStream(
- const InputSourceType& urlInputSource,
- DocumentHandlerType& handler,
+ const InputSource& urlInputSource,
+ DocumentHandler& handler,
const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
virtual void
@@ -140,14 +142,25 @@
setUseValidation(bool b);
virtual const XalanDOMString&
- getParserDescription(XalanDOMString& theResult) const;
+ getParserDescription(XalanDOMString& theResult) const;
- virtual EntityResolverType*
+ virtual EntityResolver*
getEntityResolver() const;
virtual void
- setEntityResolver(EntityResolverType* resolver);
+ setEntityResolver(EntityResolver* resolver);
+ virtual XMLEntityResolver*
+ getXMLEntityResolver() const;
+
+ virtual void
+ setXMLEntityResolver(XMLEntityResolver* resolver);
+
+ virtual ErrorHandler*
+ getErrorHandler() const;
+
+ virtual void
+ setErrorHandler(ErrorHandler* handler);
// These interfaces are new to XercesParserLiaison...
@@ -206,25 +219,6 @@
setIncludeIgnorableWhitespace(bool include);
/**
- * This method returns the installed error handler.
- *
- * @return A pointer to the installed error handler object.
- */
- virtual ErrorHandlerType*
- getErrorHandler() const;
-
- /**
- * This method installs the user specified error handler on
- * the parser.
- *
- * @param handler A pointer to the error handler to be called
- * when the parser comes across 'error' events
- * as per the SAX specification.
- */
- virtual void
- setErrorHandler(ErrorHandlerType* handler);
-
- /**
* This method returns the state of the parser's namespace
* handling capability.
*
@@ -730,9 +724,6 @@
private:
void
- ensureSAXParser();
-
- void
ensureDOMParser();
DOMParserType*
@@ -754,9 +745,11 @@
bool m_exitOnFirstFatalError;
- EntityResolverType* m_entityResolver;
+ EntityResolver* m_entityResolver;
- ErrorHandlerType* m_errorHandler;
+ XMLEntityResolver* m_xmlEntityResolver;
+
+ ErrorHandler* m_errorHandler;
XalanDOMString m_externalSchemaLocation;
@@ -774,8 +767,6 @@
ExecutionContext* m_executionContext;
- SAXParserType* m_saxParser;
-
DOMParserType* m_domParser;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org