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 2002/11/12 03:32:30 UTC

cvs commit: xml-xalan/c/src/XSLT ElemElement.cpp ElemElement.hpp ElemLiteralResult.cpp ElemLiteralResult.hpp ElemTemplateElement.cpp ElemTemplateElement.hpp NamespacesHandler.cpp NamespacesHandler.hpp StylesheetHandler.cpp StylesheetHandler.hpp

dbertoni    2002/11/11 18:32:30

  Modified:    c/src/XSLT ElemElement.cpp ElemElement.hpp
                        ElemLiteralResult.cpp ElemLiteralResult.hpp
                        ElemTemplateElement.cpp ElemTemplateElement.hpp
                        NamespacesHandler.cpp NamespacesHandler.hpp
                        StylesheetHandler.cpp StylesheetHandler.hpp
  Log:
  Reduce size of NamespacesHandler and ElemTempalteElement.
  
  Revision  Changes    Path
  1.43      +16 -1     xml-xalan/c/src/XSLT/ElemElement.cpp
  
  Index: ElemElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- ElemElement.cpp	31 Oct 2002 07:15:56 -0000	1.42
  +++ ElemElement.cpp	12 Nov 2002 02:32:29 -0000	1.43
  @@ -90,7 +90,7 @@
   {
   	// Namespace aliases are not used for xsl:element, so
   	// turn them off...
  -	m_namespacesHandler.setProcessNamespaceAliaises(false);
  +//	m_namespacesHandler.setProcessNamespaceAliaises(false);
   
   	const unsigned int	nAttrs = atts.getLength();
   
  @@ -344,6 +344,21 @@
   			executionContext.endElement(c_wstr(elemName));
   		}
   	}
  +}
  +
  +
  +
  +void
  +ElemElement::postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler)
  +{
  +	theHandler.postConstruction(
  +			constructionContext,
  +			false,
  +			getElementName(),
  +			&theParentHandler);
   }
   
   
  
  
  
  1.14      +7 -1      xml-xalan/c/src/XSLT/ElemElement.hpp
  
  Index: ElemElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ElemElement.hpp	14 May 2001 22:21:08 -0000	1.13
  +++ ElemElement.hpp	12 Nov 2002 02:32:29 -0000	1.14
  @@ -124,6 +124,12 @@
   			StylesheetExecutionContext&		executionContext,
   			bool							skipAttributeChildren) const;
   
  +	virtual void
  +	postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler);
  +
   private:
   
   	/** 
  
  
  
  1.58      +67 -17    xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- ElemLiteralResult.cpp	6 Nov 2002 05:09:48 -0000	1.57
  +++ ElemLiteralResult.cpp	12 Nov 2002 02:32:29 -0000	1.58
  @@ -221,34 +221,66 @@
   
   
   
  -void
  -ElemLiteralResult::postConstruction(
  -			StylesheetConstructionContext&	constructionContext,
  -			const NamespacesHandler&		theParentHandler)
  +class AVTPrefixChecker : public NamespacesHandler::PrefixChecker
   {
  -	// OK, now check all attribute AVTs to make sure
  -	// our NamespacesHandler knows about any prefixes
  -	// that will need namespace declarations...
  -	const StylesheetConstructionContext::GetAndReleaseCachedString	theGuard(constructionContext);
  +public:
   
  -	XalanDOMString&		thePrefix = theGuard.get();
  +	AVTPrefixChecker(
  +			const AVT**			theAVTs,
  +			unsigned int		theAVTsCount) :
  +		m_avts(theAVTs),
  +		m_avtsCount(theAVTsCount)
  +	{
  +	}
   
  -	for(unsigned int i = 0; i < m_avtsCount; ++i)
  +	virtual bool
  +	isActive(const XalanDOMString&	thePrefix) const
   	{
  -		const AVT* const	avt = m_avts[i];
  +		bool	fActive = false;
   
  -		const XalanDOMString&	theName = avt->getName();
  +		for(unsigned int i = 0; i < m_avtsCount; ++i)
  +		{
  +			const AVT* const	avt = m_avts[i];
   
  -		const XalanDOMString::size_type		theColonIndex = indexOf(theName, XalanUnicode::charColon);
  +			const XalanDOMString&	theName = avt->getName();
   
  -		if (theColonIndex != length(theName))
  -		{
  -			theName.substr(thePrefix, 0, theColonIndex);
  +			const XalanDOMString::size_type		theColonIndex = indexOf(theName, XalanUnicode::charColon);
   
  -			m_namespacesHandler.addActivePrefix(constructionContext, thePrefix);
  +			if (theColonIndex != length(theName))
  +			{
  +				if (thePrefix.length() == theColonIndex &&
  +					startsWith(theName, thePrefix) == true)
  +				{
  +					fActive = true;
  +
  +					break;
  +				}
  +			}
   		}
  +
  +		return fActive;
   	}
   
  +private:
  +
  +	// Not implemented...
  +	AVTPrefixChecker&
  +	operator=(const AVTPrefixChecker&);
  +
  +
  +	// Data members...
  +	const AVT** const	m_avts;
  +
  +	const unsigned int	m_avtsCount;
  +};
  +
  +
  +
  +void
  +ElemLiteralResult::postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler)
  +{
   	if (m_avtsCount != 0 ||
   		m_namespacesHandler.getNamespaceDeclarationsCount() != 0)
   	{
  @@ -283,6 +315,24 @@
   			}
   		}
   	}
  +}
  +
  +
  +
  +void
  +ElemLiteralResult::postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler)
  +{
  +	const AVTPrefixChecker	theChecker(m_avts, m_avtsCount);
  +
  +	theHandler.postConstruction(
  +			constructionContext,
  +			true,
  +			getElementName(),
  +			&theParentHandler,
  +			&theChecker);
   }
   
   
  
  
  
  1.31      +6 -0      xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
  
  Index: ElemLiteralResult.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ElemLiteralResult.hpp	6 Nov 2002 05:09:48 -0000	1.30
  +++ ElemLiteralResult.hpp	12 Nov 2002 02:32:29 -0000	1.31
  @@ -155,6 +155,12 @@
   			int								columnNumber,
   			int								xslToken);
   
  +	virtual void
  +	postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler);
  +
   private:
   
   	// not implemented
  
  
  
  1.85      +18 -5     xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- ElemTemplateElement.cpp	6 Nov 2002 05:09:48 -0000	1.84
  +++ ElemTemplateElement.cpp	12 Nov 2002 02:32:29 -0000	1.85
  @@ -1074,10 +1074,10 @@
   			StylesheetConstructionContext&	constructionContext,
   			const NamespacesHandler&		theParentHandler)
   {
  -	m_namespacesHandler.postConstruction(
  +	postConstruction(
   			constructionContext,
  -			getElementName(),
  -			&theParentHandler);
  +			theParentHandler,
  +			m_namespacesHandler);
   
   	if (hasChildren() == true)
   	{
  @@ -1130,8 +1130,6 @@
   #endif
   
   				m_directTemplate = theCallTemplateChild->getTemplate();
  -
  -//				delete theCallTemplateChild;
   			}
   		}
   		else if (canGenerateAttributes() == false &&
  @@ -1140,6 +1138,21 @@
   			m_flags |= eCanGenerateAttributes;
   		}
   	}
  +}
  +
  +
  +
  +void
  +ElemTemplateElement::postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler)
  +{
  +	theHandler.postConstruction(
  +			constructionContext,
  +			true,
  +			getElementName(),
  +			&theParentHandler);
   }
   
   
  
  
  
  1.52      +12 -0     xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
  
  Index: ElemTemplateElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- ElemTemplateElement.hpp	6 Nov 2002 05:09:48 -0000	1.51
  +++ ElemTemplateElement.hpp	12 Nov 2002 02:32:29 -0000	1.52
  @@ -877,6 +877,18 @@
   	virtual bool
   	childTypeAllowed(int	xslToken) const;
   
  +	/**
  +	 * Called after construction is completed.  This is a hook for
  +	 * deriving classes to handle post-constructio with the
  +	 * instances HamespaceHandler instance, which is otherwise only
  +	 * available through a const accessor.
  +	 */
  +	virtual void
  +	postConstruction(
  +			StylesheetConstructionContext&	constructionContext,
  +			const NamespacesHandler&		theParentHandler,
  +			NamespacesHandler&				theHandler);
  +
   	/*
   	 * This object handles all result tree namespace processing.
   	 */
  
  
  
  1.24      +57 -54    xml-xalan/c/src/XSLT/NamespacesHandler.cpp
  
  Index: NamespacesHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- NamespacesHandler.cpp	26 Sep 2002 05:14:14 -0000	1.23
  +++ NamespacesHandler.cpp	12 Nov 2002 02:32:29 -0000	1.24
  @@ -72,13 +72,26 @@
   
   
   
  +#include "AVT.hpp"
   #include "Constants.hpp"
   #include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
   
   
   
  -const XalanDOMString		NamespacesHandler::NamespaceExtended::s_emptyString;
  +const XalanDOMString		NamespacesHandler::Namespace::s_emptyString;
  +
  +
  +
  +NamespacesHandler::PrefixChecker::PrefixChecker()
  +{
  +}
  +
  +
  +
  +NamespacesHandler::PrefixChecker::~PrefixChecker()
  +{
  +}
   
   
   
  @@ -86,9 +99,7 @@
   	m_excludedResultPrefixes(),
   	m_namespaceDeclarations(),
   	m_extensionNamespaceURIs(),
  -	m_namespaceAliases(),
  -	m_activePrefixes(),
  -	m_processAliases(true)
  +	m_namespaceAliases()
   {
   }
   
  @@ -102,9 +113,7 @@
   	m_excludedResultPrefixes(),
   	m_namespaceDeclarations(),
   	m_extensionNamespaceURIs(),
  -	m_namespaceAliases(),
  -	m_activePrefixes(),
  -	m_processAliases(true)
  +	m_namespaceAliases()
   {
   	// Go through the namespaces stack in reverse order...
   	const NamespacesStackType::const_reverse_iterator	theEnd =
  @@ -139,7 +148,7 @@
   					m_namespaceDeclarations.insert(
   						NamespacesMapType::value_type(
   							&theConstructionContext.getPooledString(thePrefix),
  -							NamespaceExtended(
  +							Namespace(
   								theConstructionContext.getPooledString(theNamespace.getPrefix()),
   								theConstructionContext.getPooledString(theNamespace.getURI()))));
   				}
  @@ -166,7 +175,7 @@
   void
   NamespacesHandler::addExtensionNamespaceURI(
   			StylesheetConstructionContext&	theConstructionContext,
  -			const XalanDOMString&	theURI)
  +			const XalanDOMString&			theURI)
   {
   	m_extensionNamespaceURIs.push_back(&theConstructionContext.getPooledString(theURI));
   }
  @@ -249,27 +258,20 @@
   
   
   void
  -NamespacesHandler::addActivePrefix(
  -			StylesheetConstructionContext&	theConstructionContext,
  -			const XalanDOMString&			thePrefix)
  -{
  -	m_activePrefixes.push_back(
  -		&theConstructionContext.getPooledString(thePrefix));
  -}
  -
  -
  -
  -void
   NamespacesHandler::processExcludeResultPrefixes(
   		StylesheetConstructionContext&	theConstructionContext,
   		const XalanDOMChar*				theValue,
   		const NamespacesStackType&		theCurrentNamespaces)
   {
  +	typedef StylesheetConstructionContext::GetAndReleaseCachedString	GetAndReleaseCachedString;
  +
   	StringTokenizer		tokenizer(
   					theValue,
   					Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
   
  -	XalanDOMString	thePrefix;
  +	const GetAndReleaseCachedString		theGuard(theConstructionContext);
  +
  +	XalanDOMString&		thePrefix = theGuard.get();
   
       while(tokenizer.hasMoreTokens() == true)
       {
  @@ -285,11 +287,7 @@
   
   		if(theNamespace == 0)
   		{
  -			XalanDOMString	theMessage(TranscodeFromLocalCodePage("Invalid prefix in exclude-result-prefixes: "));
  -
  -			theMessage += thePrefix;
  -
  -			theConstructionContext.error(theMessage);
  +			theConstructionContext.error("Undeclared prefix in exclude-result-prefixes");
   		}
   
   		m_excludedResultPrefixes[&theConstructionContext.getPooledString(thePrefix)] =
  @@ -305,13 +303,19 @@
   			const XalanDOMChar*				theValue,
   			const NamespacesStackType&		theCurrentNamespaces)
   {
  +	typedef StylesheetConstructionContext::GetAndReleaseCachedString	GetAndReleaseCachedString;
  +
   	StringTokenizer		tokenizer(
   					theValue,
   					Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
   
  -    while(tokenizer.hasMoreTokens() == true)
  +	const GetAndReleaseCachedString		theGuard(theConstructionContext);
  +
  +	XalanDOMString&		thePrefix = theGuard.get();
  +
  +	while(tokenizer.hasMoreTokens() == true)
       {
  -		XalanDOMString	thePrefix = tokenizer.nextToken();
  +		tokenizer.nextToken(thePrefix);
   
   		if(equalsIgnoreCaseASCII(thePrefix, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
   		{
  @@ -323,11 +327,7 @@
   
   		if(theNamespace == 0)
   		{
  -			XalanDOMString	theMessage(TranscodeFromLocalCodePage("Invalid prefix in extension-element-prefixes: "));
  -
  -			theMessage += thePrefix;
  -
  -			theConstructionContext.error(theMessage);
  +			theConstructionContext.error("Undeclared prefix in extension-element-prefixes");
   		}
   
   		assert(theNamespace != 0);
  @@ -341,8 +341,10 @@
   void
   NamespacesHandler::postConstruction(
   			StylesheetConstructionContext&	theConstructionContext,
  +			bool							fProcessNamespaceAliases,
   			const XalanDOMString&			theElementName,
  -			const NamespacesHandler*		parentNamespacesHandler)
  +			const NamespacesHandler*		parentNamespacesHandler,
  +			const PrefixChecker*			prefixChecker)
   {
   	// Copy everything from the parent handler, if there is one...
   	if (parentNamespacesHandler != 0)
  @@ -358,22 +360,26 @@
   	// don't exclude its prefix.
   	const XalanDOMString::size_type		indexOfNSSep = indexOf(theElementName, XalanUnicode::charColon);
   
  -	XalanDOMString	thePrefix;
  -	
  +	typedef StylesheetConstructionContext::GetAndReleaseCachedString	GetAndReleaseCachedString;
  +
  +	const GetAndReleaseCachedString		theGuard(theConstructionContext);
  +
  +	XalanDOMString&		thePrefix = theGuard.get();
  +
   	if (indexOfNSSep < length(theElementName))
   	{
   		substring(theElementName, thePrefix, 0, indexOfNSSep);
   	}
   
  -	processExcludeResultPrefixes(theConstructionContext, thePrefix);
  +	processExcludeResultPrefixes(theConstructionContext, thePrefix, prefixChecker);
   
  -	// $$ ToDo: Does this happen before or after exclude-result-prefixes?
  -	processNamespaceAliases();
  +	if (fProcessNamespaceAliases == true)
  +	{
  +		// $$ ToDo: Does this happen before or after exclude-result-prefixes?
  +		processNamespaceAliases();
  +	}
   
   	createResultAttributeNames(theConstructionContext);
  -
  -	// We don't need these any more...
  -	m_activePrefixes.clear();
   }
   
   
  @@ -438,9 +444,9 @@
   
   		for(; i != theEnd; ++i)
   		{
  -			const NamespaceExtended&	theNamespace = (*i).second;
  +			const Namespace&		theNamespace = (*i).second;
   
  -			const XalanDOMString&		thePrefix = theNamespace.getPrefix();
  +			const XalanDOMString&	thePrefix = theNamespace.getPrefix();
   
   			// If we're not supposed to suppress the default namespace, or
   			// there's a prefix (so it's not the default), we can continue
  @@ -554,8 +560,6 @@
   	m_extensionNamespaceURIs.clear();
   
   	m_namespaceAliases.clear();
  -
  -	m_activePrefixes.clear();
   }
   
   
  @@ -570,8 +574,6 @@
   	m_extensionNamespaceURIs.swap(theOther.m_extensionNamespaceURIs);
   
   	m_namespaceAliases.swap(theOther.m_namespaceAliases);
  -
  -	m_activePrefixes.swap(theOther.m_activePrefixes);
   }
   
   
  @@ -594,7 +596,7 @@
   
   		for(; i != theEnd; ++i)
   		{
  -			NamespaceExtended&		theNamespace = (*i).second;
  +			Namespace&				theNamespace = (*i).second;
   
   			const XalanDOMString&	thePrefix = theNamespace.getPrefix();
   
  @@ -624,7 +626,8 @@
   void
   NamespacesHandler::processExcludeResultPrefixes(
   			StylesheetConstructionContext&	theConstructionContext,
  -			const XalanDOMString&			theElementPrefix)
  +			const XalanDOMString&			theElementPrefix,
  +			const PrefixChecker*			prefixChecker)
   {
   	if (m_excludedResultPrefixes.empty() == false)
   	{
  @@ -648,7 +651,7 @@
   		// Check for any result prefixes we should exclude...
   		while(i != theEnd)
   		{
  -			const NamespaceExtended&	theNamespace = (*i).second;
  +			const Namespace&		theNamespace = (*i).second;
   
   			const XalanDOMString&	thePrefix = theNamespace.getPrefix();
   			const XalanDOMString&	theURI = theNamespace.getURI();
  @@ -656,7 +659,7 @@
   			// We can never exclude the prefix of our owner element, so
   			// check that first...
   			if (equals(thePrefix, theElementPrefix) == false &&
  -				isActivePrefix(thePrefix) == false &&
  +				(prefixChecker == 0 || prefixChecker->isActive(thePrefix) == false) &&
   				(isExcludedNamespaceURI(theURI) == true ||
   				 isExtensionNamespaceURI(theURI) == true))
   			{
  @@ -687,7 +690,7 @@
   void
   NamespacesHandler::processNamespaceAliases()
   {
  -	if (m_processAliases == true && m_namespaceDeclarations.empty() == false)
  +	if (m_namespaceDeclarations.empty() == false)
   	{
   		const NamespacesMapType::iterator	theEnd =
   				m_namespaceDeclarations.end();
  @@ -699,7 +702,7 @@
   		// alias as appropriate...
   		for(; i != theEnd; ++i)
   		{
  -			NamespaceExtended&	theNamespace = (*i).second;
  +			Namespace&	theNamespace = (*i).second;
   
   			const XalanDOMString&			theURI =
   						theNamespace.getURI();
  
  
  
  1.15      +27 -47    xml-xalan/c/src/XSLT/NamespacesHandler.hpp
  
  Index: NamespacesHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- NamespacesHandler.hpp	26 Sep 2002 05:14:14 -0000	1.14
  +++ NamespacesHandler.hpp	12 Nov 2002 02:32:29 -0000	1.15
  @@ -92,18 +92,31 @@
   {
   public:
   
  -	class NamespaceExtended
  +	class PrefixChecker
   	{
   	public:
   
  -		NamespaceExtended() :
  +		PrefixChecker();
  +
  +		virtual
  +		~PrefixChecker();
  +
  +		virtual bool
  +		isActive(const XalanDOMString&	thePrefix) const = 0;
  +	};
  +
  +	class Namespace
  +	{
  +	public:
  +
  +		Namespace() :
   			m_prefix(&s_emptyString),
   			m_uri(&s_emptyString),
   			m_resultAttributeName(&s_emptyString)
   		{
   		}
   
  -		NamespaceExtended(
  +		Namespace(
   					const XalanDOMString&	prefix,
   					const XalanDOMString&	uri) :
   			m_prefix(&prefix),
  @@ -204,7 +217,7 @@
   				DOMStringPointerLessThanFunction>		ExcludedResultPrefixesMapType;
   
   	typedef map<const XalanDOMString*,
  -				NamespaceExtended,
  +				Namespace,
   				DOMStringPointerLessThanFunction>		NamespacesMapType;
   
   	typedef map<const XalanDOMString*,
  @@ -218,7 +231,7 @@
   					 DOMStringPointerLessThanFunction>	ExcludedResultPrefixesMapType;
   
   	typedef std::map<const XalanDOMString*,
  -					 NamespaceExtended,
  +					 Namespace,
   					 DOMStringPointerLessThanFunction>	NamespacesMapType;
   
   	typedef std::map<const XalanDOMString*,
  @@ -281,14 +294,18 @@
   	 * Notify the instance that the stylesheet is fully constructed.
   	 *
   	 * @param theConstructionContext The current construction context.
  +	 * @param fProcessNamespaceAliases If true, process any namespace aliases
   	 * @param theElementName The name of the owning element.
   	 * @param parentNamespacesHandler The parent handler, if any.
  +	 * @param prefixChecker A pointer to a PrefixChecker instance to use, if any.
   	 */
   	void
   	postConstruction(
   			StylesheetConstructionContext&	theConstructionContext,
  +			bool							fProcessNamespaceAliases = true,
   			const XalanDOMString&			theElementName = XalanDOMString(),
  -			const NamespacesHandler*		parentNamespacesHandler = 0);
  +			const NamespacesHandler*		parentNamespacesHandler = 0,
  +			const PrefixChecker*			prefixChecker = 0);
   
   	NamespacesHandler&
   	operator=(const NamespacesHandler&	theRHS);
  @@ -348,17 +365,6 @@
   			const XalanDOMString&			theResultNamespace);
   
   	/**
  -	 * Add a prefix to the list of active prefixes.
  -	 *
  -	 * @param theConstructionContext The current construction context.
  -	 * @param thePrefix The prefix that is active and requires a namespace declaration.
  -	 */
  -	void
  -	addActivePrefix(
  -			StylesheetConstructionContext&	theConstructionContext,
  -			const XalanDOMString&			thePrefix);
  -
  -	/**
   	 * Copy the aliases from the given NamespacesHandler.
   	 *
   	 * @param parentNamespacesHandler The parent handler.
  @@ -391,18 +397,6 @@
   	void
   	swap(NamespacesHandler&		theOther);
   
  -	bool
  -	getProcessNamespaceAliaises() const
  -	{
  -		return m_processAliases;
  -	}
  -
  -	void
  -	setProcessNamespaceAliaises(bool	fValue)
  -	{
  -		m_processAliases = fValue;
  -	}
  -
   	NamespacesMapType::size_type
   	getNamespaceDeclarationsCount() const
   	{
  @@ -424,11 +418,13 @@
   	 *
   	 * @param theConstructionContext The current construction context.
   	 * @param theElementPrefix The prefix of the owning element.
  +	 * @param prefixChecker A pointer to a PrefixChecker instance to use, if any.
   	 */
   	void
   	processExcludeResultPrefixes(
   			StylesheetConstructionContext&	theConstructionContext,
  -			const XalanDOMString&			theElementPrefix);
  +			const XalanDOMString&			theElementPrefix,
  +			const PrefixChecker*			prefixChecker);
   
   	/**
   	 * Process the namespace aliases data.
  @@ -498,18 +494,6 @@
   	}
   
   	/**
  -	 * Determine if a given prefix is active.
  -	 *
  -	 * @param thePrefix The prefix to check.
  -	 * @return true if the prefix is active, false if not.
  -	 */
  -	bool
  -	isActivePrefix(const XalanDOMString&	thePrefix) const
  -	{
  -		return findString(thePrefix, m_activePrefixes);
  -	}
  -
  -	/**
   	 * Determine if a given string is present in the vector
   	 *
   	 * @param theString The string to find.
  @@ -520,6 +504,7 @@
   			const XalanDOMString&					theString,
   			const XalanDOMStringPointerVectorType&	theVector);
   
  +
   	// Not implemented...
   	bool
   	operator==(const NamespacesHandler&) const;
  @@ -532,11 +517,6 @@
   	XalanDOMStringPointerVectorType		m_extensionNamespaceURIs;
   
   	NamespaceAliasesMapType				m_namespaceAliases;
  -
  -	XalanDOMStringPointerVectorType		m_activePrefixes;
  -
  -	// If true namespace aliases will be processed.  If false, they will not.
  -	bool								m_processAliases;
   };
   
   
  
  
  
  1.97      +29 -36    xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- StylesheetHandler.cpp	6 Nov 2002 05:09:48 -0000	1.96
  +++ StylesheetHandler.cpp	12 Nov 2002 02:32:29 -0000	1.97
  @@ -295,15 +295,23 @@
   		// First push namespaces
   		m_stylesheet.pushNamespaces(atts);
   
  -		const XalanDOMString&	ns = getNamespaceFromStack(name);
  -
   		const XalanDOMString::size_type		nameLength = length(name);
   		const XalanDOMString::size_type		index = indexOf(name, XalanUnicode::charColon);
   
  -		if(length(ns) == 0 && index < nameLength)
  +		const XalanDOMString*	ns = getNamespaceFromStack(name);
  +
  +		if(ns == 0)
   		{
  -			error("Could not resolve prefix.", locator);
  +			if (index < nameLength)
  +			{
  +				error("Could not resolve prefix", locator);
  +			}
  +			else
  +			{
  +				ns = &s_emptyString;
  +			}
   		}
  +		assert(ns != 0);
   
   		if (index < nameLength)
   		{
  @@ -318,10 +326,10 @@
   
   		const ElemTemplateStackType::size_type	origStackSize = m_elemStack.size();
   
  -		if(equals(ns, m_constructionContext.getXSLTNamespaceURI()))
  +		if(equals(*ns, m_constructionContext.getXSLTNamespaceURI()))
   		{
   			if(!isEmpty(m_stylesheet.getXSLTNamespaceURI()))
  -				m_stylesheet.setXSLTNamespaceURI(ns);
  +				m_stylesheet.setXSLTNamespaceURI(*ns);
   
   			const StylesheetConstructionContext::eElementToken	xslToken =
   				m_constructionContext.getElementToken(m_elementLocalName);
  @@ -530,7 +538,7 @@
   				m_inScopeVariableNamesStack.push_back(QNameSetVectorType::value_type());
   			}
   		}
  -		else if (!m_inTemplate && startsWith(ns, m_constructionContext.getXalanXSLNameSpaceURL()))
  +		else if (!m_inTemplate && startsWith(*ns, m_constructionContext.getXalanXSLNameSpaceURL()))
   		{
   			processExtensionElement(name, m_elementLocalName, atts, locator);
   		}
  @@ -543,7 +551,7 @@
   				{
   					elem = initWrapperless(name, atts, locator);
   				}
  -				else if (length(ns) == 0 && m_elemStack.size() == 1)
  +				else if (length(*ns) == 0 && m_elemStack.size() == 1)
   				{
   					error("Illegal top level element", locator);
   				}
  @@ -560,8 +568,8 @@
   				// is this an extension element call?
   				ExtensionNSHandler*		nsh = 0;
   
  -				if (!isEmpty(ns) &&
  -					((nsh = m_stylesheet.lookupExtensionNSHandler(ns)) != 0))
  +				if (!isEmpty(*ns) &&
  +					((nsh = m_stylesheet.lookupExtensionNSHandler(*ns)) != 0))
   				{
   					elem = m_constructionContext.createElement(
   												m_stylesheet,
  @@ -669,38 +677,18 @@
   
   
   
  -const XalanDOMString&
  +const XalanDOMString*
   StylesheetHandler::getNamespaceFromStack(const XalanDOMChar*	theName) const
   {
  -	const XalanDOMString* const		theNamespace =
  -		m_stylesheet.getNamespaceFromStack(theName);
  -
  -	if (theNamespace == 0)
  -	{
  -		return s_emptyString;
  -	}
  -	else
  -	{
  -		return *theNamespace;
  -	}
  +	return m_stylesheet.getNamespaceFromStack(theName);
   }
   
   
   
  -const XalanDOMString&
  +const XalanDOMString*
   StylesheetHandler::getNamespaceForPrefixFromStack(const XalanDOMString&		thePrefix) const
   {
  -	const XalanDOMString* const		theNamespace =
  -		m_stylesheet.getNamespaceForPrefixFromStack(thePrefix);
  -
  -	if (theNamespace == 0)
  -	{
  -		return s_emptyString;
  -	}
  -	else
  -	{
  -		return *theNamespace;
  -	}
  +	return m_stylesheet.getNamespaceForPrefixFromStack(thePrefix);
   }
   
   
  @@ -882,9 +870,14 @@
   			{
   				tokenizer.nextToken(prefix);
   
  -				const XalanDOMString&	extns = getNamespaceForPrefixFromStack(prefix);
  +				const XalanDOMString* const		extns = getNamespaceForPrefixFromStack(prefix);
  +
  +				if (extns == 0)
  +				{
  +					error("Undeclared prefix in extension-element-prefixes", locator);
  +				}
   
  -				m_stylesheet.processExtensionNamespace(m_constructionContext, extns);
  +				m_stylesheet.processExtensionNamespace(m_constructionContext, *extns);
   			}
   		}
    		else if(equals(aname, Constants::ATTRNAME_ID))
  
  
  
  1.41      +2 -2      xml-xalan/c/src/XSLT/StylesheetHandler.hpp
  
  Index: StylesheetHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- StylesheetHandler.hpp	5 Nov 2002 05:19:25 -0000	1.40
  +++ StylesheetHandler.hpp	12 Nov 2002 02:32:29 -0000	1.41
  @@ -758,10 +758,10 @@
   			const AttributeList&	atts,
   			const Locator*			locator);
   
  -	const XalanDOMString&
  +	const XalanDOMString*
   	getNamespaceFromStack(const XalanDOMChar*	theName) const;
   
  -	const XalanDOMString&
  +	const XalanDOMString*
   	getNamespaceForPrefixFromStack(const XalanDOMString&	thePrefix) const;
   
   	class PushPopIncludeState;
  
  
  

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