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/09/01 08:42:13 UTC
svn commit: r690861 [5/6] - in /xalan/c/trunk: Projects/Win32/VC8/AllInOne/
Projects/Win32/VC9/AllInOne/ Tests/Conf/ samples/ExternalFunction/
src/xalanc/DOMSupport/ src/xalanc/Harness/ src/xalanc/ICUBridge/
src/xalanc/Include/ src/xalanc/NLS/en_US/ sr...
Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp Sun Aug 31 23:42:06 2008
@@ -255,6 +255,40 @@
+void
+StylesheetExecutionContextDefault::problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode)
+{
+ m_xsltProcessor->problem(
+ source,
+ classification,
+ msg,
+ locator,
+ sourceNode);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode)
+{
+ m_xsltProcessor->problem(
+ source,
+ classification,
+ msg,
+ sourceNode);
+}
+
+
+
bool
StylesheetExecutionContextDefault::getQuietConflictWarnings() const
{
@@ -1256,27 +1290,15 @@
{
const LocatorType* const theLocator = theElement->getLocator();
- StylesheetExecutionContext::GetAndReleaseCachedString theGuard(*this);
+ const GetCachedString theGuard(*this);
- if (theLocator == 0)
- {
- throw XSLTProcessorException(
- getMemoryManager(),
- XalanMessageLoader::getMessage(
- theGuard.get(),
- XalanMessages::InfiniteRecursion_1Param,
- theElement->getElementName()));
- }
- else
- {
- throw XSLTProcessorException(
- getMemoryManager(),
- *theLocator,
- XalanMessageLoader::getMessage(
- theGuard.get(),
- XalanMessages::InfiniteRecursion_1Param,
- theElement->getElementName()));
- }
+ throw XSLTProcessorException(
+ getMemoryManager(),
+ XalanMessageLoader::getMessage(
+ theGuard.get(),
+ XalanMessages::InfiniteRecursion_1Param,
+ theElement->getElementName()),
+ theLocator);
}
m_elementRecursionStack.push_back(theElement);
@@ -1758,15 +1780,17 @@
if (theDFS == 0)
{
- GetAndReleaseCachedString theGuard(*this);
+ const GetCachedString theGuard(*this);
- warn(
+ problem(
+ eXSLTProcessor,
+ eWarning,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::Decimal_formatElementNotFound_1Param,
"format-number()"),
- context,
- locator);
+ locator,
+ context);
theDFS = getDecimalFormatSymbols(theEmptyQName);
@@ -2030,9 +2054,14 @@
StylesheetExecutionContextDefault::parseXML(
MemoryManagerType& theManager,
const XalanDOMString& urlString,
- const XalanDOMString& base) const
+ const XalanDOMString& base,
+ ErrorHandler* theErrorHandler) const
{
- return m_xpathExecutionContextDefault.parseXML(theManager, urlString, base);
+ return m_xpathExecutionContextDefault.parseXML(
+ theManager,
+ urlString,
+ base,
+ theErrorHandler);
}
@@ -2171,15 +2200,17 @@
}
else
{
- const GetAndReleaseCachedString theGuard(*this);
+ const GetCachedString theGuard(*this);
- error(
+ problem(
+ eXSLTProcessor,
+ eWarning,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::VariableIsNotDefined_1Param,
name.getLocalPart()),
- getCurrentNode(),
- locator);
+ locator,
+ getCurrentNode());
return getXObjectFactory().createUnknown(name.getLocalPart());
}
@@ -2408,128 +2439,6 @@
-void
-StylesheetExecutionContextDefault::error(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode) const
-{
- assert(m_xsltProcessor != 0);
-
- m_xsltProcessor->error(msg, sourceNode != 0 ? sourceNode : getCurrentNode(), &styleNode);
-}
-
-
-
-void
-StylesheetExecutionContextDefault::error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const
-{
- assert(m_xsltProcessor != 0);
-
- if (sourceNode == 0)
- {
- sourceNode = getCurrentNode();
- }
-
- if (locator != 0)
- {
- m_xsltProcessor->error(msg, *locator, sourceNode);
- }
- else
- {
- m_xsltProcessor->error(msg, sourceNode);
- }
-}
-
-
-void
-StylesheetExecutionContextDefault::warn(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode) const
-{
- assert(m_xsltProcessor != 0);
-
- if (sourceNode == 0)
- {
- sourceNode = getCurrentNode();
- }
-
- m_xsltProcessor->warn(msg, sourceNode, &styleNode);
-}
-
-
-
-void
-StylesheetExecutionContextDefault::warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const
-{
- assert(m_xsltProcessor != 0);
-
- if (sourceNode == 0)
- {
- sourceNode = getCurrentNode();
- }
-
- if (locator != 0)
- {
- m_xsltProcessor->warn(msg, *locator, sourceNode);
- }
- else
- {
- m_xsltProcessor->warn(msg, sourceNode);
- }
-}
-
-
-
-void
-StylesheetExecutionContextDefault::message(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode) const
-{
- assert(m_xsltProcessor != 0);
-
- if (sourceNode == 0)
- {
- sourceNode = getCurrentNode();
- }
-
- m_xsltProcessor->message(msg, sourceNode, &styleNode);
-}
-
-
-
-void
-StylesheetExecutionContextDefault::message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const
-{
- assert(m_xsltProcessor != 0);
-
- if (sourceNode == 0)
- {
- sourceNode = getCurrentNode();
- }
-
- if (locator != 0)
- {
- m_xsltProcessor->message(msg, *locator, sourceNode);
- }
- else
- {
- m_xsltProcessor->message(msg, sourceNode);
- }
-}
-
-
class PopAndPushContextMarker
{
public:
@@ -2551,6 +2460,7 @@
};
+
#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
void
StylesheetExecutionContextDefault::getParams(
@@ -3054,7 +2964,7 @@
-StylesheetExecutionContextDefault::FormatterToTextDOMString::FormatterToTextDOMString(MemoryManagerType& theManager) :
+StylesheetExecutionContextDefault::FormatterToTextDOMString::FormatterToTextDOMString(MemoryManager& theManager) :
FormatterToText(theManager),
m_printWriter(s_dummyString)
{
Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp Sun Aug 31 23:42:06 2008
@@ -217,24 +217,6 @@
// These interfaces are inherited from StylesheetExecutionContext...
- virtual void
- error(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode = 0) const;
-
- virtual void
- warn(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode = 0) const;
-
- virtual void
- message(
- const XalanDOMString& msg,
- const ElemTemplateElement& styleNode,
- const XalanNode* sourceNode = 0) const;
-
virtual bool
getQuietConflictWarnings() const;
@@ -860,7 +842,8 @@
parseXML(
MemoryManagerType& theManager,
const XalanDOMString& urlString,
- const XalanDOMString& base) const;
+ const XalanDOMString& base,
+ ErrorHandler* theErrorHandler = 0) const;
virtual MutableNodeRefList*
borrowMutableNodeRefList();
@@ -978,25 +961,20 @@
XalanDocument* theDocument);
// These interfaces are inherited from ExecutionContext...
-
- virtual void
- error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const;
-
- virtual void
- warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const;
-
- virtual void
- message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const LocatorType* locator) const;
-
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode);
+
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode);
class XPathCacheReturnFunctor
{
Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetHandler.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetHandler.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetHandler.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetHandler.cpp Sun Aug 31 23:42:06 2008
@@ -68,7 +68,7 @@
-typedef StylesheetConstructionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
+typedef StylesheetConstructionContext::GetCachedString GetCachedString;
@@ -108,7 +108,7 @@
-void StylesheetHandler::setDocumentLocator(const LocatorType* const locator)
+void StylesheetHandler::setDocumentLocator(const Locator* const locator)
{
m_constructionContext.pushLocatorOnStack(locator);
@@ -159,7 +159,7 @@
const LocatorType* locator,
bool& fPreserve)
{
- if(m_constructionContext.isXMLSpaceAttribute(aname, m_stylesheet, locator) == false)
+ if (m_constructionContext.isXMLSpaceAttribute(aname, m_stylesheet, locator) == false)
{
fPreserve = false;
@@ -169,17 +169,17 @@
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, Constants::ATTRVAL_DEFAULT))
+ if (equals(spaceVal, Constants::ATTRVAL_DEFAULT))
{
fPreserve = false;
}
- else if(equals(spaceVal, Constants::ATTRVAL_PRESERVE))
+ else if (equals(spaceVal, Constants::ATTRVAL_PRESERVE))
{
fPreserve = true;
}
else
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -259,7 +259,7 @@
const XalanDOMString::size_type nameLength = length(name);
const XalanDOMString::size_type index = indexOf(name, XalanUnicode::charColon);
- const GetAndReleaseCachedString theGuard2(m_constructionContext);
+ const GetCachedString theGuard2(m_constructionContext);
XalanDOMString& buffer = theGuard2.get();
const XalanDOMString* ns = getNamespaceFromStack(name, buffer);
@@ -268,7 +268,7 @@
{
if (index < nameLength)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -353,7 +353,7 @@
{
if (m_elemStack.empty() == true)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -385,7 +385,7 @@
{
if (m_elemStack.empty() == true)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -404,7 +404,7 @@
if (parentToken == StylesheetConstructionContext::ELEMNAME_FOR_EACH)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -443,7 +443,7 @@
if(StylesheetConstructionContext::ELEMNAME_CHOOSE != parent->getXSLToken())
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -470,7 +470,7 @@
}
else
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -489,7 +489,7 @@
if(StylesheetConstructionContext::ELEMNAME_CHOOSE != parent->getXSLToken())
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -516,7 +516,7 @@
}
else
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -559,7 +559,7 @@
case StylesheetConstructionContext::ELEMNAME_STRIP_SPACE:
case StylesheetConstructionContext::ELEMNAME_DECIMAL_FORMAT:
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -576,7 +576,7 @@
// supported, don't flag an error.
if(m_constructionContext.getXSLTVersionSupported() < m_stylesheet.getXSLTVerDeclared())
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
warn(
XalanMessageLoader::getMessage(
@@ -594,7 +594,7 @@
}
else
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -624,7 +624,7 @@
}
else if (length(*ns) == 0 && m_elemStack.size() == 1)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -902,7 +902,7 @@
case StylesheetConstructionContext::ELEMNAME_APPLY_IMPORTS:
if (inExtensionElement() == false)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -927,7 +927,7 @@
}
else
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -966,7 +966,7 @@
}
else if (equals(aname, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
XalanDOMString& prefix = theGuard.get();
@@ -981,7 +981,7 @@
if (extns == 0)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1027,7 +1027,7 @@
if (fVersionFound == false)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1068,7 +1068,7 @@
if (m_globalVariableNames.count(theVariableName) != 0)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1094,7 +1094,7 @@
if (theLocalScope.count(theVariableName) != 0)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1139,7 +1139,7 @@
StringTokenizer tokenizer(atts.getValue(i),
Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
XalanDOMString& theNameTest = theGuard.get();
@@ -1168,7 +1168,7 @@
if (!foundIt && inExtensionElement() == false)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1222,7 +1222,7 @@
{
if (e.getExceptionCode() == XalanDOMException::HIERARCHY_REQUEST_ERR)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
const XalanMessages::Codes theCode =
elem->getXSLToken() == StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT ?
@@ -1288,7 +1288,7 @@
bool foundIt = false;
- const GetAndReleaseCachedString theGuard4(m_constructionContext);
+ const GetCachedString theGuard4(m_constructionContext);
XalanDOMString& hrefUrl = theGuard4.get();
for (XalanSize_t i = 0; i < nAttrs; i++)
@@ -1301,7 +1301,7 @@
if (m_foundNotImport)
{
- const GetAndReleaseCachedString theError(m_constructionContext);
+ const GetCachedString theError(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1310,13 +1310,13 @@
locator);
}
- const GetAndReleaseCachedString theGuard1(m_constructionContext);
+ const GetCachedString theGuard1(m_constructionContext);
XalanDOMString& saved_XSLNameSpaceURL = theGuard1.get();
saved_XSLNameSpaceURL = m_stylesheet.getXSLTNamespaceURI();
- const GetAndReleaseCachedString theGuard2(m_constructionContext);
+ const GetCachedString theGuard2(m_constructionContext);
XalanDOMString& href = theGuard2.get();
@@ -1337,7 +1337,7 @@
if (stackContains(importStack, hrefUrl))
{
- const GetAndReleaseCachedString theError(m_constructionContext);
+ const GetCachedString theError(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1380,7 +1380,7 @@
if (!foundIt)
{
- const GetAndReleaseCachedString theError(m_constructionContext);
+ const GetCachedString theError(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1404,10 +1404,10 @@
bool foundIt = false;
- const GetAndReleaseCachedString theGuard1(m_constructionContext);
+ const GetCachedString theGuard1(m_constructionContext);
XalanDOMString& href = theGuard1.get();
- const GetAndReleaseCachedString theGuard2(m_constructionContext);
+ const GetCachedString theGuard2(m_constructionContext);
XalanDOMString& hrefUrl = theGuard2.get();
for (XalanSize_t i = 0; i < nAttrs; i++)
@@ -1428,7 +1428,7 @@
if (stackContains(m_stylesheet.getIncludeStack(), hrefUrl))
{
- const GetAndReleaseCachedString theError(m_constructionContext);
+ const GetCachedString theError(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1453,7 +1453,7 @@
if (!foundIt)
{
- const GetAndReleaseCachedString theError(m_constructionContext);
+ const GetCachedString theError(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1534,7 +1534,7 @@
inExtensionElement() == false &&
isXMLWhitespace(chars, 0, length) == false)
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
@@ -1631,7 +1631,7 @@
const XMLCh* chars,
size_type length)
{
- if(m_inTemplate)
+ if (m_inTemplate)
{
ElemTemplateElement* parent = m_elemStack.back();
assert(parent != 0);
@@ -1641,7 +1641,8 @@
bool preserveSpace = m_preserveSpaceStack.back();
bool disableOutputEscaping = false;
- if (preserveSpace == false && parent->getXSLToken() == StylesheetConstructionContext::ELEMNAME_TEXT)
+ if (preserveSpace == false &&
+ parent->getXSLToken() == StylesheetConstructionContext::ELEMNAME_TEXT)
{
disableOutputEscaping = static_cast<ElemText*>(parent)->getDisableOutputEscaping();
@@ -1650,7 +1651,7 @@
parent = m_elemStack[m_elemStack.size() - 2];
}
- const LocatorType* const locator = m_constructionContext.getLocatorFromStack();
+ const Locator* const locator = m_constructionContext.getLocatorFromStack();
ElemTemplateElement* const elem =
m_constructionContext.createElement(
@@ -1664,9 +1665,9 @@
const bool isWhite = elem->isWhitespace();
- if(preserveSpace || (!preserveSpace && !isWhite))
+ if (preserveSpace || (!preserveSpace && !isWhite))
{
- while(!m_whiteSpaceElems.empty())
+ while (!m_whiteSpaceElems.empty())
{
assert(m_whiteSpaceElems.back() != 0);
@@ -1681,13 +1682,13 @@
parent,
elem);
}
- else if(isWhite)
+ else if (isWhite)
{
bool shouldPush = true;
ElemTemplateElement* const last = parent->getLastChildElem();
- if(0 != last)
+ if (0 != last)
{
// If it was surrounded by xsl:text, it will count as an element.
const bool isPrevCharData =
@@ -1696,7 +1697,7 @@
const bool isLastPoppedXSLText = (m_lastPopped != 0) &&
(StylesheetConstructionContext::ELEMNAME_TEXT == m_lastPopped->getXSLToken());
- if(isPrevCharData == true && isLastPoppedXSLText == false)
+ if (isPrevCharData == true && isLastPoppedXSLText == false)
{
appendChildElementToParent(
parent,
@@ -1706,7 +1707,7 @@
}
}
- if(shouldPush)
+ if (shouldPush)
{
m_whiteSpaceElems.push_back(elem);
}
@@ -1722,7 +1723,7 @@
const XMLCh* chars,
size_type length)
{
- if(m_inTemplate)
+ if (m_inTemplate)
{
append(m_accumulateText, chars, length);
}
@@ -1766,9 +1767,14 @@
void
StylesheetHandler::error(
const XalanDOMString& theMessage,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
- m_constructionContext.error(theMessage, 0, theLocator);
+ m_constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eError,
+ theMessage,
+ theLocator,
+ 0);
}
@@ -1777,9 +1783,9 @@
StylesheetHandler::error(
const XalanDOMChar* theMessage1,
const XalanDOMChar* theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
XalanDOMString& msg = theGuard.get();
@@ -1796,7 +1802,7 @@
StylesheetHandler::error(
const XalanDOMChar* theMessage1,
const XalanDOMString& theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
error(theMessage1, theMessage2.c_str(), theLocator);
}
@@ -1807,7 +1813,7 @@
StylesheetHandler::error(
const XalanDOMString& theMessage1,
const XalanDOMChar* theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
error(theMessage1.c_str(), theMessage2, theLocator);
}
@@ -1819,7 +1825,7 @@
StylesheetHandler::error(
const XalanDOMString& theMessage1,
const XalanDOMString& theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
error(theMessage1.c_str(), theMessage2.c_str(), theLocator);
}
@@ -1830,7 +1836,7 @@
StylesheetHandler::warn(
const XalanDOMChar* theMessage1,
const XalanDOMString& theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
warn(theMessage1, theMessage2.c_str(), theLocator);
}
@@ -1838,9 +1844,14 @@
void
StylesheetHandler::warn(
const XalanDOMString& theMessage,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
- m_constructionContext.warn(theMessage, 0, theLocator);
+ m_constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eWarning,
+ theMessage,
+ theLocator,
+ 0);
}
@@ -1849,16 +1860,21 @@
StylesheetHandler::warn(
const XalanDOMChar* theMessage1,
const XalanDOMChar* theMessage2,
- const LocatorType* theLocator) const
+ const Locator* theLocator) const
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
XalanDOMString& msg = theGuard.get();
msg = theMessage1;
msg += theMessage2;
- m_constructionContext.warn(msg, 0, theLocator);
+ m_constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eWarning,
+ msg,
+ theLocator,
+ 0);
}
@@ -1870,7 +1886,7 @@
const LocatorType* theLocator) const
{
- const GetAndReleaseCachedString theGuard(m_constructionContext);
+ const GetCachedString theGuard(m_constructionContext);
error(
XalanMessageLoader::getMessage(
Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp Sun Aug 31 23:42:06 2008
@@ -302,6 +302,8 @@
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext) const
{
+ typedef StylesheetExecutionContext::GetCachedString GetCachedString;
+
FormatterListener* flistener = outputTarget.getFormatterListener();
if (flistener != 0)
@@ -344,12 +346,14 @@
{
const GetCachedString theGuard(executionContext);
- executionContext.error(
+ executionContext.problem(
+ StylesheetExecutionContext::eXSLTProcessor,
+ StylesheetExecutionContext::eError,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::NoValidResultTarget),
- executionContext.getCurrentNode(),
- 0);
+ 0,
+ executionContext.getCurrentNode());
}
}
@@ -452,12 +456,14 @@
{
const GetCachedString theGuard(executionContext);
- executionContext.error(
+ executionContext.problem(
+ StylesheetExecutionContext::eXSLTProcessor,
+ StylesheetExecutionContext::eError,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::NoValidResultTarget),
- executionContext.getCurrentNode(),
- 0);
+ 0,
+ executionContext.getCurrentNode());
}
executionContext.setFormatterListener(flistener);
@@ -501,13 +507,15 @@
{
const StylesheetConstructionContext::GetCachedString theGuard(constructionContext);
- constructionContext.warn(
+ constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eWarning,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::OutputHasAnUnknownMethod_1Param,
method),
- 0,
- theLocator);
+ theLocator,
+ 0);
}
}
else if (equals(aname, Constants::ATTRNAME_OUTPUT_VERSION))
@@ -557,7 +565,7 @@
m_cdataSectionElems.reserve(m_cdataSectionElems.size() + theTokenCount);
- StylesheetConstructionContext::GetAndReleaseCachedString theGuard(constructionContext);
+ const StylesheetConstructionContext::GetCachedString theGuard(constructionContext);
XalanDOMString& theToken = theGuard.get();
@@ -601,27 +609,31 @@
{
const StylesheetConstructionContext::GetCachedString theGuard(constructionContext);
- constructionContext.warn(
+ constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eWarning,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::UnsupportedXalanSpecificAttribute_1Param,
theAttributeName.getLocalPart()),
- 0,
- theLocator);
+ theLocator,
+ 0);
}
}
else if (isAttrOK(aname, atts, i, constructionContext) == false)
{
const StylesheetConstructionContext::GetCachedString theGuard(constructionContext);
- constructionContext.error(
+ constructionContext.problem(
+ StylesheetConstructionContext::eXSLTProcessor,
+ StylesheetConstructionContext::eError,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::HasIllegalAttribute_2Param,
name,
aname),
- 0,
- theLocator);
+ theLocator,
+ 0);
}
}
}
@@ -849,16 +861,20 @@
if (nl == 0)
{
+ typedef StylesheetExecutionContext::GetCachedString GetCachedString;
+
const GetCachedString theGuard1(executionContext);
const GetCachedString theGuard2(executionContext);
- executionContext.error(
+ executionContext.problem(
+ StylesheetExecutionContext::eXSLTProcessor,
+ StylesheetExecutionContext::eError,
XalanMessageLoader::getMessage(
theGuard1.get(),
XalanMessages::UnknownKey_1Param,
qname.format(theGuard2.get())),
- executionContext.getCurrentNode(),
- locator);
+ locator,
+ executionContext.getCurrentNode());
}
else if (nodelist.empty() == true)
{
@@ -931,15 +947,17 @@
if (i == m_attributeSetsMap.end())
{
- const GetCachedString theGuard(executionContext);
+ const StylesheetExecutionContext::GetCachedString theGuard(executionContext);
- executionContext.error(
+ executionContext.problem(
+ StylesheetExecutionContext::eXSLTProcessor,
+ StylesheetExecutionContext::eError,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::UnknownNodeType_1Param,
Constants::ELEMNAME_ATTRIBUTESET_WITH_PREFIX_STRING),
- executionContext.getCurrentNode(),
- theLocator);
+ theLocator,
+ executionContext.getCurrentNode());
}
else
{
Modified: xalan/c/trunk/src/xalanc/XSLT/VariablesStack.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/VariablesStack.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/VariablesStack.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/VariablesStack.cpp Sun Aug 31 23:42:06 2008
@@ -392,12 +392,14 @@
{
const StylesheetExecutionContext::GetCachedString theGuard(executionContext);
- executionContext.error(
+ executionContext.problem(
+ StylesheetExecutionContext::eXSLTProcessor,
+ StylesheetExecutionContext::eError,
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::CircularVariableDefWasDetected),
- doc,
- var->getLocator());
+ var->getLocator(),
+ doc);
}
m_guardStack.push_back(var);
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.cpp Sun Aug 31 23:42:06 2008
@@ -204,13 +204,59 @@
-//==========================================================
-// SECTION: Main API Functions
-//==========================================================
+void
+XSLTEngineImpl::problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode)
+{
+ if (m_problemListener != 0)
+ {
+ m_problemListener->problem(
+ source,
+ classification,
+ msg,
+ locator,
+ sourceNode);
+ }
+ if (classification == ProblemListener::eERROR)
+ {
+ throw XSLTProcessorException(
+ getMemoryManager(),
+ msg,
+ locator);
+ }
+}
-static const XalanDOMChar s_dummyString = 0;
+
+void
+XSLTEngineImpl::problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode)
+{
+ if (m_problemListener != 0)
+ {
+ m_problemListener->problem(
+ source,
+ classification,
+ msg,
+ sourceNode);
+ }
+
+ if (classification == ProblemListener::eERROR)
+ {
+ throw XSLTProcessorException(
+ getMemoryManager(),
+ msg);
+ }
+}
+
void
@@ -308,7 +354,7 @@
if (isOK == true && theStylesheetURI.empty() == false)
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
XalanDOMString& sysid = theGuard.get();
@@ -330,12 +376,14 @@
if(0 == m_stylesheetRoot)
{
- const ECGetAndReleaseCachedString theGuard(executionContext);
+ const ECGetCachedString theGuard(executionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
- XalanMessages::FailedToProcessStylesheet));
+ XalanMessages::FailedToProcessStylesheet),
+ 0,
+ sourceTree);
}
else if(0 != sourceTree)
{
@@ -369,12 +417,14 @@
{
if (m_stylesheetRoot == 0)
{
- const ECGetAndReleaseCachedString theGuard(executionContext);
+ const ECGetCachedString theGuard(executionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
- XalanMessages::NoStylesheet));
+ XalanMessages::NoStylesheet),
+ 0,
+ sourceTree);
}
FormatterListener* const theFormatter =
@@ -419,7 +469,7 @@
if (systemID != 0 || stylesheetNode != 0 || stylesheetSource.getStream() != 0)
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
XalanDOMString& xslIdentifier = theGuard.get();
@@ -433,12 +483,14 @@
if (theType != XalanNode::ELEMENT_NODE && theType != XalanNode::DOCUMENT_NODE)
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
- XalanMessages::CompilingDOMStylesheetReqDocument));
+ XalanMessages::CompilingDOMStylesheetReqDocument),
+ constructionContext.getLocatorFromStack(),
+ 0);
}
else
{
@@ -495,7 +547,7 @@
if(0 == sourceTree)
{
- const CCGetAndReleaseCachedString theGuard1(m_xpathConstructionContext);
+ const CCGetCachedString theGuard1(m_xpathConstructionContext);
XalanDOMString& xmlIdentifier = theGuard1.get();
@@ -557,7 +609,8 @@
XSLTEngineImpl::parseXML(
const XalanDOMString& urlString,
DocumentHandler* docHandler,
- XalanDocument* docToRegister)
+ XalanDocument* docToRegister,
+ ErrorHandler* theErrorHandler)
{
XalanDocument* doc =
@@ -594,7 +647,8 @@
doc = parseXML(
*resolverInputSource.get(),
docHandler,
- docToRegister);
+ docToRegister,
+ theErrorHandler);
}
else
{
@@ -605,7 +659,8 @@
doc = parseXML(
inputSource,
docHandler,
- docToRegister);
+ docToRegister,
+ theErrorHandler);
}
if (doc != 0)
@@ -623,9 +678,21 @@
XSLTEngineImpl::parseXML(
const InputSource& inputSource,
DocumentHandler* docHandler,
- XalanDocument* docToRegister)
+ XalanDocument* docToRegister,
+ ErrorHandler* theErrorHandler)
{
- if(0 != docHandler)
+ typedef XMLParserLiaison::EnsureResetErrorHandler EnsureResetErrorHandler;
+
+ EnsureResetErrorHandler theGuard;
+
+ if (theErrorHandler != 0)
+ {
+ theGuard.set(
+ &m_parserLiaison,
+ theErrorHandler);
+ }
+
+ if (0 != docHandler)
{
m_parserLiaison.parseXMLStream(
inputSource,
@@ -657,10 +724,10 @@
Stylesheet* stylesheet = 0;
- const CCGetAndReleaseCachedString theGuard(constructionContext);
- XalanDOMString & stringHolder = theGuard.get();
+ const CCGetCachedString theGuard(constructionContext);
+ XalanDOMString& stringHolder = theGuard.get();
- const CCGetAndReleaseCachedString theGuard1(constructionContext);
+ const CCGetCachedString theGuard1(constructionContext);
XalanDOMString& localXSLURLString = theGuard1.get();
trim(xslURLString, localXSLURLString);
@@ -670,7 +737,7 @@
if(fragIndex == 0)
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
XalanDOMString& fragID = theGuard.get();
@@ -701,19 +768,21 @@
}
else
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::CantFindFragment_1Param,
- fragID));
+ fragID),
+ constructionContext.getLocatorFromStack(),
+ &fragBase);
}
}
// Try a bunch of really ugly stuff to find the fragment.
// What's the right way to do this?
- const CCGetAndReleaseCachedString theGuard3(constructionContext);
+ const CCGetCachedString theGuard3(constructionContext);
XalanDOMString& ds = theGuard3.get();
@@ -771,13 +840,15 @@
if(nl.getLength() == 0)
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::CantFindFragment_1Param,
- fragID));
+ fragID),
+ constructionContext.getLocatorFromStack(),
+ &fragBase);
}
XalanNode* const frag = nl.item(0);
@@ -818,13 +889,15 @@
}
else
{
- const CCGetAndReleaseCachedString theGuard(constructionContext);
+ const CCGetCachedString theGuard(constructionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::NodePointedByFragment_1Param,
- fragID));
+ fragID),
+ constructionContext.getLocatorFromStack(),
+ &fragBase);
}
}
else
@@ -1022,207 +1095,6 @@
void
-XSLTEngineImpl::message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const
-{
- problem(msg, ProblemListener::eMESSAGE, sourceNode, styleNode);
-}
-
-
-
-void
-XSLTEngineImpl::message(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode) const
-{
- problem(msg, ProblemListener::eMESSAGE, locator, sourceNode);
-}
-
-
-
-void
-XSLTEngineImpl::problem(
- const XalanDOMString& msg,
- ProblemListener::eClassification classification,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const
-{
- const XalanDOMChar* id = 0;
-
- MemoryManager& theManager =
- const_cast<XSLTEngineImpl*>(this)->getMemoryManager();
-
- XalanDOMString uri(theManager);
-
- XalanFileLoc lineNumber =
- XalanLocator::getUnknownValue();
-
- XalanFileLoc columnNumber =
- XalanLocator::getUnknownValue();
-
- const LocatorType* locator = getLocatorFromStack();
-
- if (locator == 0 && styleNode != 0)
- {
- locator = styleNode->getLocator();
- }
-
- if (locator != 0)
- {
- id = locator->getPublicId();
-
- if (id == 0)
- {
- id = locator->getSystemId();
- }
-
- if (id != 0)
- {
- uri = id;
- }
-
- lineNumber = locator->getLineNumber();
- columnNumber = locator->getColumnNumber();
- }
- else if (styleNode != 0)
- {
- lineNumber = styleNode->getLineNumber();
- columnNumber = styleNode->getColumnNumber();
-
- uri = styleNode->getURI();
- }
-
- if (m_problemListener != 0)
- {
- m_problemListener->problem(
- ProblemListener::eXSLPROCESSOR,
- classification,
- sourceNode,
- styleNode,
- msg,
- id,
- lineNumber,
- columnNumber);
- }
-
- if (classification == ProblemListener::eERROR)
- {
- throw XSLTProcessorException(
- theManager,
- msg,
- uri,
- lineNumber,
- columnNumber);
- }
-}
-
-
-
-static const XalanDOMChar theDummy = 0;
-
-void
-XSLTEngineImpl::problem(
- const XalanDOMString& msg,
- ProblemListener::eClassification classification,
- const LocatorType& locator,
- const XalanNode* sourceNode) const
-{
- const XalanDOMChar* id = locator.getSystemId();
-
- if (id == 0)
- {
- id = &theDummy;
- }
-
- XalanFileLoc lineNumber = locator.getLineNumber();
- XalanFileLoc columnNumber = locator.getColumnNumber();
-
- if (m_problemListener != 0)
- {
- m_problemListener->problem(
- ProblemListener::eXSLPROCESSOR,
- classification,
- sourceNode,
- 0,
- msg,
- id,
- lineNumber,
- columnNumber);
- }
-
- if (classification == ProblemListener::eERROR)
- {
- MemoryManagerType& theManager = const_cast<XSLTEngineImpl*>(this)->getMemoryManager();
-
- throw XSLTProcessorException(
- theManager,
- msg,
- XalanDOMString(
- id,
- theManager),
- lineNumber,
- columnNumber);
- }
-}
-
-
-
-void
-XSLTEngineImpl::warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const
-{
- const LocatorType* const locator = styleNode == 0 ? 0 : styleNode->getLocator();
-
- if (locator != 0)
- {
- problem(msg, ProblemListener::eWARNING, *locator, sourceNode);
- }
- else
- {
- problem(msg, ProblemListener::eWARNING, sourceNode, styleNode);
- }
-}
-
-
-
-void
-XSLTEngineImpl::warn(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode) const
-{
- problem(msg, ProblemListener::eWARNING, locator, sourceNode);
-}
-
-
-void
-XSLTEngineImpl::error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const
-{
- problem(msg, ProblemListener::eERROR, sourceNode, styleNode);
-}
-
-
-
-void
-XSLTEngineImpl::error(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode) const
-{
- problem(msg, ProblemListener::eERROR, locator, sourceNode);
-}
-
-
-
-void
XSLTEngineImpl::setDiagnosticsOutput(PrintWriter* pw)
{
m_diagnosticsPrintWriter = pw;
@@ -1257,7 +1129,7 @@
{
if (0 != m_diagnosticsPrintWriter)
{
- const ECGetAndReleaseCachedString theGuard(executionContext);
+ const ECGetCachedString theGuard(executionContext);
XalanDOMString& msg = theGuard.get();
@@ -1273,7 +1145,7 @@
{
msg.append("*|text(), (default select), ");
}
- const ECGetAndReleaseCachedString theGuard1(executionContext);
+ const ECGetCachedString theGuard1(executionContext);
XalanDOMString& theBuffer = theGuard1.get();
NumberToDOMString(nl.getLength(), theBuffer);
@@ -1437,7 +1309,7 @@
{
assert(m_executionContext != 0);
- const ECGetAndReleaseCachedString prefixGuard(*m_executionContext);
+ const ECGetCachedString prefixGuard(*m_executionContext);
XalanDOMString& prefix = prefixGuard.get();
@@ -1488,7 +1360,7 @@
{
assert(m_executionContext != 0);
- const ECGetAndReleaseCachedString theGuard(*m_executionContext);
+ const ECGetCachedString theGuard(*m_executionContext);
XalanDOMString& theMessage =
theGuard.get();
@@ -1507,14 +1379,10 @@
theName);
}
- if (locator != 0)
- {
- error(theMessage, *locator);
- }
- else
- {
- error(theMessage);
- }
+ error(
+ theMessage,
+ locator,
+ m_executionContext->getCurrentNode());
}
@@ -1565,7 +1433,7 @@
if (theWriter == 0)
{
- const ECGetAndReleaseCachedString theGuard(*m_executionContext);
+ const ECGetCachedString theGuard(*m_executionContext);
XalanDOMString& theMessage =
theGuard.get();
@@ -1579,20 +1447,10 @@
theMessage,
XalanMessages::CannotSwitchToHTMLOutputMethod);
- if (theLocator != 0)
- {
- warn(
- theMessage,
- *theLocator,
- 0);
- }
- else
- {
- warn(
- theMessage,
- 0,
- 0);
- }
+ warn(
+ theMessage,
+ theLocator,
+ 0);
}
else if (theFormatter->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
{
@@ -2089,26 +1947,17 @@
{
assert(m_executionContext != 0);
- const ECGetAndReleaseCachedString theGuard(*m_executionContext);
+ const ECGetCachedString theGuard(*m_executionContext);
const XalanDOMString& theMessage =
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::OnlyTextNodesCanBeCopied);
- if (locator != 0)
- {
- warn(
- theMessage,
- *locator,
- sourceNode);
- }
- else
- {
- warn(
- theMessage,
- sourceNode);
- }
+ warn(
+ theMessage,
+ locator,
+ sourceNode);
}
@@ -2244,9 +2093,7 @@
const XalanDOMString& thePrefix,
const XalanDOMString& theNamespaceURI)
{
- typedef StylesheetExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
-
- const GetAndReleaseCachedString theCachedString(theExecutionContext);
+ const XSLTEngineImpl::ECGetCachedString theCachedString(theExecutionContext);
createAndAddNamespaceResultAttribute(
theExecutionContext,
@@ -2264,9 +2111,9 @@
const XalanDOMString& theNamespaceURI,
const XalanDOMString& theValue)
{
- typedef StylesheetExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
+ typedef StylesheetExecutionContext::GetCachedString GetCachedString;
- const GetAndReleaseCachedString theCachedString(theExecutionContext);
+ const GetCachedString theCachedString(theExecutionContext);
XalanDOMString& theBuffer = theCachedString.get();
@@ -2369,26 +2216,17 @@
}
else
{
- const ECGetAndReleaseCachedString theGuard(*m_executionContext);
+ const ECGetCachedString theGuard(*m_executionContext);
const XalanDOMString& theMessage =
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::WrongAttemptingToAddAttrinbute);
- if (locator != 0)
- {
- warn(
- theMessage,
- *locator,
- &node);
- }
- else
- {
- warn(
- theMessage,
- &node);
- }
+ warn(
+ theMessage,
+ locator,
+ &node);
}
break;
@@ -2418,26 +2256,17 @@
default:
{
- const ECGetAndReleaseCachedString theGuard(*m_executionContext);
+ const ECGetCachedString theGuard(*m_executionContext);
const XalanDOMString& theMessage =
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::CantCreateItemInResultTree);
- if (locator != 0)
- {
- warn(
- theMessage,
- *locator,
- &node);
- }
- else
- {
- warn(
- theMessage,
- &node);
- }
+ warn(
+ theMessage,
+ locator,
+ &node);
}
break;
}
@@ -2647,7 +2476,7 @@
bool
-XSLTEngineImpl::isCDataResultElem(const XalanDOMString& elementName) const
+XSLTEngineImpl::isCDataResultElem(const XalanDOMString& elementName)
{
assert(m_executionContext != 0);
assert(m_hasCDATASectionElements == true);
@@ -2676,10 +2505,8 @@
}
else
{
- typedef ECGetAndReleaseCachedString GetAndReleaseCachedString;
-
- const GetAndReleaseCachedString elemLocalNameGuard(*m_executionContext);
- const GetAndReleaseCachedString prefixGuard(*m_executionContext);
+ const ECGetCachedString elemLocalNameGuard(*m_executionContext);
+ const ECGetCachedString prefixGuard(*m_executionContext);
XalanDOMString& elemLocalName = elemLocalNameGuard.get();
XalanDOMString& prefix = prefixGuard.get();
@@ -2702,13 +2529,15 @@
if(elemNS == 0)
{
- GetAndReleaseCachedString theGuard(*m_executionContext);
+ ECGetCachedString theGuard(*m_executionContext);
error(
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::PrefixIsNotDeclared_1Param,
- prefix));
+ prefix),
+ 0,
+ m_executionContext->getCurrentNode());
}
else
{
@@ -2936,7 +2765,7 @@
}
else if (startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator))
{
- const ECGetAndReleaseCachedString prefixGuard(*m_executionContext);
+ const ECGetCachedString prefixGuard(*m_executionContext);
XalanDOMString& thePrefix = prefixGuard.get();
@@ -3315,6 +3144,54 @@
void
+XSLTEngineImpl::error(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode)
+{
+ problem(
+ eXSLTProcessor,
+ eError,
+ theMessage,
+ theLocator,
+ theSourceNode);
+}
+
+
+
+void
+XSLTEngineImpl::warn(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode)
+{
+ problem(
+ eXSLTProcessor,
+ eWarning,
+ theMessage,
+ theLocator,
+ theSourceNode);
+}
+
+
+
+void
+XSLTEngineImpl::message(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode)
+{
+ problem(
+ eXSLTProcessor,
+ eMessage,
+ theMessage,
+ theLocator,
+ theSourceNode);
+}
+
+
+
+void
XSLTEngineImpl::installFunctions(MemoryManagerType& theManager)
{
XPath::installFunction(XPathFunctionTable::s_current, FunctionCurrent());
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTEngineImpl.hpp Sun Aug 31 23:42:06 2008
@@ -180,8 +180,8 @@
typedef XalanMemMgrAutoPtr<XPathProcessor, true> XPathProcessorPtrType;
typedef Function::XObjectArgVectorType XObjectArgVectorType;
typedef StylesheetExecutionContext::ParamVectorType ParamVectorType;
- typedef XPathConstructionContext::GetAndReleaseCachedString CCGetAndReleaseCachedString;
- typedef XPathExecutionContext::GetAndReleaseCachedString ECGetAndReleaseCachedString;
+ typedef XPathConstructionContext::GetCachedString CCGetCachedString;
+ typedef XPathExecutionContext::GetCachedString ECGetCachedString;
typedef XalanMap<XalanDOMString, XalanParamHolder> ParamMapType;
@@ -212,6 +212,12 @@
~XSLTEngineImpl();
MemoryManager&
+ getMemoryManager() const
+ {
+ return m_xpathConstructionContext.getMemoryManager();
+ }
+
+ MemoryManager&
getMemoryManager()
{
return m_xpathConstructionContext.getMemoryManager();
@@ -231,7 +237,22 @@
terminate();
// These methods are inherited from XSLTProcessor ...
-
+
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode);
+
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode);
+
virtual void
process(
const XSLTInputSource& inputSource,
@@ -363,7 +384,8 @@
parseXML(
const XalanDOMString& urlString,
DocumentHandler* docHandler,
- XalanDocument* docToRegister);
+ XalanDocument* docToRegister,
+ ErrorHandler* theErrorHandler = 0);
/**
* Read in the XML file, either producing a Document or calling SAX events,
@@ -380,7 +402,8 @@
parseXML(
const InputSource& inputSource,
DocumentHandler* docHandler,
- XalanDocument* docToRegister);
+ XalanDocument* docToRegister,
+ ErrorHandler* theErrorHandler = 0);
/**
* Reset the state of the XSL processor by reading in a new XSL stylesheet
@@ -850,45 +873,6 @@
return m_quietConflictWarnings;
}
- virtual void
- message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const;
-
- virtual void
- message(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const;
-
- virtual void
- warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const;
-
-
- virtual void
- warn(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const;
-
- virtual void
- error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const;
-
- virtual void
- error(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const;
-
-public:
-
/**
* Retrieve the result namespace corresponding to a prefix.
*
@@ -1542,6 +1526,11 @@
const LocatorType& locator,
const XalanNode* sourceNode) const;
+ void
+ problem(
+ const XalanDOMString& msg,
+ ProblemListener::eClassification classification) const;
+
//==========================================================
// SECTION: Function to do with attribute handling
//==========================================================
@@ -1597,7 +1586,7 @@
* @return true if it should output as cdata
*/
bool
- isCDataResultElem(const XalanDOMString& elementName) const;
+ isCDataResultElem(const XalanDOMString& elementName);
void
fireCharacterGenerateEvent(
@@ -1626,7 +1615,23 @@
const XalanDOMString& theElementName,
const XalanDOMString& theElementNamespaceURI);
+ void
+ error(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode);
+
+ void
+ warn(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode);
+ void
+ message(
+ const XalanDOMString& theMessage,
+ const Locator* theLocator,
+ const XalanNode* theSourceNode);
// Data members...
XMLParserLiaison& m_parserLiaison;
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.cpp Sun Aug 31 23:42:06 2008
@@ -19,11 +19,17 @@
+// Necessary for the static asserts below...
+#include "xalanc/XPath/XPathEnvSupport.hpp"
+
+
+
XALAN_CPP_NAMESPACE_BEGIN
-XSLTProcessor::XSLTProcessor()
+XSLTProcessor::XSLTProcessor() :
+ ProblemListenerBase()
{
}
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessor.hpp Sun Aug 31 23:42:06 2008
@@ -30,6 +30,10 @@
+#include "xalanc/PlatformSupport/ProblemListenerBase.hpp"
+
+
+
XALAN_DECLARE_XERCES_CLASS(Locator)
@@ -38,7 +42,7 @@
-typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType;
+XALAN_USING_XERCES(Locator);
@@ -78,7 +82,7 @@
*
* If you reuse the processor instance, you should call reset() between calls.
*/
-class XALAN_XSLT_EXPORT XSLTProcessor
+class XALAN_XSLT_EXPORT XSLTProcessor : public ProblemListenerBase
{
public:
@@ -89,6 +93,25 @@
virtual
~XSLTProcessor();
+
+ // These interfaces are inherited from ProblemListenerBase.
+
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode) = 0;
+
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode) = 0;
+
+ // These interfaces are new to XSLTProcessor
/**
* Transform the source tree to the output in the given result tree target.
* The processor will process the input source, the stylesheet source,
@@ -358,85 +381,6 @@
*/
virtual void
setDiagnosticsOutput(PrintWriter* pw) = 0;
-
- /**
- * Report a message.
- *
- * @param msg text of message to output
- * @param sourceNode node in source where message occurred
- * @param styleNode node in stylesheet where message occurred
- */
- virtual void
- message(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const = 0;
-
- /**
- * Report a message.
- *
- * @param msg text of message to output
- * @param locator A LocatorType for error reporting
- * @param sourceNode node in source where message occurred
- */
- virtual void
- message(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const = 0;
-
- /**
- * Report a warning.
- *
- * @param msg text of message to output
- * @param sourceNode node in source where warning occurred
- * @param styleNode node in stylesheet where warning occurred
- */
- virtual void
- warn(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const = 0;
-
- /**
- * Report a warning.
- *
- * @param msg text of message to output
- * @param locator A LocatorType for error reporting
- * @param sourceNode node in source where error occurred
- */
- virtual void
- warn(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const = 0;
-
-
- /**
- * Report an error and throw an exception.
- *
- * @param msg text of message to output
- * @param sourceNode node in source where error occurred
- * @param styleNode node in stylesheet where error occurred
- */
- virtual void
- error(
- const XalanDOMString& msg,
- const XalanNode* sourceNode = 0,
- const ElemTemplateElement* styleNode = 0) const = 0;
-
- /**
- * Report an error and throw an exception.
- *
- * @param msg text of message to output
- * @param locator A LocatorType for error reporting
- * @param sourceNode node in source where error occurred
- */
- virtual void
- error(
- const XalanDOMString& msg,
- const LocatorType& locator,
- const XalanNode* sourceNode = 0) const = 0;
};
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupport.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupport.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupport.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupport.hpp Sun Aug 31 23:42:06 2008
@@ -49,44 +49,29 @@
~XSLTProcessorEnvSupport();
- // These interfaces are new...
+ // These interfaces are inherited from XPathEnvSupport...
- /**
- * Function that is called when a problem event occurs.
- *
- * @param where either eXMLParser, eXSLTProcessor,
- * eXPATHParser, eXPATHProcessor, or eDataSource.
- * @param classification either eWarning, or eError
- * @param resolver resolver for namespace resolution
- * @param sourceNode source tree node where the problem occurred
- * (may be 0)
- * @param styleNode stylesheet node where the problem occurred
- * (may be 0)
- * @param msg string message explaining the problem.
- * @param uri the URI of the stylesheet, if available. May be 0;
- * @param lineNo line number where the problem occurred.
- * @param charOffset character offset where the problem.
- * @return true if the return is an ERROR, in which case exception will be
- * thrown. Otherwise the processor will continue to process.
- */
- virtual bool
+ virtual void
problem(
- eSource where,
- eClassification classification,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode,
- const XalanDOMString& msg,
- const XalanDOMChar* uri,
- XalanFileLoc lineNo,
- XalanFileLoc charOffset) const = 0;
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode) = 0;
- // These interfaces are inherited from XPathEnvSupport...
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode) = 0;
virtual XalanDocument*
parseXML(
- MemoryManagerType& theManager,
+ MemoryManager& theManager,
const XalanDOMString& urlString,
- const XalanDOMString& base) = 0;
+ const XalanDOMString& base,
+ ErrorHandler* theErrorHandler = 0) = 0;
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const = 0;
@@ -118,19 +103,6 @@
const XObjectArgVectorType& argVec,
const LocatorType* locator) const = 0;
- virtual bool
- problem(
- eSource where,
- eClassification classification,
- const PrefixResolver* resolver,
- const XalanNode* sourceNode,
- const XalanDOMString& msg,
- const XalanDOMChar* uri,
- XalanFileLoc lineNo,
- XalanFileLoc charOffset) const = 0;
-
- // These interfaces are inherited from Resettable...
-
virtual void
reset() = 0;
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp Sun Aug 31 23:42:06 2008
@@ -36,6 +36,7 @@
#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
#include <xalanc/PlatformSupport/URISupport.hpp>
+#include "xalanc/PlatformSupport/XSLException.hpp"
@@ -129,13 +130,18 @@
XalanDocument*
XSLTProcessorEnvSupportDefault::parseXML(
- MemoryManager& theManager,
- const XalanDOMString& urlString,
- const XalanDOMString& base)
+ MemoryManager& theManager,
+ const XalanDOMString& urlString,
+ const XalanDOMString& base,
+ ErrorHandler* theErrorHandler)
{
if (m_processor == 0)
{
- return m_defaultSupport.parseXML(theManager, urlString, base);
+ return m_defaultSupport.parseXML(
+ theManager,
+ urlString,
+ base,
+ theErrorHandler);
}
else
{
@@ -183,15 +189,30 @@
theXMLResolver->resolveEntity(&theIndentifier));
}
+ typedef XMLParserLiaison::EnsureResetErrorHandler EnsureResetErrorHandler;
+
+ EnsureResetErrorHandler theGuard;
+
+ if (theErrorHandler != 0)
+ {
+ theGuard.set(
+ &parserLiaison,
+ theErrorHandler);
+ }
+
if (resolverInputSource.get() != 0)
{
- theDocument = parserLiaison.parseXMLStream(*resolverInputSource.get(), theEmptyString);
+ theDocument = parserLiaison.parseXMLStream(
+ *resolverInputSource.get(),
+ theEmptyString);
}
else
{
const XSLTInputSource inputSource(urlText.c_str(), theManager);
- theDocument = parserLiaison.parseXMLStream(inputSource, theEmptyString);
+ theDocument = parserLiaison.parseXMLStream(
+ inputSource,
+ theEmptyString);
}
if (theDocument != 0)
@@ -274,83 +295,36 @@
-bool
+void
XSLTProcessorEnvSupportDefault::problem(
- eSource /* where */,
- eClassification classification,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode,
- const XalanDOMString& msg,
- const XalanDOMChar* /* uri */,
- XalanFileLoc /* lineNo */,
- XalanFileLoc /* charOffset */) const
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode)
{
- if (classification == XPathEnvSupport::eError)
- {
- m_processor->error(
- msg,
- sourceNode,
- styleNode);
-
- return true;
- }
- else if (classification == XPathEnvSupport::eWarning)
- {
- m_processor->warn(
- msg,
- sourceNode,
- styleNode);
-
- return false;
- }
- else
- {
- m_processor->message(
- msg,
- sourceNode,
- styleNode);
-
- return false;
- }
+ m_processor->problem(
+ source,
+ classification,
+ msg,
+ locator,
+ sourceNode);
}
-bool
+void
XSLTProcessorEnvSupportDefault::problem(
- eSource /* where */,
+ eSource source,
eClassification classification,
- const PrefixResolver* /* resolver */,
- const XalanNode* sourceNode,
const XalanDOMString& msg,
- const XalanDOMChar* /* uri */,
- XalanFileLoc /* lineNo */,
- XalanFileLoc /* charOffset */) const
+ const XalanNode* sourceNode)
{
- if (classification == XPathEnvSupport::eError)
- {
- m_processor->error(
- msg,
- sourceNode);
-
- return true;
- }
- else if (classification == XPathEnvSupport::eWarning)
- {
- m_processor->warn(
- msg,
- sourceNode);
-
- return false;
- }
- else
- {
- m_processor->message(
- msg,
- sourceNode);
-
- return false;
- }
+ m_processor->problem(
+ source,
+ classification,
+ msg,
+ sourceNode);
}
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.hpp Sun Aug 31 23:42:06 2008
@@ -46,8 +46,9 @@
{
public:
- XSLTProcessorEnvSupportDefault( MemoryManagerType& theManager,
- XSLTProcessor* theProcessor = 0);
+ XSLTProcessorEnvSupportDefault(
+ MemoryManager& theManager,
+ XSLTProcessor* theProcessor = 0);
virtual
~XSLTProcessorEnvSupportDefault();
@@ -115,26 +116,29 @@
const XalanDOMString& functionName);
- // These interfaces are inherited from XSLTProcessorEnvSupport...
+ // These interfaces are inherited from XSLTProcessorEnvSupport...
- virtual bool
+ virtual void
problem(
- eSource where,
- eClassification classification,
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode,
- const XalanDOMString& msg,
- const XalanDOMChar* uri,
- XalanFileLoc lineNo,
- XalanFileLoc charOffset) const;
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const Locator* locator,
+ const XalanNode* sourceNode);
- // These interfaces are inherited from XPathEnvSupport...
+ virtual void
+ problem(
+ eSource source,
+ eClassification classification,
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode);
virtual XalanDocument*
parseXML(
- MemoryManagerType& theManager,
+ MemoryManager& theManager,
const XalanDOMString& urlString,
- const XalanDOMString& base);
+ const XalanDOMString& base,
+ ErrorHandler* theErrorHandler = 0);
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const;
@@ -166,19 +170,6 @@
const XObjectArgVectorType& argVec,
const LocatorType* locator) const;
- virtual bool
- problem(
- eSource where,
- eClassification classification,
- const PrefixResolver* resolver,
- const XalanNode* sourceNode,
- const XalanDOMString& msg,
- const XalanDOMChar* uri,
- XalanFileLoc lineNo,
- XalanFileLoc charOffset) const;
-
- // These interfaces are inherited from Resettable...
-
virtual void
reset();
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.cpp Sun Aug 31 23:42:06 2008
@@ -53,39 +53,24 @@
0
};
-XSLTProcessorException::XSLTProcessorException(
- MemoryManagerType& theManager,
- const XalanDOMString& theMessage,
- const XalanDOMString& theURI,
- XalanFileLoc theLineNumber,
- XalanFileLoc theColumnNumber) :
- XSLException(
- theMessage,
- theURI,
- theLineNumber,
- theColumnNumber,
- theManager)
-{
-}
-
XSLTProcessorException::XSLTProcessorException(
- MemoryManagerType& theManager,
- const LocatorType& theLocator,
- const XalanDOMString& theMessage) :
+ MemoryManager& theManager,
+ const XalanDOMString& theMessage,
+ const Locator* theLocator) :
XSLException(
- theLocator,
theMessage,
- theManager)
+ theManager,
+ theLocator)
{
}
XSLTProcessorException::XSLTProcessorException(
- MemoryManagerType& theManager,
- const XalanDOMString& theMessage) :
+ MemoryManager& theManager,
+ const XalanDOMString& theMessage) :
XSLException(
theMessage,
theManager)
Modified: xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/XSLTProcessorException.hpp Sun Aug 31 23:42:06 2008
@@ -41,36 +41,24 @@
/**
* Construct an XSLT Processor exception object
*
- * @param theMessage message to print when exception thrown
- * @param theURI the URI of the related document, if known
- * @param theLineNumber the line number of the related document.
- * @param theColumnNumber the column number of the related document.
+ * @param theManager The MemoryManager instance to use.
+ * @param theMessage The message to print when exception thrown
+ * @param theLocator The Locator instance for error reporting, if any.
*/
XSLTProcessorException(
- MemoryManagerType& theManager,
+ MemoryManager& theManager,
const XalanDOMString& theMessage,
- const XalanDOMString& theURI,
- XalanFileLoc lineNumber,
- XalanFileLoc columnNumber);
+ const Locator* theLocator);
/**
- * Constructor
+ * Construct an XSLT Processor exception object. Use this
+ * constructor when the error message is already formatted.
*
- * @param theLocator The locator instance for error reporting.
- * @param theMessage message to write when exception thrown
+ * @param theManager The MemoryManager instance to use.
+ * @param theMessage The message to print when exception thrown
*/
XSLTProcessorException(
- MemoryManagerType& theManager,
- const LocatorType& theLocator,
- const XalanDOMString& theMessage);
-
- /**
- * Construct an XSLT Processor exception object
- *
- * @param theMessage message to print when exception thrown
- */
- XSLTProcessorException(
- MemoryManagerType& theManager,
+ MemoryManager& theManager,
const XalanDOMString& theMessage);
virtual
Modified: xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.cpp Sun Aug 31 23:42:06 2008
@@ -96,20 +96,21 @@
invariants();
}
+
+
XalanDOMString*
-XalanDOMString::clone(MemoryManagerType& theManager)
+XalanDOMString::clone(MemoryManager& theManager)
{
- typedef XalanDOMString ThisType;
-
- XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+ typedef XalanDOMString ThisType;
- ThisType* theResult = theGuard.get();
+ XalanAllocationGuard theGuard(theManager, theManager.allocate(sizeof(ThisType)));
- new (theResult) ThisType(*this, theManager);
+ ThisType* const theResult =
+ new (theGuard.get()) ThisType(*this, theManager);
- theGuard.release();
+ theGuard.release();
- return theResult;
+ return theResult;
}
@@ -172,7 +173,7 @@
-void
+XalanDOMString&
XalanDOMString::erase(
size_type theStartPosition,
size_type theCount)
@@ -181,6 +182,7 @@
const size_type theActualCount =
theCount == size_type(npos) ? length() - theStartPosition : theCount;
+ assert(theStartPosition + theActualCount <= length());
if (theStartPosition == 0 && theCount >= size())
{
@@ -208,6 +210,8 @@
}
invariants();
+
+ return *this;
}
Modified: xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanDOM/XalanDOMString.hpp Sun Aug 31 23:42:06 2008
@@ -269,7 +269,37 @@
invariants();
}
- void
+ iterator
+ erase(iterator thePosition)
+ {
+ invariants();
+
+ m_data.erase(thePosition);
+
+ --m_size;
+
+ invariants();
+
+ return thePosition;
+ }
+
+ iterator
+ erase(
+ iterator theFirst,
+ iterator theLast)
+ {
+ invariants();
+
+ m_data.erase(theFirst, theLast);
+
+ m_size = m_data.size() - 1;
+
+ invariants();
+
+ return theFirst;
+ }
+
+ XalanDOMString&
erase(
size_type theStartPosition = 0,
size_type theCount = size_type(npos));
@@ -1044,7 +1074,7 @@
}
-
+#if 0
inline XalanDOMString&
add(
const XalanDOMString& theLHS,
@@ -1111,7 +1141,7 @@
return result;
}
-
+#endif
// Standard vector of XalanDOMChars and chars
Modified: xalan/c/trunk/src/xalanc/XalanEXSLT/XalanEXSLTCommon.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanEXSLT/XalanEXSLTCommon.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanEXSLT/XalanEXSLTCommon.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanEXSLT/XalanEXSLTCommon.cpp Sun Aug 31 23:42:06 2008
@@ -149,9 +149,10 @@
if (args.size() != 1)
{
- const XPathExecutionContext::GetCachedString theGuard(executionContext);
-
- executionContext.error(getError(theGuard.get()), context, locator);
+ generalError(
+ executionContext,
+ context,
+ locator);
}
assert(args[0].null() == false);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org