dbertoni 2003/07/02 17:42:10
Modified: c/src/xalanc/XSLT ElemCopy.cpp ElemCopyOf.cpp
ElemTemplateElement.cpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Send Locators through interfaces, instead of the stylesheet node. Improved
error and warning messages with Locator information.
Revision Changes Path
1.2 +1 -1 xml-xalan/c/src/xalanc/XSLT/ElemCopy.cpp
Index: ElemCopy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemCopy.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemCopy.cpp 29 Jun 2003 03:58:07 -0000 1.1
+++ ElemCopy.cpp 3 Jul 2003 00:42:09 -0000 1.2
@@ -136,7 +136,7 @@
false,
false,
false,
- this);
+ getLocator());
if(XalanNode::ELEMENT_NODE == nodeType)
{
1.2 +3 -3 xml-xalan/c/src/xalanc/XSLT/ElemCopyOf.cpp
Index: ElemCopyOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemCopyOf.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemCopyOf.cpp 29 Jun 2003 03:58:07 -0000 1.1
+++ ElemCopyOf.cpp 3 Jul 2003 00:42:10 -0000 1.2
@@ -171,7 +171,7 @@
executionContext.getXObjectFactory().createNodeSet(theNodeList)));
}
- executionContext.cloneToResultTree(*sourceNode, this);
+ executionContext.cloneToResultTree(*sourceNode, getLocator());
}
else
{
@@ -209,13 +209,13 @@
{
assert(theNodeList.item(i) != 0);
-
executionContext.cloneToResultTree(*theNodeList.item(i), this);
+
executionContext.cloneToResultTree(*theNodeList.item(i), getLocator());
}
}
break;
case XObject::eTypeResultTreeFrag:
- executionContext.outputResultTreeFragment(*value.get(),
this);
+ executionContext.outputResultTreeFragment(*value.get(),
getLocator());
break;
default:
1.2 +1 -1 xml-xalan/c/src/xalanc/XSLT/ElemTemplateElement.cpp
Index: ElemTemplateElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemTemplateElement.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemTemplateElement.cpp 29 Jun 2003 03:58:07 -0000 1.1
+++ ElemTemplateElement.cpp 3 Jul 2003 00:42:10 -0000 1.2
@@ -694,7 +694,7 @@
{
case XalanNode::CDATA_SECTION_NODE:
case XalanNode::TEXT_NODE:
- executionContext.cloneToResultTree(*child,
nodeType, false, false, false, this);
+ executionContext.cloneToResultTree(*child,
nodeType, false, false, false, getLocator());
break;
case XalanNode::ATTRIBUTE_NODE:
1.3 +17 -17
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetExecutionContext.hpp 1 Jul 2003 23:48:05 -0000 1.2
+++ StylesheetExecutionContext.hpp 3 Jul 2003 00:42:10 -0000 1.3
@@ -1147,13 +1147,13 @@
/**
* Clone a node to the result tree
*
- * @param node node to clone
- * @param styleNode the stylesheet element that generated the clone.
+ * @param node node to clone
+ * @param locator The Locator, if any
*/
virtual void
cloneToResultTree(
- const XalanNode& node,
- const ElemTemplateElement* styleNode) = 0;
+ const XalanNode& node,
+ const LocatorType* locator) = 0;
/**
* Clone a node to the result tree
@@ -1163,16 +1163,16 @@
* @param isLiteral true if a literal element
* @param overrideStrip false if white space stripping should
be done
* @param shouldCloneAttributes true if attributes should be cloned
- * @param styleNode the stylesheet element
that generated the clone.
+ * @param locator The Locator, if any
*/
virtual void
cloneToResultTree(
- const XalanNode& node,
- XalanNode::NodeType nodeType,
- bool
isLiteral,
- bool
overrideStrip,
- bool
shouldCloneAttributes,
- const ElemTemplateElement* styleNode) = 0;
+ const XalanNode& node,
+ XalanNode::NodeType nodeType,
+ bool isLiteral,
+ bool overrideStrip,
+ bool
shouldCloneAttributes,
+ const LocatorType* locator) = 0;
/**
* Create an XObject that represents a Result tree fragment.
@@ -1191,24 +1191,24 @@
* This is public for access by extensions.
*
* @param obj the XObject to output
- * @param styleNode the stylesheet element that generate the
fragment.
+ * @param locator The Locator, if any
*/
virtual void
outputToResultTree(
- const XObject& xobj,
- const ElemTemplateElement* styleNode) = 0;
+ const XObject& xobj,
+ const LocatorType* locator) = 0;
/**
* Given a result tree fragment, walk the tree and
* output it to the result stream.
*
* @param theTree result tree fragment
- * @param styleNode the stylesheet element that generate the
fragment.
+ * @param locator The Locator, if any
*/
virtual void
outputResultTreeFragment(
- const XObject& theTree,
- const ElemTemplateElement* styleNode) = 0;
+ const XObject& theTree,
+ const LocatorType* locator) = 0;
/**
* Determine the full XSLT Namespace URI.
1.3 +16 -16
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetExecutionContextDefault.cpp 1 Jul 2003 23:48:05 -0000
1.2
+++ StylesheetExecutionContextDefault.cpp 3 Jul 2003 00:42:10 -0000
1.3
@@ -985,22 +985,22 @@
void
StylesheetExecutionContextDefault::cloneToResultTree(
- const XalanNode& node,
- const ElemTemplateElement* styleNode)
+ const XalanNode& node,
+ const LocatorType* locator)
{
- m_xsltProcessor->cloneToResultTree(node, m_cloneTextNodesOnly,
styleNode);
+ m_xsltProcessor->cloneToResultTree(node, m_cloneTextNodesOnly, locator);
}
void
StylesheetExecutionContextDefault::cloneToResultTree(
- const XalanNode& node,
- XalanNode::NodeType nodeType,
- bool
isLiteral,
- bool
overrideStrip,
- bool
shouldCloneAttributes,
- const ElemTemplateElement* styleNode)
+ const XalanNode& node,
+ XalanNode::NodeType nodeType,
+ bool isLiteral,
+ bool overrideStrip,
+ bool
shouldCloneAttributes,
+ const LocatorType* locator)
{
assert(m_xsltProcessor != 0);
@@ -1011,7 +1011,7 @@
overrideStrip,
shouldCloneAttributes,
m_cloneTextNodesOnly,
- styleNode);
+ locator);
}
@@ -1077,24 +1077,24 @@
void
StylesheetExecutionContextDefault::outputToResultTree(
- const XObject& xobj,
- const ElemTemplateElement* styleNode)
+ const XObject& xobj,
+ const LocatorType* locator)
{
assert(m_xsltProcessor != 0);
- m_xsltProcessor->outputToResultTree(xobj, m_cloneTextNodesOnly,
styleNode);
+ m_xsltProcessor->outputToResultTree(xobj, m_cloneTextNodesOnly,
locator);
}
void
StylesheetExecutionContextDefault::outputResultTreeFragment(
- const XObject& theTree,
- const ElemTemplateElement* styleNode)
+ const XObject& theTree,
+ const LocatorType* locator)
{
assert(m_xsltProcessor != 0);
- m_xsltProcessor->outputResultTreeFragment(theTree,
m_cloneTextNodesOnly, styleNode);
+ m_xsltProcessor->outputResultTreeFragment(theTree,
m_cloneTextNodesOnly, locator);
}
1.3 +12 -12
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetExecutionContextDefault.hpp 1 Jul 2003 23:48:05 -0000
1.2
+++ StylesheetExecutionContextDefault.hpp 3 Jul 2003 00:42:10 -0000
1.3
@@ -559,17 +559,17 @@
virtual void
cloneToResultTree(
- const XalanNode& node,
- const ElemTemplateElement* styleNode);
+ const XalanNode& node,
+ const LocatorType* locator);
virtual void
cloneToResultTree(
- const XalanNode& node,
- XalanNode::NodeType nodeType,
- bool
isLiteral,
- bool
overrideStrip,
- bool
shouldCloneAttributes,
- const ElemTemplateElement* styleNode);
+ const XalanNode& node,
+ XalanNode::NodeType nodeType,
+ bool isLiteral,
+ bool overrideStrip,
+ bool
shouldCloneAttributes,
+ const LocatorType* locator);
virtual const XObjectPtr
createXResultTreeFrag(
@@ -578,13 +578,13 @@
virtual void
outputToResultTree(
- const XObject& xobj,
- const ElemTemplateElement* styleNode);
+ const XObject& xobj,
+ const LocatorType* locator);
virtual void
outputResultTreeFragment(
- const XObject& theTree,
- const ElemTemplateElement* styleNode);
+ const XObject& theTree,
+ const LocatorType* locator);
virtual const XalanDOMString&
getXSLNameSpaceURL() const;
1.5 +74 -30 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSLTEngineImpl.cpp 2 Jul 2003 23:37:33 -0000 1.4
+++ XSLTEngineImpl.cpp 3 Jul 2003 00:42:10 -0000 1.5
@@ -2070,13 +2070,13 @@
void
XSLTEngineImpl::warnCopyTextNodesOnly(
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const
+ const XalanNode* sourceNode,
+ const LocatorType* locator)
{
warn(
"Only text nodes can be copied in this context. The
node is ignored",
- sourceNode,
- styleNode);
+ locator,
+ sourceNode);
}
@@ -2123,9 +2123,9 @@
void
XSLTEngineImpl::cloneToResultTree(
- const XalanNode& node,
- bool
cloneTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const XalanNode& node,
+ bool cloneTextNodesOnly,
+ const LocatorType* locator)
{
XalanNode::NodeType posNodeType = node.getNodeType();
@@ -2138,14 +2138,14 @@
static_cast<const XalanDocumentFragment&>(node),
#endif
cloneTextNodesOnly,
- styleNode);
+ locator);
}
else if (cloneTextNodesOnly == true &&
posNodeType != XalanNode::TEXT_NODE)
{
warnCopyTextNodesOnly(
&node,
- styleNode);
+ locator);
}
else
{
@@ -2165,7 +2165,7 @@
false,
true,
false,
- styleNode);
+ locator);
const XalanNode* nextNode = pos->getFirstChild();
@@ -2219,13 +2219,13 @@
void
XSLTEngineImpl::cloneToResultTree(
- const XalanNode& node,
- XalanNode::NodeType nodeType,
- bool
isLiteral,
- bool
overrideStrip,
- bool
shouldCloneAttributes,
- bool
cloneTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const XalanNode& node,
+ XalanNode::NodeType nodeType,
+ bool isLiteral,
+ bool overrideStrip,
+ bool
shouldCloneAttributes,
+ bool
cloneTextNodesOnly,
+ const LocatorType* locator)
{
assert(nodeType == node.getNodeType());
assert(m_executionContext != 0);
@@ -2236,7 +2236,7 @@
{
warnCopyTextNodesOnly(
&node,
- styleNode);
+ locator);
}
else
{
@@ -2307,8 +2307,8 @@
{
warn(
"Attempting to add an attribute when
there is no open element. The attribute will be ignored",
- &node,
- styleNode);
+ locator,
+ &node);
}
break;
@@ -2337,7 +2337,7 @@
break;
default:
- error("Cannot create item in result tree: " +
node.getNodeName());
+ error("Cannot create item in result tree", locator,
&node);
break;
}
}
@@ -2347,9 +2347,9 @@
void
XSLTEngineImpl::outputToResultTree(
- const XObject& value,
- bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const XObject& value,
+ bool outputTextNodesOnly,
+ const LocatorType* locator)
{
const XObject::eObjectType type = value.getType();
@@ -2383,7 +2383,7 @@
{
warnCopyTextNodesOnly(
pos,
- styleNode);
+ locator);
}
else
{
@@ -2395,7 +2395,7 @@
XalanNode::NodeType
posNodeType = pos->getNodeType();
- cloneToResultTree(*pos,
posNodeType, false, false, false, false, styleNode);
+ cloneToResultTree(*pos,
posNodeType, false, false, false, false, locator);
XalanNode* nextNode =
pos->getFirstChild();
@@ -2444,7 +2444,7 @@
break;
case XObject::eTypeResultTreeFrag:
- outputResultTreeFragment(value, outputTextNodesOnly, styleNode);
+ outputResultTreeFragment(value, outputTextNodesOnly, locator);
break;
case XObject::eTypeNull:
@@ -2462,7 +2462,7 @@
XSLTEngineImpl::outputResultTreeFragment(
const XalanDocumentFragment& theTree,
bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const LocatorType* locator)
{
for(XalanNode* child = theTree.getFirstChild(); child != 0; child =
child->getNextSibling())
{
@@ -2475,7 +2475,7 @@
{
warnCopyTextNodesOnly(
pos,
- styleNode);
+ locator);
}
else
{
@@ -2485,7 +2485,7 @@
{
flushPending();
- cloneToResultTree(*pos, posNodeType, false,
false, true, false, styleNode);
+ cloneToResultTree(*pos, posNodeType, false,
false, true, false, locator);
XalanNode* nextNode = pos->getFirstChild();
@@ -3204,6 +3204,50 @@
length);
fireGenerateEvent(ge);
+}
+
+
+
+void
+XSLTEngineImpl::error(
+ const char* theMessage,
+ const LocatorType* theLocator,
+ const XalanNode* theSourceNode)
+{
+ assert(theMessage != 0);
+
+ m_scratchString = theMessage;
+
+ if (theLocator != 0)
+ {
+ error(m_scratchString, *theLocator, theSourceNode);
+ }
+ else
+ {
+ error(m_scratchString, theSourceNode);
+ }
+}
+
+
+
+void
+XSLTEngineImpl::warn(
+ const char* theMessage,
+ const LocatorType* theLocator,
+ const XalanNode* theSourceNode)
+{
+ assert(theMessage != 0);
+
+ m_scratchString = theMessage;
+
+ if (theLocator != 0)
+ {
+ warn(m_scratchString, *theLocator, theSourceNode);
+ }
+ else
+ {
+ warn(m_scratchString, theSourceNode);
+ }
}
1.3 +40 -25 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTEngineImpl.hpp 2 Jul 2003 23:13:55 -0000 1.2
+++ XSLTEngineImpl.hpp 3 Jul 2003 00:42:10 -0000 1.3
@@ -714,13 +714,13 @@
*
* @param node node to clone
* @param cloneTextNodesOnly if true, only text nodes will be cloned
- * @param styleNode the stylesheet element that generated the clone.
+ * @param locator the Locator for the event, if any.
*/
void
cloneToResultTree(
- const XalanNode& node,
- bool
cloneTextNodesOnly,
- const ElemTemplateElement* styleNode);
+ const XalanNode& node,
+ bool cloneTextNodesOnly,
+ const LocatorType* locator);
/**
* Clone a node to the result tree
@@ -731,29 +731,30 @@
* @param overrideStrip false if white space stripping
should be done
* @param shouldCloneAttributes true if attributes should be cloned
* @param cloneTextNodesOnly if true, only text nodes will be cloned
- * @param styleNode the stylesheet element
that generated the clone.
+ * @param locator the Locator for the
event, if any.
*/
void
cloneToResultTree(
- const XalanNode& node,
- XalanNode::NodeType nodeType,
- bool
isLiteral,
- bool
overrideStrip,
- bool
shouldCloneAttributes,
- bool
cloneTextNodesOnly,
- const ElemTemplateElement* styleNode);
+ const XalanNode& node,
+ XalanNode::NodeType nodeType,
+ bool isLiteral,
+ bool overrideStrip,
+ bool
shouldCloneAttributes,
+ bool
cloneTextNodesOnly,
+ const LocatorType* locator);
/**
* Output an object to the result tree by doing the right conversions.
*
* @param value the XObject to output
* @param outputTextNodesOnly if true, only text nodes will be copied
+ * @param locator the Locator for the
event, if any.
*/
void
outputToResultTree(
- const XObject& value,
- bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode);
+ const XObject& value,
+ bool outputTextNodesOnly,
+ const LocatorType* locator);
/**
* Given a result tree fragment, walk the tree and output it to the
result
@@ -761,15 +762,15 @@
*
* @param theTree result tree fragment
* @param outputTextNodesOnly if true, only text nodes will be copied
- * @param styleNode the stylesheet element that generate the
fragment.
+ * @param locator the Locator for the event, if any.
*/
void
outputResultTreeFragment(
- const XObject& theTree,
- bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const XObject& theTree,
+ bool outputTextNodesOnly,
+ const LocatorType* locator)
{
- outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly,
styleNode);
+ outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly,
locator);
}
/**
@@ -778,13 +779,13 @@
*
* @param theTree result tree fragment
* @param outputTextNodesOnly if true, only text nodes will be copied
- * @param styleNode the stylesheet element that generate the
fragment.
+ * @param locator the Locator for the event, if any.
*/
void
outputResultTreeFragment(
const XalanDocumentFragment& theTree,
bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode);
+ const LocatorType*
locator);
/**
* Retrieve the root stylesheet.
@@ -1494,12 +1495,12 @@
* Issue a warning that only text nodes can be copied.
*
* @param sourceNode node in source where error occurred
- * @param styleNode node in stylesheet where error occurred
+ * @param locator The Locator to use, if any.
*/
void
warnCopyTextNodesOnly(
- const XalanNode* sourceNode,
- const ElemTemplateElement* styleNode) const;
+ const XalanNode* sourceNode,
+ const LocatorType* locator);
/**
* Clone a text node to the result tree
@@ -1694,6 +1695,20 @@
const XalanDOMString& theElementName,
const XalanDOMString& theElementNamespaceURI);
+ void
+ error(
+ const char* theMessage,
+ const LocatorType* theLocator,
+ const XalanNode* theSourceNode);
+
+ void
+ warn(
+ const char* theMessage,
+ const LocatorType* theLocator,
+ const XalanNode* theSourceNode);
+
+
+ // Data members...
XMLParserLiaison& m_parserLiaison;
XPathEnvSupport& m_xpathEnvSupport;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]