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 2001/09/19 23:20:47 UTC
cvs commit: xml-xalan/c/src/XSLT ElemAttribute.cpp ElemChoose.cpp ElemComment.cpp ElemCopy.cpp ElemElement.cpp ElemFallback.cpp ElemForEach.cpp ElemIf.cpp ElemLiteralResult.cpp ElemMessage.cpp ElemOtherwise.cpp ElemPI.cpp ElemTemplate.cpp ElemTemplateElement.cpp ElemTemplateElement.hpp ElemValueOf.cpp ElemVariable.cpp ElemWhen.cpp
dbertoni 01/09/19 14:20:47
Modified: c/src/XSLT ElemAttribute.cpp ElemChoose.cpp ElemComment.cpp
ElemCopy.cpp ElemElement.cpp ElemFallback.cpp
ElemForEach.cpp ElemIf.cpp ElemLiteralResult.cpp
ElemMessage.cpp ElemOtherwise.cpp ElemPI.cpp
ElemTemplate.cpp ElemTemplateElement.cpp
ElemTemplateElement.hpp ElemValueOf.cpp
ElemVariable.cpp ElemWhen.cpp
Log:
Fixed more error reporting problems.
Revision Changes Path
1.30 +1 -1 xml-xalan/c/src/XSLT/ElemAttribute.cpp
Index: ElemAttribute.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- ElemAttribute.cpp 2001/07/18 04:33:15 1.29
+++ ElemAttribute.cpp 2001/09/19 21:20:46 1.30
@@ -109,7 +109,7 @@
*this, constructionContext);
}
else if(!(isAttrOK(aname, atts, i, constructionContext) ||
- processSpaceAttr(aname, atts, i)))
+ processSpaceAttr(aname, atts, i, constructionContext)))
{
constructionContext.error(
"xsl:attribute has an illegal attribute",
1.16 +2 -1 xml-xalan/c/src/XSLT/ElemChoose.cpp
Index: ElemChoose.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemChoose.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ElemChoose.cpp 2001/07/12 05:05:35 1.15
+++ ElemChoose.cpp 2001/09/19 21:20:46 1.16
@@ -96,7 +96,8 @@
{
const XalanDOMChar* const aname = atts.getName(i);
- if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
+ if(isAttrOK(aname, atts, i, constructionContext) == false ||
+ processSpaceAttr(aname, atts, i, constructionContext))
{
constructionContext.error(
"xsl:choose has an illegal attribute",
1.13 +2 -1 xml-xalan/c/src/XSLT/ElemComment.cpp
Index: ElemComment.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemComment.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemComment.cpp 2001/07/12 05:05:36 1.12
+++ ElemComment.cpp 2001/09/19 21:20:46 1.13
@@ -90,7 +90,8 @@
{
const XalanDOMChar* const aname = atts.getName(i);
- if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
+ if(isAttrOK(aname, atts, i, constructionContext) == false ||
+ processSpaceAttr(aname, atts, i, constructionContext))
{
constructionContext.error(
"xsl:comment has an illegal attribute",
1.16 +1 -1 xml-xalan/c/src/XSLT/ElemCopy.cpp
Index: ElemCopy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ElemCopy.cpp 2001/07/23 01:39:45 1.15
+++ ElemCopy.cpp 2001/09/19 21:20:46 1.16
@@ -94,7 +94,7 @@
const XalanDOMChar* const aname = atts.getName(i);
if(!(processUseAttributeSets(constructionContext, aname, atts, i) ||
- processSpaceAttr(aname, atts, i) ||
+ processSpaceAttr(aname, atts, i, constructionContext) ||
isAttrOK(aname, atts, i, constructionContext)))
{
constructionContext.error(
1.31 +3 -2 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.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ElemElement.cpp 2001/07/18 04:33:15 1.30
+++ ElemElement.cpp 2001/09/19 21:20:46 1.31
@@ -108,8 +108,9 @@
m_namespaceAVT = new AVT(getLocator(), aname, atts.getType(i), atts.getValue(i),
*this, constructionContext);
}
- else if(!(processUseAttributeSets(constructionContext, aname, atts, i) || processSpaceAttr(aname, atts, i) ||
- isAttrOK(aname, atts, i, constructionContext)))
+ else if(!(processUseAttributeSets(constructionContext, aname, atts, i) ||
+ processSpaceAttr(aname, atts, i, constructionContext) ||
+ isAttrOK(aname, atts, i, constructionContext)))
{
constructionContext.error(Constants::ELEMNAME_ELEMENT_WITH_PREFIX_STRING + " has an illegal attribute: " + aname);
}
1.9 +1 -1 xml-xalan/c/src/XSLT/ElemFallback.cpp
Index: ElemFallback.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemFallback.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemFallback.cpp 2001/07/18 04:33:15 1.8
+++ ElemFallback.cpp 2001/09/19 21:20:46 1.9
@@ -97,7 +97,7 @@
switch(tok)
{
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
1.18 +2 -1 xml-xalan/c/src/XSLT/ElemForEach.cpp
Index: ElemForEach.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ElemForEach.cpp 2001/07/21 05:35:40 1.17
+++ ElemForEach.cpp 2001/09/19 21:20:46 1.18
@@ -105,7 +105,8 @@
{
m_selectPattern = constructionContext.createXPath(getLocator(), atts.getValue(i), *this);
}
- else if(!(isAttrOK(aname, atts, i, constructionContext) || processSpaceAttr(aname, atts, i)))
+ else if(!(isAttrOK(aname, atts, i, constructionContext) ||
+ processSpaceAttr(aname, atts, i, constructionContext)))
{
constructionContext.error(
"xsl:for-each has an illegal attribute",
1.16 +1 -1 xml-xalan/c/src/XSLT/ElemIf.cpp
Index: ElemIf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ElemIf.cpp 2001/07/18 04:33:15 1.15
+++ ElemIf.cpp 2001/09/19 21:20:46 1.16
@@ -109,7 +109,7 @@
break;
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
1.43 +7 -3 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.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- ElemLiteralResult.cpp 2001/09/18 16:29:43 1.42
+++ ElemLiteralResult.cpp 2001/09/19 21:20:46 1.43
@@ -123,10 +123,14 @@
if(!equals(prefix, DOMServices::s_XMLNamespace))
{
const XalanDOMString* const ns =
- getNamespaceForPrefixInternal(prefix, true);
+ getNamespaceForPrefixInternal(prefix);
- if(ns != 0 && equals(*ns, stylesheetTree.getXSLTNamespaceURI()))
+ if(ns == 0)
{
+ constructionContext.error("Cannot resolve namespace prefix: " + prefix);
+ }
+ else if(equals(*ns, stylesheetTree.getXSLTNamespaceURI()))
+ {
const XalanDOMString localName = substring(aname, indexOfNSSep + 1);
if(processPrefixControl(constructionContext, stylesheetTree, localName, atts.getValue(i)) == true)
@@ -150,7 +154,7 @@
if(needToProcess == true)
{
- processSpaceAttr(aname, atts, i);
+ processSpaceAttr(aname, atts, i, constructionContext);
// Add xmlns attribute(except xmlns:xsl), xml:space, etc...
// Ignore anything with xsl:xxx
1.13 +2 -1 xml-xalan/c/src/XSLT/ElemMessage.cpp
Index: ElemMessage.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemMessage.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemMessage.cpp 2001/07/18 04:33:15 1.12
+++ ElemMessage.cpp 2001/09/19 21:20:46 1.13
@@ -107,7 +107,8 @@
this);
}
}
- else if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
+ else if(isAttrOK(aname, atts, i, constructionContext) == false ||
+ processSpaceAttr(aname, atts, i, constructionContext))
{
constructionContext.error(
"xsl:message has an illegal attribute",
1.7 +2 -1 xml-xalan/c/src/XSLT/ElemOtherwise.cpp
Index: ElemOtherwise.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemOtherwise.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemOtherwise.cpp 2001/07/18 04:33:15 1.6
+++ ElemOtherwise.cpp 2001/09/19 21:20:46 1.7
@@ -89,7 +89,8 @@
{
const XalanDOMChar* const aname = atts.getName(i);
- if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
+ if(isAttrOK(aname, atts, i, constructionContext) == false ||
+ processSpaceAttr(aname, atts, i, constructionContext))
{
constructionContext.error(
"xsl:otherwise has an illegal attribute",
1.19 +2 -1 xml-xalan/c/src/XSLT/ElemPI.cpp
Index: ElemPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemPI.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ElemPI.cpp 2001/08/14 16:22:01 1.18
+++ ElemPI.cpp 2001/09/19 21:20:46 1.19
@@ -96,7 +96,8 @@
m_nameAVT = new AVT(getLocator(), aname, atts.getType(i), atts.getValue(i),
*this, constructionContext);
}
- else if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
+ else if(isAttrOK(aname, atts, i, constructionContext) == false ||
+ processSpaceAttr(aname, atts, i, constructionContext))
{
constructionContext.error(
"xsl:processing-instruction has an illegal attribute",
1.19 +1 -1 xml-xalan/c/src/XSLT/ElemTemplate.cpp
Index: ElemTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ElemTemplate.cpp 2001/08/13 17:08:53 1.18
+++ ElemTemplate.cpp 2001/09/19 21:20:46 1.19
@@ -125,7 +125,7 @@
break;
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
1.66 +13 -43 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.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- ElemTemplateElement.cpp 2001/07/27 05:33:24 1.65
+++ ElemTemplateElement.cpp 2001/09/19 21:20:46 1.66
@@ -100,6 +100,7 @@
#include "NamespacesHandler.hpp"
#include "NodeSorter.hpp"
#include "Stylesheet.hpp"
+#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
#include "StylesheetRoot.hpp"
#include "SelectionEvent.hpp"
@@ -197,8 +198,9 @@
void
ElemTemplateElement::processSpaceAttr(
- const AttributeList& atts,
- int which)
+ const AttributeList& atts,
+ int which,
+ StylesheetConstructionContext& constructionContext)
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
@@ -212,7 +214,7 @@
}
else
{
- error("xml:space has an illegal value");
+ constructionContext.error("xml:space has an illegal value");
}
}
@@ -220,9 +222,10 @@
bool
ElemTemplateElement::processSpaceAttr(
- const XalanDOMChar* aname,
- const AttributeList& atts,
- int which)
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which,
+ StylesheetConstructionContext& constructionContext)
{
const bool isSpaceAttr = equals(aname, Constants::ATTRNAME_XMLSPACE);
@@ -240,7 +243,7 @@
}
else
{
- error("xml:space has an illegal value");
+ constructionContext.error("xml:space has an illegal value");
}
}
@@ -923,24 +926,6 @@
-void
-ElemTemplateElement::error(const XalanDOMString& msg) const
-{
- XalanDOMString errMsg("ElemTemplateElement error: " + msg);
-
- throw SAXException(c_wstr(errMsg));
-}
-
-
-
-void
-ElemTemplateElement::error(const char* msg) const
-{
- error(TranscodeFromLocalCodePage(msg));
-}
-
-
-
const XalanDOMString&
ElemTemplateElement::getNodeName() const
{
@@ -1431,32 +1416,24 @@
const XalanDOMString*
ElemTemplateElement::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
- return getNamespaceForPrefixInternal(prefix, false);
+ return getNamespaceForPrefixInternal(prefix);
}
const XalanDOMString*
-ElemTemplateElement::getNamespaceForPrefixInternal(
- const XalanDOMString& prefix,
- bool fReportError) const
+ElemTemplateElement::getNamespaceForPrefixInternal(const XalanDOMString& prefix) const
{
const XalanDOMString* nameSpace = 0;
if (isEmpty(prefix) == false)
{
- bool fEmptyIsError = true;
-
if(m_finishedConstruction == true)
{
if (equals(prefix, DOMServices::s_XMLString) == true)
{
nameSpace = &DOMServices::s_XMLNamespaceURI;
}
- else if (equals(prefix, DOMServices::s_XMLNamespace) == true)
- {
- fEmptyIsError = false;
- }
else
{
nameSpace = getNamespacesHandler().getNamespace(prefix);
@@ -1465,7 +1442,7 @@
{
if (m_parentNode != 0)
{
- nameSpace = m_parentNode->getNamespaceForPrefixInternal(prefix, false);
+ nameSpace = m_parentNode->getNamespaceForPrefixInternal(prefix);
}
// Try one last time with the stylesheet...
@@ -1479,13 +1456,6 @@
else
{
nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
- }
-
- if(fReportError == true &&
- fEmptyIsError == true &&
- nameSpace == 0)
- {
- error("Cannot resolve namespace prefix: " + prefix);
}
}
1.36 +12 -26 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.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ElemTemplateElement.hpp 2001/08/13 17:08:53 1.35
+++ ElemTemplateElement.hpp 2001/09/19 21:20:46 1.36
@@ -156,6 +156,7 @@
* @param atts attribute list where the element comes from (not used at
* this time)
* @param which index into the attribute list (not used at this time)
+ * @param constructionContext The current construction context
* @return true if this is a namespace name
*/
virtual bool
@@ -168,15 +169,16 @@
/**
* Tell whether or not this is a xml:space attribute and, if so, process it.
*
- * @param aname name of the attribute in question
* @param atts attribute list that owns the attribute
* @param which index of the attribute into the attribute list
+ * @param constructionContext The current construction context
* @return true if this is a xml:space attribute
*/
void
processSpaceAttr(
- const AttributeList& atts,
- int which);
+ const AttributeList& atts,
+ int which,
+ StylesheetConstructionContext& constructionContext);
/**
* Tell whether or not this is a xml:space attribute and, if so, process it.
@@ -184,13 +186,15 @@
* @param aname name of the attribute in question
* @param atts attribute list that owns the attribute
* @param which index of the attribute into the attribute list
+ * @param constructionContext The current construction context
* @return true if this is a xml:space attribute
*/
bool
processSpaceAttr(
- const XalanDOMChar* aname,
- const AttributeList& atts,
- int which);
+ const XalanDOMChar* aname,
+ const AttributeList& atts,
+ int which,
+ StylesheetConstructionContext& constructionContext);
/**
* Validate that the string is an NCName.
@@ -328,22 +332,6 @@
virtual bool
isWhitespace() const;
- /**
- * Throw a template element runtime error.
- *
- * @param msg Description of the error that occurred
- */
- virtual void
- error(const XalanDOMString& msg) const;
-
- /**
- * Throw a template element runtime error.
- *
- * @param msg Description of the error that occurred
- */
- virtual void
- error(const char* msg) const;
-
virtual const XalanDOMString&
getElementName() const = 0;
@@ -736,13 +724,11 @@
* Get the namespace for a given prefix.
*
* @param prefix The prefix to search for
- * @param fReportError If true, and exception will be thrown to report the error.
+ * @param fExists If not null, set to true if the namespace was defined.
* @return The namespace string.
*/
const XalanDOMString*
- getNamespaceForPrefixInternal(
- const XalanDOMString& prefix,
- bool fReportError) const;
+ getNamespaceForPrefixInternal(const XalanDOMString& prefix) const;
/**
* Perform a query if needed, and call transformChild for each child.
1.26 +1 -1 xml-xalan/c/src/XSLT/ElemValueOf.cpp
Index: ElemValueOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ElemValueOf.cpp 2001/07/18 04:33:15 1.25
+++ ElemValueOf.cpp 2001/09/19 21:20:46 1.26
@@ -134,7 +134,7 @@
break;
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
1.21 +1 -1 xml-xalan/c/src/XSLT/ElemVariable.cpp
Index: ElemVariable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ElemVariable.cpp 2001/08/13 17:08:53 1.20
+++ ElemVariable.cpp 2001/09/19 21:20:46 1.21
@@ -117,7 +117,7 @@
break;
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
1.9 +1 -1 xml-xalan/c/src/XSLT/ElemWhen.cpp
Index: ElemWhen.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWhen.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemWhen.cpp 2001/07/18 04:33:15 1.8
+++ ElemWhen.cpp 2001/09/19 21:20:46 1.9
@@ -100,7 +100,7 @@
break;
case Constants::TATTRNAME_XMLSPACE:
- processSpaceAttr(atts, i);
+ processSpaceAttr(atts, i, constructionContext);
break;
default:
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org