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/05/14 17:47:15 UTC

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

dbertoni    02/05/14 08:47:15

  Modified:    c/src/XSLT StylesheetHandler.cpp StylesheetHandler.hpp
  Log:
  Make sure all appends go through checking code.
  
  Revision  Changes    Path
  1.79      +44 -6     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.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- StylesheetHandler.cpp	8 May 2002 21:02:26 -0000	1.78
  +++ StylesheetHandler.cpp	14 May 2002 15:47:15 -0000	1.79
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -1337,10 +1337,33 @@
   
   void
   StylesheetHandler::appendChildElementToParent(
  +			ElemTemplateElement*	parent,
  +			ElemTemplateElement*	elem)
  +{
  +	assert(elem != 0);
  +
  +	appendChildElementToParent(parent, elem, elem->getLocator());
  +}
  +
  +
  +
  +void
  +StylesheetHandler::appendChildElementToParent(
  +			ElemTemplateElement*	elem,
  +			const Locator*			locator)
  +{
  +	appendChildElementToParent(m_elemStack.back(), elem, locator);
  +}
  +
  +
  +
  +void
  +StylesheetHandler::appendChildElementToParent(
  +			ElemTemplateElement*	parent,
   			ElemTemplateElement*	elem,
   			const Locator*			locator)
   {
  -	ElemTemplateElement* const	parent = m_elemStack.back();
  +	assert(parent != 0 && elem != 0);
   
   	try
   	{
  @@ -1363,8 +1386,7 @@
   			XalanDOMString	theMessage(elem->getElementName());
   #endif
   
  -			append(theMessage, " is not a valid child of ");
  -			append(theMessage, parent->getElementName());
  +			append(theMessage, " is not allowed at this position in the stylesheet");
   
   			error(theMessage, locator);
   		}
  @@ -1790,12 +1812,21 @@
   		{
   			while(!m_whiteSpaceElems.empty())
   			{
  -				parent->appendChildElem(m_whiteSpaceElems.back());
  +#if 1
  +				assert(m_whiteSpaceElems.back() != 0);
   
  +				appendChildElementToParent(
  +					parent,
  +					m_whiteSpaceElems.back());
  +#else
  +				parent->appendChildElem(m_whiteSpaceElems.back());
  +#endif
   				m_whiteSpaceElems.pop_back();
   			}
   
  -			parent->appendChildElem(elem.get());
  +			appendChildElementToParent(
  +				parent,
  +				elem.get());
   
   			elem.release();
   		}
  @@ -1816,7 +1847,14 @@
   
   				if(isPrevCharData && ! isLastPoppedXSLText)
   				{
  +#if 1
  +					appendChildElementToParent(
  +						parent,
  +						elem.get());
  +
  +#else
   					parent->appendChildElem(elem.get());
  +#endif
   
   					elem.release();
   
  
  
  
  1.32      +12 -1     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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StylesheetHandler.hpp	26 Sep 2001 21:30:23 -0000	1.31
  +++ StylesheetHandler.hpp	14 May 2002 15:47:15 -0000	1.32
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -493,6 +493,17 @@
   
   	void
   	appendChildElementToParent(
  +			ElemTemplateElement*	elem,
  +			const Locator*			locator);
  +
  +	void
  +	appendChildElementToParent(
  +			ElemTemplateElement*	parent,
  +			ElemTemplateElement*	elem);
  +
  +	void
  +	appendChildElementToParent(
  +			ElemTemplateElement*	parent,
   			ElemTemplateElement*	elem,
   			const Locator*			locator);
   
  
  
  

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