xml-xalan-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/src/xalanc/XalanTransformer XalanDefaultParsedSource.cpp XalanDefaultParsedSource.hpp XalanTransformer.cpp XalanTransformer.hpp
Date Thu, 28 Oct 2004 19:40:06 GMT
dbertoni    2004/10/28 12:40:06

  Modified:    c/src/xalanc/XalanTransformer XalanDefaultParsedSource.cpp
                        XalanDefaultParsedSource.hpp XalanTransformer.cpp
                        XalanTransformer.hpp
  Log:
  Provide an option to pool all text node strings.
  
  Revision  Changes    Path
  1.5       +78 -76    xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp
  
  Index: XalanDefaultParsedSource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XalanDefaultParsedSource.cpp	26 Feb 2004 23:07:13 -0000	1.4
  +++ XalanDefaultParsedSource.cpp	28 Oct 2004 19:40:06 -0000	1.5
  @@ -42,10 +42,10 @@
   
   
   XalanDefaultParsedSourceDOMSupport::XalanDefaultParsedSourceDOMSupport(
  -			const XalanSourceTreeParserLiaison&		theParserLiaison,
  -			const XalanSourceTreeDOMSupport&		theDOMSupport) :
  -	XalanSourceTreeDOMSupport(theParserLiaison),
  -	m_domSupport(theDOMSupport)
  +            const XalanSourceTreeParserLiaison&     theParserLiaison,
  +            const XalanSourceTreeDOMSupport&        theDOMSupport) :
  +    XalanSourceTreeDOMSupport(theParserLiaison),
  +    m_domSupport(theDOMSupport)
   {
   }
   
  @@ -66,45 +66,45 @@
   
   const XalanDOMString&
   XalanDefaultParsedSourceDOMSupport::getUnparsedEntityURI(
  -			const XalanDOMString&	theName,
  -			const XalanDocument&	theDocument) const
  +            const XalanDOMString&   theName,
  +            const XalanDocument&    theDocument) const
   {
  -	// Check the wrapped XalanSourceTreeDOMSupport instance...
  -	const XalanDOMString&	theURI =
  -			m_domSupport.getUnparsedEntityURI(
  -					theName,
  -					theDocument);
  -
  -	if (length(theURI) != 0)
  -	{
  -		return theURI;
  -	}
  -	else
  -	{
  -		// Chain up to our parent...
  -		return XalanSourceTreeDOMSupport::getUnparsedEntityURI(
  -					theName,
  -					theDocument);
  -	}
  +    // Check the wrapped XalanSourceTreeDOMSupport instance...
  +    const XalanDOMString&   theURI =
  +            m_domSupport.getUnparsedEntityURI(
  +                    theName,
  +                    theDocument);
  +
  +    if (length(theURI) != 0)
  +    {
  +        return theURI;
  +    }
  +    else
  +    {
  +        // Chain up to our parent...
  +        return XalanSourceTreeDOMSupport::getUnparsedEntityURI(
  +                    theName,
  +                    theDocument);
  +    }
   }
   
   
   
   bool
   XalanDefaultParsedSourceDOMSupport::isNodeAfter(
  -			const XalanNode&	node1,
  -			const XalanNode&	node2) const
  +            const XalanNode&    node1,
  +            const XalanNode&    node2) const
   {
  -	return m_domSupport.isNodeAfter(
  -					node1, 
  -					node2);
  +    return m_domSupport.isNodeAfter(
  +                    node1, 
  +                    node2);
   }
   
   
   
  -XalanDefaultParsedSourceHelper::XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport&
	theSourceDOMSupport) :
  -	m_parserLiaison(),
  -	m_domSupport(m_parserLiaison, theSourceDOMSupport)
  +XalanDefaultParsedSourceHelper::XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport&
    theSourceDOMSupport) :
  +    m_parserLiaison(),
  +    m_domSupport(m_parserLiaison, theSourceDOMSupport)
   {
   }
   
  @@ -119,7 +119,7 @@
   DOMSupport&
   XalanDefaultParsedSourceHelper::getDOMSupport()
   {
  -	return m_domSupport;
  +    return m_domSupport;
   }
   
   
  @@ -127,51 +127,53 @@
   XMLParserLiaison&
   XalanDefaultParsedSourceHelper::getParserLiaison()
   {
  -	return m_parserLiaison;
  +    return m_parserLiaison;
   }
   
   
   
   XalanDefaultParsedSource::XalanDefaultParsedSource(
  -			const InputSourceType&	theInputSource,
  -			bool					fValidate,
  -			ErrorHandlerType*		theErrorHandler,
  -			EntityResolverType*		theEntityResolver,
  -			const XalanDOMChar*		theExternalSchemaLocation,
  -			const XalanDOMChar*		theExternalNoNamespaceSchemaLocation) :
  -	XalanParsedSource(),
  -	m_parserLiaison(),
  -	m_domSupport(m_parserLiaison),
  -	m_parsedSource(0)
  -{
  -	m_parserLiaison.setUseValidation(fValidate);
  -	m_parserLiaison.setEntityResolver(theEntityResolver);
  -	m_parserLiaison.setErrorHandler(theErrorHandler);
  -	m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
  -	m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
  -
  -	m_parsedSource = m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource));
  -	assert(m_parsedSource != 0);
  -
  -	m_domSupport.setParserLiaison(&m_parserLiaison);
  -
  -	const XalanDOMChar* const	theSystemID = theInputSource.getSystemId();
  -
  -	if (theSystemID != 0)
  -	{
  -		try
  -		{
  -			m_uri = URISupport::getURLStringFromString(theSystemID);
  -		}
  -		catch(const XERCES_CPP_NAMESPACE_QUALIFIER XMLException&)
  -		{
  -			// Assume that any exception here relates to get the url from
  -			// the system ID.  We'll assume that it's just a fake base identifier
  -			// since the parser would have thrown an error if the system ID
  -			// wasn't resolved.
  -			m_uri = theSystemID;
  -		}
  -	}
  +            const InputSourceType&  theInputSource,
  +            bool                    fValidate,
  +            ErrorHandlerType*       theErrorHandler,
  +            EntityResolverType*     theEntityResolver,
  +            const XalanDOMChar*     theExternalSchemaLocation,
  +            const XalanDOMChar*     theExternalNoNamespaceSchemaLocation,
  +            bool                    fPoolAllTextNodes) :
  +    XalanParsedSource(),
  +    m_parserLiaison(),
  +    m_domSupport(m_parserLiaison),
  +    m_parsedSource(0)
  +{
  +    m_parserLiaison.setUseValidation(fValidate);
  +    m_parserLiaison.setEntityResolver(theEntityResolver);
  +    m_parserLiaison.setErrorHandler(theErrorHandler);
  +    m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
  +    m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
  +    m_parserLiaison.setPoolAllText(fPoolAllTextNodes);
  +
  +    m_parsedSource = m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource));
  +    assert(m_parsedSource != 0);
  +
  +    m_domSupport.setParserLiaison(&m_parserLiaison);
  +
  +    const XalanDOMChar* const   theSystemID = theInputSource.getSystemId();
  +
  +    if (theSystemID != 0)
  +    {
  +        try
  +        {
  +            m_uri = URISupport::getURLStringFromString(theSystemID);
  +        }
  +        catch(const XERCES_CPP_NAMESPACE_QUALIFIER XMLException&)
  +        {
  +            // Assume that any exception here relates to get the url from
  +            // the system ID.  We'll assume that it's just a fake base identifier
  +            // since the parser would have thrown an error if the system ID
  +            // wasn't resolved.
  +            m_uri = theSystemID;
  +        }
  +    }
   }
   
   
  @@ -182,10 +184,10 @@
   
   
   
  -XalanDocument*	
  +XalanDocument*  
   XalanDefaultParsedSource::getDocument() const
   {
  -	return m_parsedSource;
  +    return m_parsedSource;
   }
   
   
  @@ -193,7 +195,7 @@
   XalanParsedSourceHelper*
   XalanDefaultParsedSource::createHelper() const
   {
  -	return new XalanDefaultParsedSourceHelper(m_domSupport);
  +    return new XalanDefaultParsedSourceHelper(m_domSupport);
   }
   
   
  @@ -201,7 +203,7 @@
   const XalanDOMString&
   XalanDefaultParsedSource::getURI() const
   {
  -	return m_uri;
  +    return m_uri;
   }
   
   
  
  
  
  1.5       +68 -67    xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp
  
  Index: XalanDefaultParsedSource.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XalanDefaultParsedSource.hpp	26 Feb 2004 23:07:13 -0000	1.4
  +++ XalanDefaultParsedSource.hpp	28 Oct 2004 19:40:06 -0000	1.5
  @@ -23,6 +23,7 @@
   
   
   
  +#include <xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp>
   #include <xalanc/XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
   #include <xalanc/XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
   
  @@ -37,7 +38,6 @@
   
   
   class XSLTInputSource;
  -class XalanSourceTreeDocument;
   
   
   
  @@ -45,39 +45,39 @@
   {
   public:
   
  -	XalanDefaultParsedSourceDOMSupport(
  -			const XalanSourceTreeParserLiaison&		theParserLiaison,
  -			const XalanSourceTreeDOMSupport&		theDOMSupport);
  -
  -	virtual
  -	~XalanDefaultParsedSourceDOMSupport();
  -
  -	virtual void
  -	reset();
  -
  -	// These interfaces are inherited from DOMSupport...
  -
  -	virtual const XalanDOMString&
  -	getUnparsedEntityURI(
  -			const XalanDOMString&	theName,
  -			const XalanDocument&	theDocument) const;
  -
  -	virtual bool
  -	isNodeAfter(
  -			const XalanNode&	node1,
  -			const XalanNode&	node2) const;
  +    XalanDefaultParsedSourceDOMSupport(
  +            const XalanSourceTreeParserLiaison&     theParserLiaison,
  +            const XalanSourceTreeDOMSupport&        theDOMSupport);
  +
  +    virtual
  +    ~XalanDefaultParsedSourceDOMSupport();
  +
  +    virtual void
  +    reset();
  +
  +    // These interfaces are inherited from DOMSupport...
  +
  +    virtual const XalanDOMString&
  +    getUnparsedEntityURI(
  +            const XalanDOMString&   theName,
  +            const XalanDocument&    theDocument) const;
  +
  +    virtual bool
  +    isNodeAfter(
  +            const XalanNode&    node1,
  +            const XalanNode&    node2) const;
   
   private:
   
  -	// Not implemented...
  -	XalanDefaultParsedSourceDOMSupport(const XalanDefaultParsedSourceDOMSupport&);
  +    // Not implemented...
  +    XalanDefaultParsedSourceDOMSupport(const XalanDefaultParsedSourceDOMSupport&);
   
  -	XalanDefaultParsedSourceDOMSupport&
  -	operator=(const XalanDefaultParsedSourceDOMSupport&);
  +    XalanDefaultParsedSourceDOMSupport&
  +    operator=(const XalanDefaultParsedSourceDOMSupport&);
   
   
  -	// Data members...
  -	const XalanSourceTreeDOMSupport&	m_domSupport;
  +    // Data members...
  +    const XalanSourceTreeDOMSupport&    m_domSupport;
   };
   
   
  @@ -86,29 +86,29 @@
   {
   public:
   
  -	XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport&		theSourceDOMSupport);
  +    XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport&     theSourceDOMSupport);
   
  -	~XalanDefaultParsedSourceHelper();
  +    ~XalanDefaultParsedSourceHelper();
   
  -	virtual DOMSupport&
  -	getDOMSupport();
  +    virtual DOMSupport&
  +    getDOMSupport();
   
  -	virtual XMLParserLiaison&
  -	getParserLiaison();
  +    virtual XMLParserLiaison&
  +    getParserLiaison();
   
   private:
   
  -	// Not implemented...
  -	XalanDefaultParsedSourceHelper(const XalanDefaultParsedSourceHelper&);
  +    // Not implemented...
  +    XalanDefaultParsedSourceHelper(const XalanDefaultParsedSourceHelper&);
   
  -	XalanDefaultParsedSourceHelper&
  -	operator=(const XalanDefaultParsedSourceHelper&);
  +    XalanDefaultParsedSourceHelper&
  +    operator=(const XalanDefaultParsedSourceHelper&);
   
   
  -	// Data members...
  -	XalanSourceTreeParserLiaison		m_parserLiaison;
  +    // Data members...
  +    XalanSourceTreeParserLiaison        m_parserLiaison;
   
  -	XalanDefaultParsedSourceDOMSupport	m_domSupport;
  +    XalanDefaultParsedSourceDOMSupport  m_domSupport;
   };
   
   
  @@ -121,43 +121,44 @@
   {
   public:
   
  -	XalanDefaultParsedSource(
  -			const InputSourceType&	theInputSource,
  -			bool					fValidate = false,
  -			ErrorHandlerType*		theErrorHandler = 0,
  -			EntityResolverType*		theEntityResolver = 0,
  -			const XalanDOMChar*		theExternalSchemaLocation = 0,
  -			const XalanDOMChar*		theExternalNoNamespaceSchemaLocation = 0);
  -
  -	virtual
  -	~XalanDefaultParsedSource();
  +    XalanDefaultParsedSource(
  +            const InputSourceType&  theInputSource,
  +            bool                    fValidate = false,
  +            ErrorHandlerType*       theErrorHandler = 0,
  +            EntityResolverType*     theEntityResolver = 0,
  +            const XalanDOMChar*     theExternalSchemaLocation = 0,
  +            const XalanDOMChar*     theExternalNoNamespaceSchemaLocation = 0,
  +            bool                    fPoolAllTextNodes = XalanSourceTreeDocument::getPoolAllTextNodes());
  +
  +    virtual
  +    ~XalanDefaultParsedSource();
   
  -	virtual XalanDocument*
  -	getDocument() const;
  +    virtual XalanDocument*
  +    getDocument() const;
   
  -	virtual XalanParsedSourceHelper*
  -	createHelper() const;
  +    virtual XalanParsedSourceHelper*
  +    createHelper() const;
   
  -	virtual const XalanDOMString&
  -	getURI() const;
  +    virtual const XalanDOMString&
  +    getURI() const;
   
   private:
   
  -	// Not implemented...
  -	XalanDefaultParsedSource(const XalanDefaultParsedSource&);
  +    // Not implemented...
  +    XalanDefaultParsedSource(const XalanDefaultParsedSource&);
   
  -	XalanDefaultParsedSource&
  -	operator=(const XalanDefaultParsedSource&);
  +    XalanDefaultParsedSource&
  +    operator=(const XalanDefaultParsedSource&);
   
   
  -	// Data members...
  -	XalanSourceTreeParserLiaison	m_parserLiaison;
  +    // Data members...
  +    XalanSourceTreeParserLiaison    m_parserLiaison;
   
  -	XalanSourceTreeDOMSupport		m_domSupport;
  +    XalanSourceTreeDOMSupport       m_domSupport;
   
  -	XalanSourceTreeDocument*		m_parsedSource;
  +    XalanSourceTreeDocument*        m_parsedSource;
   
  -	XalanDOMString					m_uri;
  +    XalanDOMString                  m_uri;
   };
   
   
  @@ -166,7 +167,7 @@
   
   
   
  -#endif	// XALANDEFAULTPARSEDSOURCE_HEADER_GUARD
  +#endif  // XALANDEFAULTPARSEDSOURCE_HEADER_GUARD
   
   
   
  
  
  
  1.17      +6 -5      xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp
  
  Index: XalanTransformer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XalanTransformer.cpp	26 Jul 2004 02:09:25 -0000	1.16
  +++ XalanTransformer.cpp	28 Oct 2004 19:40:06 -0000	1.17
  @@ -119,6 +119,7 @@
   	m_warningStream(&std::cerr),
   #endif
   	m_outputEncoding(),
  +    m_poolAllTextNodes(XalanSourceTreeDocument::getPoolAllTextNodes()),
   	m_stylesheetExecutionContext(new StylesheetExecutionContextDefault)
   {
   #if defined(XALAN_USE_ICU)
  @@ -132,7 +133,6 @@
   	m_stylesheetExecutionContext->installFormatNumberFunctor(theFormatNumberFunctor.get());
   	theICUFunctor.release();
   	theFormatNumberFunctor.release();
  -
   #endif
   }
   
  @@ -174,10 +174,10 @@
   	// Initialize Xalan. 
   	XalanAutoPtr<XSLTInit>			initGuard(new XSLTInit);
   	XalanAutoPtr<XSLTInputSource>	inputSourceGuard(new XSLTInputSource);
  -	EnsureFunctionsInstallation		instalGuard; 
  -	instalGuard.install();
  +	EnsureFunctionsInstallation		installGuard; 
  +	installGuard.install();
   
  -	instalGuard.release();
  +	installGuard.release();
   	s_xsltInit = initGuard.release();
   	s_emptyInputSource = inputSourceGuard.release();
   }
  @@ -678,7 +678,8 @@
   						m_errorHandler,
   						m_entityResolver,
   						getExternalSchemaLocation(),
  -						getExternalNoNamespaceSchemaLocation());
  +						getExternalNoNamespaceSchemaLocation(),
  +                        m_poolAllTextNodes);
   		}
   
   		// Store it in a vector.
  
  
  
  1.11      +28 -0     xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp
  
  Index: XalanTransformer.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XalanTransformer.hpp	31 Jul 2004 06:05:11 -0000	1.10
  +++ XalanTransformer.hpp	28 Oct 2004 19:40:06 -0000	1.11
  @@ -637,6 +637,32 @@
   	}
   
   	/**
  +	  * This member functions gets the flag to determine of a default parsed source
  +	  * tree will pool the values of all of the text nodes in the XML document.
  +      *
  +	  * @return The boolean value for the flag.
  +	  */
  +    bool
  +    getPoolAllTextNodes() const
  +    {
  +        return m_poolAllTextNodes;
  +    }
  +
  +	/**
  +	  * This member functions sets the flag to determine of a default parsed source
  +	  * tree will pool the values of all of the text nodes in the XML document.  This
  +	  * can result in significant memory savings if there are lots of repeated values
  +      * in text nodes.
  +      *
  +	  * @param fPool The boolean value for the flag.
  +	  */
  +    void
  +    setPoolAllTextNodes(bool    fPool)
  +    {
  +        m_poolAllTextNodes = fPool;
  +    }
  +
  +	/**
   	 * This method returns the installed ProblemListener instance.
   	 *
   	 * @return The pointer to the installed ProblemListener instance.
  @@ -962,6 +988,8 @@
   	StreamType*								m_warningStream;
   
   	XalanDOMString							m_outputEncoding;
  +
  +    bool                                    m_poolAllTextNodes;
   
   	// This should always be the latest data member!!!
   	StylesheetExecutionContextDefault*		m_stylesheetExecutionContext;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message