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...@locus.apache.org on 2000/07/25 16:53:46 UTC

cvs commit: xml-xalan/c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp

dbertoni    00/07/25 07:53:45

  Modified:    c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Removed obsolete data members and functions.  Fixed code that looks for stylesheet PIs.
  
  Revision  Changes    Path
  1.51      +8 -21     xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- XSLTEngineImpl.cpp	2000/07/21 19:52:57	1.50
  +++ XSLTEngineImpl.cpp	2000/07/25 14:53:40	1.51
  @@ -133,7 +133,6 @@
   #include "FunctionSystemProperty.hpp"
   #include "FunctionUnparsedEntityURI.hpp"
   #include "GenerateEvent.hpp"
  -#include "NodeSorter.hpp"
   #include "ProblemListener.hpp"
   #include "ProblemListenerDefault.hpp"
   #include "Stylesheet.hpp"
  @@ -206,7 +205,6 @@
   	m_defaultProblemListener(),
   	m_problemListener(&m_defaultProblemListener),
   	m_stylesheetRoot(0),
  -	m_XSLDirectiveLookup(),
   	m_traceSelects(false),
   	m_quietConflictWarnings(false),
   	m_diagnosticsPrintWriter(0),
  @@ -356,20 +354,9 @@
   			// stylesheet processing instruction...
   			XalanDOMString			stylesheetURI = 0;
   
  -			// Find the first element, and assume that it's the document element.
  +			// The PI must be a child of the document...
   			XalanNode*				child = sourceTree->getFirstChild();
   
  -			while(child != 0 && child->getNodeType() != XalanNode::ELEMENT_NODE)
  -			{
  -				child = child->getNextSibling();
  -			}
  -
  -			// OK, if we found a document element, start with the first child.
  -			if(child != 0)
  -			{
  -				child = child->getFirstChild();
  -			}
  -
   #if !defined(XALAN_NO_NAMESPACES)
   			using std::vector;
   #endif
  @@ -686,7 +673,6 @@
   			DocumentHandler*	docHandler,
   			XalanDocument*		docToRegister)
   {
  -	// java: url.toExternalForm();
   	const XalanDOMString&	urlString = url.getURLText();
   
   	XalanDocument*			doc =
  @@ -694,7 +680,6 @@
   
   	if(doc == 0)
   	{
  -		 // java: url.toString()
   		XSLTInputSource		inputSource(url.getURLText());
   
   		if(0 != docHandler)
  @@ -1274,11 +1259,7 @@
   {
   	if(0 != key)
   	{
  -#if !defined(XALAN_NO_NAMESPACES)
  -		using std::make_pair;
  -#endif
  -
  -		m_durationsTable.insert(make_pair(key, clock()));
  +		m_durationsTable.insert(DurationsTableMapType::value_type(key, clock()));
   	}
   }
   
  @@ -1288,6 +1269,7 @@
   XSLTEngineImpl::popDuration(const void*	key) const
   {
   	clock_t 	clockTicksDuration = 0;
  +
   	if(0 != key)
   	{
   		const DurationsTableMapType::iterator	i =
  @@ -1298,6 +1280,7 @@
   		if (i != m_durationsTable.end())
   		{
   			clockTicksDuration = clock() - (*i).second;
  +
   			m_durationsTable.erase(i);
   		}
   	}
  @@ -1643,8 +1626,11 @@
   {
   	assert(m_flistener != 0);
   	assert(name != 0);
  +
   	flushPending();
  +
   	const unsigned int	nAtts = atts.getLength();
  +
   	m_pendingAttributes.clear();
   
   	for(unsigned int i = 0; i < nAtts; i++)
  @@ -1657,6 +1643,7 @@
   	// Push a new container on the stack, then push an empty
   	// result namespace on to that container.
   	NamespaceVectorType		nsVector;
  +
   	nsVector.push_back(m_emptyNamespace);
   
   	m_resultNameSpaces.push_back(nsVector);
  
  
  
  1.39      +71 -119   xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- XSLTEngineImpl.hpp	2000/07/21 19:52:58	1.38
  +++ XSLTEngineImpl.hpp	2000/07/25 14:53:41	1.39
  @@ -93,7 +93,6 @@
   
   
   #include <XPath/Function.hpp>
  -//#include <XPath/MutableNodeRefList.hpp>
   #include <XPath/NameSpace.hpp>
   
   
  @@ -107,10 +106,7 @@
   
   // Forward definitions
   class DispatcherFactory;
  -class ElemAttributeSet;
  -class Formatter;
   class GenerateEvent;
  -class InputSource;
   class PrintWriter;
   class ResultTreeFragBase;
   class StylesheetConstructionContext;
  @@ -129,6 +125,7 @@
   class XSLTResultTarget;
   
   
  +
   /**
    * It's the responsibility of the XSLTEngineImpl class, collaborating with the
    * XML parser liaison, the DOM, and the XPath engine, to transform a source
  @@ -160,7 +157,6 @@
   	typedef XALAN_STD vector<NamespaceVectorType>		NamespacesStackType;
   	typedef XALAN_STD vector<TraceListener*>			TraceListenerVectorType;
   	typedef XALAN_STD vector<bool>						BoolVectorType;
  -	typedef XALAN_STD map<const XalanNode*, int>		XSLDirectiveMapType;
   #undef XALAN_STD
   
   	typedef Function::XObjectArgVectorType				XObjectArgVectorType;
  @@ -170,40 +166,6 @@
   	//---------------------------------------------------------------------
   
   	/**
  -	 * The root document.
  -	 */
  -	XalanDocument*	m_rootDoc;
  -
  -  /**
  -   * If true, output carriage returns.
  -   */
  -	bool	m_outputCarriageReturns;
  -
  -	/**
  -	 * If true, output linefeeds.
  -	 */
  -	bool	m_outputLinefeeds;
  -
  -	/**
  -	 * The factory that will be used to create result tree fragments.
  -	 */
  -	mutable XalanDocument*	m_resultTreeFactory;
  -
  -  /**
  -   * The namespace that the result tree conforms to.  A null value 
  -   * indicates that result-ns is not used and there is no checking. 
  -   * A empty string indicates that the result tree conforms to the 
  -   * default namespace.
  -   */
  -	XalanDOMString	m_resultNameSpacePrefix;
  -
  -  /**
  -   * The URL that belongs to the result namespace.
  -   */
  -	XalanDOMString	m_resultNameSpaceURL;
  -
  -
  -	/**
   	 * Construct an XSL processor that can call back to a XML processor, so it
   	 * can handle included files, and the like. You must create a new instance
   	 * of the XSLTEngineImpl class each time you run a transformation.
  @@ -712,13 +674,13 @@
   	int
   	getXSLToken(const XalanNode&	node) const;
   
  -  /**
  -   * Find the type of an element using this method.
  -   *
  -   * @param node	a probable xsl:xxx element
  -   * @param tagType Constants.ELEMNAME_XXX token
  -   * @return true if node is of tagType
  -   */
  +	/**
  +	 * Find the type of an element using this method.
  +	 *
  +	 * @param node	a probable xsl:xxx element
  +	 * @param tagType Constants.ELEMNAME_XXX token
  +	 * @return true if node is of tagType
  +	 */
   	bool
   	isXSLTagOfType(
   			const XalanNode& node,
  @@ -755,9 +717,6 @@
   			const XalanNode*		styleNode = 0,
   			const XalanNode*		sourceNode = 0) const;
   
  -//@@ HOLD until we figure out exceptions
  -//	void error(XalanDOMString& msg, Exception e);
  -
   	/**
   	 * Tell the user of an error, and probably throw an exception.
   	 * 
  @@ -817,8 +776,7 @@
   	 * @param s string to print
   	 */
   	void
  -	diag(
  -			const XalanDOMString&	s) const;
  +	diag(const XalanDOMString&	s) const;
     
   	/**
   	 * Tell if a given element name should output it's text 
  @@ -1132,7 +1090,12 @@
   			const XalanDOMString&	mimeType,
   			DispatcherFactory*		factory);
   
  -public:
  +	/**
  +	 * Reset the state.  This needs to be called after a process() call 
  +	 * is invoked, if the processor is to be used again.
  +	 */
  +	virtual void
  +	reset();
   
   	/**
   	 * Retrieve the XPath support object
  @@ -1337,16 +1300,45 @@
   
   protected:
   
  +	/**
  +	 * If true, output carriage returns.
  +	 */
  +	bool	m_outputCarriageReturns;
  +
  +	/**
  +	 * If true, output linefeeds.
  +	 */
  +	bool	m_outputLinefeeds;
  +
  +	/**
  +	 * The factory that will be used to create result tree fragments.
  +	 */
  +	mutable XalanDocument*	m_resultTreeFactory;
  +
  +	/**
  +	 * The namespace that the result tree conforms to.  A null value 
  +	 * indicates that result-ns is not used and there is no checking. 
  +	 * A empty string indicates that the result tree conforms to the 
  +	 * default namespace.
  +	 */
  +	XalanDOMString	m_resultNameSpacePrefix;
  +
  +	/**
  +	 * The URL that belongs to the result namespace.
  +	 */
  +	XalanDOMString	m_resultNameSpaceURL;
  +
  +
   	/*
   	 * The current input element that is being processed.
   	 */
   	XalanNode*	m_currentNode;
   
  -  /**
  -   * Given a tag name, an attribute name, and 
  -   * an attribute value, do a very crude recursive 
  -   * search and locate the first match.
  -   */
  +	/**
  +	 * Given a tag name, an attribute name, and 
  +	 * an attribute value, do a very crude recursive 
  +	 * search and locate the first match.
  +	 */
   	static XalanElement*
   	findElementByAttribute(
   			XalanElement&			elem,
  @@ -1368,26 +1360,15 @@
   			const XalanElement&		templateChild,
   			AttributeListImpl&		attList);
   
  -public:
  -
   	/**
  -	 * Reset the state.  This needs to be called after a process() call 
  -	 * is invoked, if the processor is to be used again.
  +	 * The pending element.  We have to delay the call to 
  +	 * m_flistener.startElement(name, atts) because of the 
  +	 * xsl:attribute and xsl:copy calls.	In other words, 
  +	 * the attributes have to be fully collected before you 
  +	 * can call startElement.
   	 */
  -	virtual void
  -	reset();
  -
  -protected:
  -
  -  /**
  -   * The pending element.  We have to delay the call to 
  -   * m_flistener.startElement(name, atts) because of the 
  -   * xsl:attribute and xsl:copy calls.	In other words, 
  -   * the attributes have to be fully collected before you 
  -   * can call startElement.
  -   */
   
  -	XalanDOMString	m_pendingElementName;
  +	XalanDOMString		m_pendingElementName;
   
   	/**
   	 * The pending attributes.	We have to delay the call to 
  @@ -1468,31 +1449,30 @@
   
   	ProblemListener*	m_problemListener;
   
  -  /**
  -   * The root of a linked set of stylesheets.
  -   */
  +	/**
  +	 * The root of a linked set of stylesheets.
  +	 */
   	const StylesheetRoot* 				m_stylesheetRoot;
   
  -/**
  - * The namespace that we must match as a minimum for XSLT.
  - */
  +	/**
  +	 * The namespace that we must match as a minimum for XSLT.
  +	 */
   	static const XalanDOMString		s_XSLNameSpaceURL;	//"http://www.w3.org/1999/XSL/Transform"
  -
   
  -/**
  - * The minimum version of XSLT supported.
  - */
  +	/**
  +	 * The minimum version of XSLT supported.
  +	 */
   	static const double s_XSLTVerSupported; // 1.0
   
  -/**
  - * Special Xalan namespace for built-in extensions.
  - */
  +	/**
  +	 * Special Xalan namespace for built-in extensions.
  +	 */
   	static const XalanDOMString s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt"
   
   
  -/**
  - * Hash table that can look up XSLT4J extensions element IDs via name.
  - */
  +	/**
  +	 * Hash table that can look up XSLT4J extensions element IDs via name.
  +	 */
   	static ElementKeysMapType		s_XSLT4JElementKeys;
   
   	/**
  @@ -1505,22 +1485,6 @@
   	 */
   	static ElementKeysMapType	s_elementKeys;
   
  -
  -	/**
  -	 * Node to xsl directive table, used so we don't have to keep 
  -	 * looking up the directives each time.  This isn't of huge 
  -	 * benifit, but is used because of the cost of getExpandedElementName.
  -	 */
  -	// Create a hash table that can look up xsl element IDs via name.
  -	mutable XSLDirectiveMapType 	m_XSLDirectiveLookup;
  -
  -	/**
  -	 * In response to 'xsl:import', call transformChild, or, if that 
  -	 * fails, transformChildren.
  -	 * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide 
  -	 * the error condition is severe enough to halt processing.
  -	 */
  -
   	/**
   	 * If this is set to true, selects will be traced
   	 */
  @@ -1636,24 +1600,12 @@
   	static const bool	s_resolveContentsEarly;
   
   	/**
  -	 * Set the factory for making XPaths.
  -	 */
  -//	void setXPathFactory(XPathFactory* factory) { m_xpathFactory = factory; }
  -
  -	
  -	/**
   	 * Get a DOM document, primarily for creating result 
   	 * tree fragments.
   	 */
   	virtual XalanDocument*
   	getDOMFactory() const;
   
  -	/**
  -	 * Set the XPath processor object.
  -	 * @param processor A XPathProcessor interface.
  -	 */
  -//	void setXPathProcessor(XPathProcessor* processor) { m_xpathProcessor = processor; }
  -
   	bool
   	getResolveContentsEarly() const
   	{
  @@ -1662,7 +1614,7 @@
   
   	ParamVectorType 	m_topLevelParams;
   
  -	public:
  +public:
   
   	/**
   	 * Reset the vector of top level parameters