You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/03/07 17:21:04 UTC
cvs commit: xml-xalan/c/src/XSLT Stylesheet.cpp StylesheetHandler.cpp StylesheetHandler.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp
dbertoni 00/03/07 08:21:04
Modified: c/src/XSLT Stylesheet.cpp StylesheetHandler.cpp
StylesheetHandler.hpp XSLTEngineImpl.cpp
XSLTEngineImpl.hpp
Log:
Fixes for Xerces interface change.
Revision Changes Path
1.6 +1 -7 xml-xalan/c/src/XSLT/Stylesheet.cpp
Index: Stylesheet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Stylesheet.cpp 2000/03/01 20:43:42 1.5
+++ Stylesheet.cpp 2000/03/07 16:21:00 1.6
@@ -524,7 +524,7 @@
const DOM_Node& sourceTree,
const DOM_Node& targetNode) const
{
- Stylesheet* theDummy;
+ const Stylesheet* theDummy;
return findTemplate(executionContext, sourceTree, targetNode, QName(), false, theDummy);
}
@@ -539,12 +539,6 @@
const QName& mode,
bool useImports,
const Stylesheet*& foundStylesheet) const
-/*
- throws XSLProcessorException,
- java.net.MalformedURLException,
- java.io.FileNotFoundException,
- java.io.IOException
-*/
{
bool usedWildcard = false;
if(m_isWrapperless) return m_wrapperlessTemplate;
1.9 +15 -20 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetHandler.cpp 2000/03/01 20:43:44 1.8
+++ StylesheetHandler.cpp 2000/03/07 16:21:00 1.9
@@ -140,9 +140,9 @@
}
-void StylesheetHandler::setDocumentLocator(Locator* const locator)
+void StylesheetHandler::setDocumentLocator(const Locator* const locator)
{
- m_processor.m_stylesheetLocatorStack.push_back(locator);
+ m_processor.pushLocatorOnStack(locator);
}
@@ -156,10 +156,7 @@
void StylesheetHandler::endDocument()
{
- if(!m_processor.m_stylesheetLocatorStack.empty())
- {
- m_processor.m_stylesheetLocatorStack.pop_back();
- }
+ m_processor.popLocatorStack();
if (!isEmpty(m_pendingException))
{
@@ -209,9 +206,8 @@
{
m_whiteSpaceElems.erase(m_whiteSpaceElems.begin(),m_whiteSpaceElems.end());
- Locator* locator = m_processor.m_stylesheetLocatorStack.empty() ? 0 :
- (m_processor.m_stylesheetLocatorStack.back());
-
+ const Locator* const locator = m_processor.getLocatorFromStack();
+
int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
@@ -517,9 +513,9 @@
if (fVersionFound == false)
{
- const DOMString msg("The stylesheet element did not specify a version attribute!");
+// const DOMString msg("The stylesheet element did not specify a version attribute!");
- throw SAXException(toCharArray(msg));
+// throw SAXException(toCharArray(msg));
}
}
break;
@@ -1200,11 +1196,10 @@
preserveSpace = true;
}
- Locator* locator = (m_processor.m_stylesheetLocatorStack.size() == 0)
- ? 0 : m_processor.m_stylesheetLocatorStack.back();
+ const Locator* const locator = m_processor.getLocatorFromStack();
- int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
- int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
+ const int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
+ const int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
ElemTextLiteral *elem = new ElemTextLiteral(m_constructionContext,
m_stylesheet,
@@ -1213,7 +1208,7 @@
true, preserveSpace,
disableOutputEscaping);
- bool isWhite = isWhiteSpace(chars, 0, length);
+ const bool isWhite = isWhiteSpace(chars, 0, length);
if(preserveSpace || (!preserveSpace && !isWhite))
{
@@ -1282,11 +1277,11 @@
parent = m_elemStack[m_elemStack.size()-2];
preserveSpace = true;
}
- Locator* locator = (m_processor.m_stylesheetLocatorStack.size()==0)
- ? 0 : m_processor.m_stylesheetLocatorStack.back();
- int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
- int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
+ const Locator* const locator = m_processor.getLocatorFromStack();
+
+ const int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
+ const int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
ElemTextLiteral* elem = new ElemTextLiteral(m_constructionContext,
m_stylesheet,
1.6 +1 -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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StylesheetHandler.hpp 2000/03/01 20:43:44 1.5
+++ StylesheetHandler.hpp 2000/03/07 16:21:01 1.6
@@ -267,7 +267,7 @@
* any SAX document event.
* @see org.xml.sax.Locator
*/
- virtual void setDocumentLocator(Locator* const locator);
+ virtual void setDocumentLocator(const Locator* const locator);
/**
* Receive notification of the beginning of a document.
1.13 +48 -36 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XSLTEngineImpl.cpp 2000/03/01 20:43:44 1.12
+++ XSLTEngineImpl.cpp 2000/03/07 16:21:01 1.13
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
/**
- * $Id: XSLTEngineImpl.cpp,v 1.12 2000/03/01 20:43:44 jdonohue Exp $
+ * $Id: XSLTEngineImpl.cpp,v 1.13 2000/03/07 16:21:01 dbertoni Exp $
*
* $State: Exp $
*
@@ -211,7 +211,7 @@
* at the moment. I don't think this is worth fixing
* until NodeList variables are implemented.
*/
-const bool XSLTEngineImpl::m_resolveContentsEarly = true;
+const bool XSLTEngineImpl::s_resolveContentsEarly = true;
XSLTEngineImpl::AttributeKeysMapType XSLTEngineImpl::s_attributeKeys;
@@ -233,10 +233,32 @@
XPathFactory& xpathFactory) :
XSLTProcessor(),
DocumentHandler(),
+ m_rootDoc(),
+ m_outputCarriageReturns(false),
+ m_outputLinefeeds(false),
+ m_formatter(0),
+ m_resultTreeFactory(),
+ m_resultNameSpacePrefix(),
+ m_resultNameSpaceURL(),
+ m_stylesheets(),
+ m_currentNode(),
+ m_cssKeys(),
+ m_translateCSS(false),
+ m_pendingElementName(),
+ m_pendingAttributes(),
+ m_resultNameSpaces(),
+ m_emptyNamespace(),
+ m_xpathFactory(xpathFactory),
+ m_xpath(xpathFactory.create()),
+ m_xobjectFactory(xobjectFactory),
+ m_xpathProcessor(new XPathProcessorImpl),
+ m_cdataStack(),
+ m_stylesheetLocatorStack(),
+ m_variableStacks(*this),
+ m_problemListener(new ProblemListenerDefault()),
+ m_needToBuildKeysTable(false),
m_stylesheetRoot(0),
m_stylesheetExecutionContext(0),
- m_stylesheets(),
- m_rootDoc(),
m_XSLNameSpaceURL(s_DefaultXSLNameSpaceURL),
m_XSLDirectiveLookup(),
m_quietConflictWarnings(false),
@@ -245,43 +267,24 @@
m_traceSelects(false),
m_diagnosticsPrintWriter(0),
m_durationsTable(),
- m_pendingElementName(),
- m_pendingAttributes(),
- m_resultNameSpaces(),
- m_emptyNamespace(),
+ m_traceListeners(),
+ m_outputFileName(),
m_uniqueNSValue(0),
m_useATVsInSelects(false),
- m_cssKeys(),
- m_translateCSS(false),
m_stripWhiteSpace(false),
- m_outputCarriageReturns(false),
- m_outputLinefeeds(false),
m_topLevelParams(),
m_parserLiaison(parserLiaison),
m_xpathSupport(xpathSupport),
m_xpathEnvSupport(xpathEnvSupport),
- m_xpathFactory(xpathFactory),
- m_xpath(xpathFactory.create()),
- m_xobjectFactory(xobjectFactory),
- m_xpathProcessor(new XPathProcessorImpl),
- m_formatter(0),
m_flistener(0),
- m_resultTreeFactory(),
- m_resultNameSpacePrefix(),
- m_resultNameSpaceURL(),
m_contextNodeList(),
m_keyDeclarations(),
m_keys(),
- m_needToBuildKeysTable(false),
- m_currentNode(),
-
m_namedTemplates(),
m_topLevelVariables(),
-
- m_problemListener(new ProblemListenerDefault()),
m_needToCheckForInfiniteLoops(false),
m_stackGuard(*this),
- m_variableStacks(*this)
+ m_attrSetStack()
{
}
@@ -1300,8 +1303,9 @@
ProblemListener::eClassification classification) const
{
if (m_problemListener == 0) return;
- Locator* locator = m_stylesheetLocatorStack.size() == 0 ? 0 :
- m_stylesheetLocatorStack.back();
+
+ const Locator* const locator = getLocatorFromStack();
+
const XMLCh* id = (0 == locator) ?
0 : (0 == locator->getPublicId()) ?
locator->getPublicId() : locator->getSystemId();
@@ -1571,8 +1575,7 @@
void
-XSLTEngineImpl::setDocumentLocator(
- Locator* const /* locator */)
+XSLTEngineImpl::setDocumentLocator(const Locator* const /* locator */)
{
// Do nothing for now
}
@@ -3889,11 +3892,11 @@
{
const int nRules = m_stack.size();
- int loopCount = 0;
+ int loopCount = 0;
- for(int i = (nRules - 1); i >= 0; i--)
+ for(int i = (nRules - 1); i >= 0; --i)
{
- if(m_stack[i] == (guard))
+ if(m_stack[i] == guard)
{
loopCount++;
}
@@ -3901,21 +3904,30 @@
if(loopCount >= 4)
{
DOMStringPrintWriter pw;
+
pw.println(DOMString("Infinite loop diagnosed! Stack trace:"));
- for(int k = 0; k < nRules; k++)
+
+ int k = 0;
+
+ for(; k < nRules; k++)
{
pw.println(DOMString("Source Elem #") +
LongToDOMString(k) +
DOMString(" "));
- const StackGuard& guardOnStack = m_stack[i];
- guardOnStack.print(pw);
+
+ m_stack[i].print(pw);
}
+
pw.println(DOMString("Source Elem #") +
LongToDOMString(k) +
DOMString(" "));
+
guard.print(pw);
+
pw.println(DOMString("End of infinite loop diagnosis."));
+
m_processor->diag(pw.getString());
+
throw XSLTEngineImpl::XSLInfiniteLoopException();
}
}
1.13 +46 -12 xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XSLTEngineImpl.hpp 2000/03/06 17:17:54 1.12
+++ XSLTEngineImpl.hpp 2000/03/07 16:21:02 1.13
@@ -59,7 +59,7 @@
/**
*
- * $Id: XSLTEngineImpl.hpp,v 1.12 2000/03/06 17:17:54 jdonohue Exp $
+ * $Id: XSLTEngineImpl.hpp,v 1.13 2000/03/07 16:21:02 dbertoni Exp $
*
* $State: Exp $
*
@@ -227,7 +227,7 @@
typedef XALAN_STD vector<Arg> ParamVectorType;
typedef XALAN_STD vector<ElemAttributeSet*> AttrStackType;
typedef XALAN_STD vector<KeyDeclaration> KeyDeclarationVectorType;
-typedef XALAN_STD vector<Locator*> LocatorStack;
+typedef XALAN_STD vector<const Locator*> LocatorStack;
typedef XALAN_STD vector<NameSpace> NamespaceVectorType;
typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
typedef XALAN_STD vector<StackEntry*> VariableStackStackType;
@@ -278,12 +278,6 @@
DOM_Document m_rootDoc;
/**
- * The top of this stack should contain the currently processed
- * stylesheet SAX locator object.
- */
- LocatorStack m_stylesheetLocatorStack;
-
- /**
* If true, output carriage returns.
*/
bool m_outputCarriageReturns;
@@ -1965,9 +1959,43 @@
return m_attrSetStack;
}
+ /**
+ * Get the locator from the top of the locator stack.
+ *
+ * @return A pointer to the Locator, or 0 if there is nothing on the stack.
+ */
+ const Locator*
+ getLocatorFromStack() const
+ {
+ return m_stylesheetLocatorStack.size == 0 ? 0 : m_stylesheetLocatorStack.back();
+ }
+
+ /**
+ * Push a locator on to the locator stack.
+ *
+ * @param A pointer to the Locator to push.
+ */
+ void
+ pushLocatorOnStack(const Locator* locator)
+ {
+ m_stylesheetLocatorStack.push_back(locator);
+ }
+
+ /**
+ * Pop the locator from the top of the locator stack.
+ */
+ void
+ popLocatorStack()
+ {
+ if (m_stylesheetLocatorStack.size != 0)
+ {
+ m_stylesheetLocatorStack.pop_back();
+ }
+ }
+
// These methods are inherited from DocumentHandler ...
- virtual void setDocumentLocator( Locator* const locator);
+ virtual void setDocumentLocator(const Locator* const locator);
virtual void
startDocument();
@@ -2136,6 +2164,12 @@
private:
+ /**
+ * The top of this stack should contain the currently processed
+ * stylesheet SAX locator object.
+ */
+ LocatorStack m_stylesheetLocatorStack;
+
/**
* The stack of Variable stacks. A VariableStack will be
* pushed onto this stack for each template invocation.
@@ -2297,7 +2331,7 @@
* List of listeners who are interested in tracing what's
* being generated.
*/
- /*transient*/ TraceListenerVectorType m_traceListeners;
+ TraceListenerVectorType m_traceListeners;
// Common processing for errors and warnings
void problem(const DOM_Node& styleNode,
@@ -2431,7 +2465,7 @@
* at the moment. I don't think this is worth fixing
* until NodeList variables are implemented.
*/
- static const bool m_resolveContentsEarly;
+ static const bool s_resolveContentsEarly;
/**
* Set the factory for making XPaths.
@@ -2455,7 +2489,7 @@
bool
getResolveContentsEarly() const
{
- return m_resolveContentsEarly;
+ return s_resolveContentsEarly;
}
ParamVectorType m_topLevelParams;