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/11/02 02:46:49 UTC
cvs commit: xml-xalan/c/src/XercesParserLiaison XercesBridgeHelper.cpp XercesBridgeHelper.hpp XercesAttrBridge.cpp XercesAttrBridge.hpp XercesBridgeNavigator.cpp XercesBridgeNavigator.hpp XercesCDATASectionBridge.cpp XercesCDATASectionBridge.hpp XercesCommentBridge.cpp XercesCommentBridge.hpp XercesDOMImplementationBridge.cpp XercesDOMImplementationBridge.hpp XercesDOMSupport.cpp XercesDOMSupport.hpp XercesDOM_NodeHack.cpp XercesDOM_NodeHack.hpp XercesDocumentBridge.cpp XercesDocumentBridge.hpp XercesDocumentFragmentBridge.cpp XercesDocumentFragmentBridge.hpp XercesDocumentNamedNodeListCache.cpp XercesDocumentTypeBridge.cpp XercesDocumentTypeBridge.hpp XercesElementBridge.cpp XercesElementBridge.hpp XercesElementNamedNodeListCache.cpp XercesEntityBridge.cpp XercesEntityBridge.hpp XercesEntityReferenceBridge.cpp XercesEntityReferenceBridge.hpp XercesNamedNodeListCache.cpp XercesNamedNodeMapBridge.cpp XercesNotationBridge.cpp XercesNotationBridge.hpp XercesParserLiaison.cpp XercesParserLiaison.hpp XercesProcessingInstructionBridge.cpp XercesProcessingInstructionBridge.hpp XercesTextBridge.cpp XercesTextBridge.hpp
dbertoni 00/11/01 17:46:48
Modified: c/src/DOMSupport DOMServices.cpp DOMServices.hpp
DOMSupport.hpp DOMSupportDefault.cpp
DOMSupportDefault.hpp NamespaceResolver.cpp
NamespaceResolver.hpp
c/src/ICUBridge FunctionICUFormatNumber.cpp ICUBridge.cpp
c/src/PlatformSupport ArenaBlock.hpp AttributeListImpl.cpp
AttributeListImpl.hpp DOMStringHelper.cpp
DOMStringHelper.hpp DOMStringPrintWriter.cpp
DOMStringPrintWriter.hpp DirectoryEnumerator.hpp
ExecutionContext.hpp NamedNodeMapAttributeList.cpp
StringTokenizer.cpp StringTokenizer.hpp
URISupport.cpp URISupport.hpp XalanBitmap.cpp
XalanDecimalFormatSymbols.hpp
XalanFileOutputStream.cpp XalanNumberFormat.cpp
XalanOutputStream.cpp XalanOutputStream.hpp
XalanOutputStreamPrintWriter.cpp
XalanStdOutputStream.cpp
XalanTranscodingServices.cpp XalanUnicode.hpp
c/src/TestXPath NodeNameTreeWalker.cpp TestXPath.cpp
c/src/TestXSLT process.cpp
c/src/XMLSupport FormatterToDOM.cpp FormatterToHTML.cpp
FormatterToHTML.hpp FormatterToText.cpp
FormatterToXML.cpp FormatterToXML.hpp
FormatterTreeWalker.cpp XMLParserLiaison.hpp
XMLParserLiaisonDefault.cpp
XMLParserLiaisonDefault.hpp
c/src/XPath ElementPrefixResolverProxy.cpp
ElementPrefixResolverProxy.hpp FunctionConcat.hpp
FunctionID.hpp FunctionLang.hpp
FunctionLocalName.hpp FunctionName.hpp
FunctionNamespaceURI.hpp FunctionNormalize.hpp
FunctionSum.hpp NameSpace.hpp PrefixResolver.hpp
QName.cpp QName.hpp ResultTreeFrag.cpp
ResultTreeFrag.hpp ResultTreeFragBase.hpp
SimpleNodeLocator.cpp XNodeSet.cpp XNodeSet.hpp
XObject.cpp XObjectFactoryDefault.hpp XPath.cpp
XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathExpression.cpp XPathExpression.hpp
XPathFunctionTable.cpp XPathProcessorImpl.cpp
XPathProcessorImpl.hpp XPathSupport.hpp
XPathSupportDefault.cpp XPathSupportDefault.hpp
XPointer.cpp XResultTreeFrag.cpp
XResultTreeFrag.hpp XString.hpp
c/src/XSLT AVT.cpp AVT.hpp ElemApplyImport.cpp
ElemApplyImport.hpp ElemApplyTemplates.cpp
ElemApplyTemplates.hpp ElemAttribute.cpp
ElemAttribute.hpp ElemAttributeSet.cpp
ElemAttributeSet.hpp ElemCallTemplate.cpp
ElemCallTemplate.hpp ElemChoose.cpp ElemChoose.hpp
ElemComment.cpp ElemComment.hpp ElemCopy.cpp
ElemCopy.hpp ElemCopyOf.cpp ElemCopyOf.hpp
ElemDecimalFormat.cpp ElemDecimalFormat.hpp
ElemElement.cpp ElemElement.hpp ElemEmpty.cpp
ElemEmpty.hpp ElemExtensionCall.cpp
ElemExtensionCall.hpp ElemFallback.cpp
ElemFallback.hpp ElemForEach.cpp ElemForEach.hpp
ElemIf.cpp ElemIf.hpp ElemLiteralResult.cpp
ElemLiteralResult.hpp ElemMessage.cpp
ElemMessage.hpp ElemNumber.cpp ElemNumber.hpp
ElemOtherwise.cpp ElemOtherwise.hpp ElemPI.cpp
ElemPI.hpp ElemParam.cpp ElemParam.hpp ElemSort.cpp
ElemSort.hpp ElemTemplate.cpp ElemTemplate.hpp
ElemTemplateElement.cpp ElemTemplateElement.hpp
ElemText.cpp ElemText.hpp ElemTextLiteral.cpp
ElemUse.cpp ElemUse.hpp ElemValueOf.cpp
ElemValueOf.hpp ElemVariable.cpp ElemVariable.hpp
ElemWhen.cpp ElemWhen.hpp ElemWithParam.cpp
ElemWithParam.hpp ExtensionFunctionHandler.cpp
ExtensionFunctionHandler.hpp ExtensionNSHandler.cpp
FunctionDocument.cpp FunctionFormatNumber.cpp
FunctionKey.cpp FunctionSystemProperty.cpp
GenerateEvent.cpp GenerateEvent.hpp KeyTable.cpp
NamespacesHandler.cpp NamespacesHandler.hpp
SelectionEvent.cpp Stylesheet.cpp Stylesheet.hpp
StylesheetConstructionContext.hpp
StylesheetConstructionContextDefault.cpp
StylesheetConstructionContextDefault.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
StylesheetHandler.cpp StylesheetHandler.hpp
StylesheetRoot.cpp TraceListenerDefault.cpp
VariablesStack.cpp XSLTEngineImpl.cpp
XSLTEngineImpl.hpp
XSLTProcessorEnvSupportDefault.cpp
XSLTProcessorException.cpp
XSLTProcessorException.hpp XalanTemplate.cpp
c/src/XalanDOM XalanAttr.hpp XalanCDATASection.hpp
XalanCharacterData.hpp XalanComment.hpp
XalanDOMString.hpp XalanDocument.hpp
XalanDocumentFragment.hpp XalanDocumentType.hpp
XalanElement.hpp XalanEntity.hpp
XalanEntityReference.hpp XalanNode.cpp
XalanNode.hpp XalanNotation.hpp
XalanProcessingInstruction.hpp XalanText.hpp
c/src/XercesParserLiaison XercesAttrBridge.cpp
XercesAttrBridge.hpp XercesBridgeNavigator.cpp
XercesBridgeNavigator.hpp
XercesCDATASectionBridge.cpp
XercesCDATASectionBridge.hpp
XercesCommentBridge.cpp XercesCommentBridge.hpp
XercesDOMImplementationBridge.cpp
XercesDOMImplementationBridge.hpp
XercesDOMSupport.cpp XercesDOMSupport.hpp
XercesDOM_NodeHack.cpp XercesDOM_NodeHack.hpp
XercesDocumentBridge.cpp XercesDocumentBridge.hpp
XercesDocumentFragmentBridge.cpp
XercesDocumentFragmentBridge.hpp
XercesDocumentNamedNodeListCache.cpp
XercesDocumentTypeBridge.cpp
XercesDocumentTypeBridge.hpp
XercesElementBridge.cpp XercesElementBridge.hpp
XercesElementNamedNodeListCache.cpp
XercesEntityBridge.cpp XercesEntityBridge.hpp
XercesEntityReferenceBridge.cpp
XercesEntityReferenceBridge.hpp
XercesNamedNodeListCache.cpp
XercesNamedNodeMapBridge.cpp
XercesNotationBridge.cpp XercesNotationBridge.hpp
XercesParserLiaison.cpp XercesParserLiaison.hpp
XercesProcessingInstructionBridge.cpp
XercesProcessingInstructionBridge.hpp
XercesTextBridge.cpp XercesTextBridge.hpp
Added: c/src/PlatformSupport XalanDOMStringPool.cpp
XalanDOMStringPool.hpp
c/src/XMLSupport FormatterToNull.cpp FormatterToNull.hpp
c/src/XalanDOM XalanDOMString.cpp
c/src/XercesParserLiaison XercesBridgeHelper.cpp
XercesBridgeHelper.hpp
Log:
Major performance overhaul of string handling.
Revision Changes Path
1.19 +137 -69 xml-xalan/c/src/DOMSupport/DOMServices.cpp
Index: DOMServices.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DOMServices.cpp 2000/10/11 19:43:03 1.18
+++ DOMServices.cpp 2000/11/02 01:45:27 1.19
@@ -65,6 +65,7 @@
#include <XalanDOM/XalanAttr.hpp>
#include <XalanDOM/XalanCDATASection.hpp>
#include <XalanDOM/XalanComment.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
#include <XalanDOM/XalanDocument.hpp>
#include <XalanDOM/XalanDocumentFragment.hpp>
#include <XalanDOM/XalanElement.hpp>
@@ -100,6 +101,7 @@
const XalanDOMString& DOMServices::s_XMLNamespace = ::s_XMLNamespace;
const XalanDOMString& DOMServices::s_XMLNamespaceWithSeparator = ::s_XMLNamespaceWithSeparator;
const XalanDOMString& DOMServices::s_XMLNamespaceSeparatorString = ::s_XMLNamespaceSeparatorString;
+const XalanDOMString DOMServices::s_emptyString;
@@ -209,6 +211,18 @@
{
XalanDOMString data;
+ getNodeData(node, data);
+
+ return data;
+}
+
+
+
+void
+DOMServices::getNodeData(
+ const XalanNode& node,
+ XalanDOMString& data)
+{
switch(node.getNodeType())
{
case XalanNode::DOCUMENT_FRAGMENT_NODE:
@@ -219,7 +233,7 @@
#else
static_cast<const XalanDocumentFragment&>(node);
#endif
- data = getNodeData(theDocumentFragment);
+ getNodeData(theDocumentFragment, data);
}
break;
@@ -231,7 +245,7 @@
#else
static_cast<const XalanDocument&>(node);
#endif
- data = getNodeData(theDocument);
+ getNodeData(theDocument, data);
}
break;
@@ -243,7 +257,7 @@
#else
static_cast<const XalanElement&>(node);
#endif
- data = getNodeData(theElement);
+ getNodeData(theElement, data);
}
break;
@@ -257,7 +271,7 @@
static_cast<const XalanText&>(node);
#endif
- data = getNodeData(theTextNode);
+ getNodeData(theTextNode, data);
}
break;
@@ -269,7 +283,7 @@
#else
static_cast<const XalanAttr&>(node);
#endif
- data = getNodeData(theAttr);
+ getNodeData(theAttr, data);
}
break;
@@ -281,7 +295,7 @@
#else
static_cast<const XalanComment&>(node);
#endif
- data = getNodeData(theComment);
+ getNodeData(theComment, data);
}
break;
@@ -293,7 +307,7 @@
#else
static_cast<const XalanProcessingInstruction&>(node);
#endif
- data = getNodeData(thePI);
+ getNodeData(thePI, data);
}
break;
@@ -301,8 +315,6 @@
// ignore
break;
}
-
- return data;
}
@@ -315,6 +327,16 @@
+void
+DOMServices::getNodeData(
+ const XalanAttr& attribute,
+ XalanDOMString& data)
+{
+ append(data, attribute.getNodeValue());
+}
+
+
+
XalanDOMString
DOMServices::getNodeData(const XalanComment& comment)
{
@@ -323,11 +345,33 @@
+void
+DOMServices::getNodeData(
+ const XalanComment& comment,
+ XalanDOMString& data)
+{
+ append(data, comment.getData());
+}
+
+
+
XalanDOMString
DOMServices::getNodeData(const XalanDocument& document)
{
XalanDOMString data;
+ getNodeData(document, data);
+
+ return data;
+}
+
+
+
+void
+DOMServices::getNodeData(
+ const XalanDocument& document,
+ XalanDOMString& data)
+{
const XalanNode* child = document.getFirstChild();
while(child != 0)
@@ -338,19 +382,11 @@
theType == XalanNode::TEXT_NODE ||
theType == XalanNode::CDATA_SECTION_NODE)
{
- const XalanDOMString nodeData =
- getNodeData(*child);
-
- if(0 < length(nodeData))
- {
- data += nodeData;
- }
+ getNodeData(*child, data);
}
child = child->getNextSibling();
}
-
- return data;
}
@@ -360,6 +396,18 @@
{
XalanDOMString data;
+ getNodeData(documentFragment, data);
+
+ return data;
+}
+
+
+
+void
+DOMServices::getNodeData(
+ const XalanDocumentFragment& documentFragment,
+ XalanDOMString& data)
+{
const XalanNodeList* const nl = documentFragment.getChildNodes();
assert(nl != 0);
@@ -376,17 +424,9 @@
theType == XalanNode::TEXT_NODE ||
theType == XalanNode::CDATA_SECTION_NODE)
{
- const XalanDOMString nodeData =
- getNodeData(*child);
-
- if(0 < length(nodeData))
- {
- data += nodeData;
- }
+ getNodeData(*child, data);
}
}
-
- return data;
}
@@ -396,6 +436,18 @@
{
XalanDOMString data;
+ getNodeData(element, data);
+
+ return data;
+}
+
+
+
+void
+DOMServices::getNodeData(
+ const XalanElement& element,
+ XalanDOMString& data)
+{
const XalanNode* child = element.getFirstChild();
while(child != 0)
@@ -406,19 +458,11 @@
theType == XalanNode::TEXT_NODE ||
theType == XalanNode::CDATA_SECTION_NODE)
{
- const XalanDOMString nodeData =
- getNodeData(*child);
-
- if(0 < length(nodeData))
- {
- data += nodeData;
- }
+ getNodeData(*child, data);
}
child = child->getNextSibling();
}
-
- return data;
}
@@ -431,6 +475,16 @@
+void
+DOMServices::getNodeData(
+ const XalanProcessingInstruction& pi,
+ XalanDOMString& data)
+{
+ append(data, pi.getData());
+}
+
+
+
XalanDOMString
DOMServices::getNodeData(const XalanText& text)
{
@@ -439,54 +493,66 @@
-XalanDOMString
-DOMServices::getNameOfNode(const XalanNode& n)
+void
+DOMServices::getNodeData(
+ const XalanText& text,
+ XalanDOMString& data)
{
- XalanDOMString theResult;
+ append(data, text.getData());
+}
+
+
+const XalanDOMString&
+DOMServices::getNameOfNode(const XalanNode& n)
+{
const XalanNode::NodeType theNodeType =
n.getNodeType();
if (theNodeType == XalanNode::ATTRIBUTE_NODE)
{
- const XalanAttr& theAttributeNode =
-#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanAttr&)(n);
-#else
- static_cast<const XalanAttr&>(n);
-#endif
+ const XalanDOMString& theName = n.getNodeName();
- theResult = theAttributeNode.getName();
-
- if (startsWith(theResult, DOMServices::s_XMLNamespaceWithSeparator) == true)
+ if (startsWith(theName, s_XMLNamespaceWithSeparator) == true)
{
- // Uh oh, it's a namespace node, represented as an attribute in
- // the DOM. XSLT says we have to strip off the xmlns: part...
- theResult = substring(theResult, length(DOMServices::s_XMLNamespaceWithSeparator));
+ // Special case for namespace nodes...
+ return n.getLocalName();
}
-
+ else
+ {
+ return theName;
+ }
}
else if (theNodeType == XalanNode::ELEMENT_NODE ||
theNodeType == XalanNode::PROCESSING_INSTRUCTION_NODE)
{
- theResult = n.getNodeName();
+ return n.getNodeName();
}
-
- return theResult;
+ else
+ {
+ return s_emptyString;
+ }
}
// Note: This may be inefficient in a Level 2 DOM, where localname
// and prefix may (or may not) have been stored in separate fields
-XalanDOMString
+const XalanDOMString&
DOMServices::getLocalNameOfNode(const XalanNode& n)
{
- const XalanDOMString qname = n.getNodeName();
+ const XalanDOMString& theLocalName = n.getLocalName();
- const unsigned int index = indexOf(qname, XalanUnicode::charColon);
+ if (length(theLocalName) != 0)
+ {
+ return theLocalName;
+ }
+ else
+ {
+ assert(length(n.getNodeName()) != 0);
- return index == length(qname) ? qname : substring(qname, index + 1);
+ return n.getNodeName();
+ }
}
@@ -572,7 +638,7 @@
if(doc == 0)
{
- throw DOMSupportException("Attribute child does not have an owner document!");
+ throw DOMSupportException(TranscodeFromLocalCodePage("Attribute child does not have an owner document!"));
}
else
{
@@ -588,7 +654,7 @@
if(nodeType != XalanNode::DOCUMENT_NODE && parent == 0)
{
- throw DOMSupportException("Child does not have parent!");
+ throw DOMSupportException(TranscodeFromLocalCodePage("Child does not have parent!"));
}
}
@@ -617,17 +683,17 @@
// than the parser, we need to decide between demanding a
// namespace-normalized DOM as input, doing a normalize pass
// (full treewalk, expensive), or recognizing implicit declarations.
-XalanDOMString
+const XalanDOMString&
DOMServices::getNamespaceForPrefix(
const XalanDOMString& prefix,
const XalanElement& namespaceContext)
{
- XalanDOMString theNamespace;
+ const XalanDOMString* theNamespace = &s_emptyString;
// Reserved xml: is hardcoded
if(equals(prefix, s_XMLString) == true)
{
- theNamespace = s_XMLNamespaceURI;
+ theNamespace = &s_XMLNamespaceURI;
}
else
{
@@ -637,7 +703,7 @@
// Consider elements until NS is resolved, or we run out of
// ancestors, or we hit something other than an Element or
// EntityReference node (ie, Document or DocumentFragment)
- while (parent != 0 && length(theNamespace) == 0
+ while (parent != 0 && length(*theNamespace) == 0
&& ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
|| type == XalanNode::ENTITY_REFERENCE_NODE))
{
@@ -655,7 +721,7 @@
const XalanNode* const attr = nnm->item(i);
assert(attr != 0);
- const XalanDOMString aname = attr->getNodeName();
+ const XalanDOMString& aname = attr->getNodeName();
const unsigned int len = length(aname);
@@ -670,14 +736,14 @@
// slightly inefficient for default decl.
const unsigned int index = indexOf(aname,
XalanUnicode::charColon);
-
+
const XalanDOMString p = (isPrefix)
? substring(aname,index + 1,len)
: XalanDOMString();
if (equals(p, prefix) == true)
{
- theNamespace = attr->getNodeValue();
+ theNamespace = &attr->getNodeValue();
break;
}
@@ -688,8 +754,10 @@
parent = getParentOfNode(*parent);
}
}
+
+ assert(theNamespace != 0);
- return theNamespace;
+ return *theNamespace;
}
1.15 +95 -5 xml-xalan/c/src/DOMSupport/DOMServices.hpp
Index: DOMServices.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DOMServices.hpp 2000/09/05 19:33:39 1.14
+++ DOMServices.hpp 2000/11/02 01:45:28 1.15
@@ -101,7 +101,10 @@
static const unsigned int& s_XMLNamespaceWithSeparatorLength;
static const unsigned int& s_XMLNamespaceSeparatorStringLength;
+ // A dummy string to return when we need an emtpy string...
+ static const XalanDOMString s_emptyString;
+
class XALAN_DOMSUPPORT_EXPORT WhitespaceSupport
{
public:
@@ -169,6 +172,17 @@
/**
* Retrieves data for node
*
+ * @param node DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanNode& node,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param attribute DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -179,6 +193,17 @@
* Retrieves data for node
*
* @param attribute DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanAttr& attribute,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
+ * @param attribute DOM node whose data is to be returned
* @return a string representation of the node's data
*/
static XalanDOMString
@@ -187,6 +212,17 @@
/**
* Retrieves data for node
*
+ * @param attribute DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanComment& comment,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param document DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -196,6 +232,17 @@
/**
* Retrieves data for node
*
+ * @param document DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanDocument& document,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param documentFragment DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -205,6 +252,17 @@
/**
* Retrieves data for node
*
+ * @param documentFragment DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanDocumentFragment& documentFragment,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param element DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -214,6 +272,17 @@
/**
* Retrieves data for node
*
+ * @param element DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanElement& element,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param pi DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -223,6 +292,17 @@
/**
* Retrieves data for node
*
+ * @param pi DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanProcessingInstruction& pi,
+ XalanDOMString& data);
+
+ /**
+ * Retrieves data for node
+ *
* @param node DOM node whose data is to be returned
* @return a string representation of the node's data
*/
@@ -230,6 +310,17 @@
getNodeData(const XalanText& text);
/**
+ * Retrieves data for node
+ *
+ * @param node DOM node whose data is to be returned
+ * @param data a string to which the node's data will be appended
+ */
+ static void
+ getNodeData(
+ const XalanText& text,
+ XalanDOMString& data);
+
+ /**
* Retrieve the name of the node, taking into
* account the differences between the DOM and
* XSLT data models.
@@ -237,7 +328,7 @@
* @param node DOM node whose name is returned
* @return name of the node
*/
- static XalanDOMString
+ static const XalanDOMString&
getNameOfNode(const XalanNode& n);
/**
@@ -248,7 +339,7 @@
* @param node DOM node whose name is returned
* @return name of node without namespace
*/
- static XalanDOMString
+ static const XalanDOMString&
getLocalNameOfNode(const XalanNode& n);
/**
@@ -268,7 +359,7 @@
* @param namespaceContext DOM element representing the context for namespace
* @return URI corresponding to namespace
*/
- static XalanDOMString
+ static const XalanDOMString&
getNamespaceForPrefix(
const XalanDOMString& prefix,
const XalanElement& namespaceContext);
@@ -298,8 +389,7 @@
const XalanNode& parent,
const XalanNode& child1,
const XalanNode& child2);
-
-}; // class DOMServices
+};
1.4 +3 -3 xml-xalan/c/src/DOMSupport/DOMSupport.hpp
Index: DOMSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupport.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMSupport.hpp 2000/04/11 14:30:44 1.3
+++ DOMSupport.hpp 2000/11/02 01:45:28 1.4
@@ -101,7 +101,7 @@
* @param theNode DOM node whose namespace is queried
* @return namespace corresponding to 'theNode'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& theNode) const = 0;
/**
@@ -110,7 +110,7 @@
* @param elem DOM element queried
* @return expanded name corresponding to 'elem'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const = 0;
/**
@@ -119,7 +119,7 @@
* @param attr DOM attribute queried
* @return expanded name corresponding to 'attr'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const = 0;
};
1.6 +43 -11 xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp
Index: DOMSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DOMSupportDefault.cpp 2000/09/05 02:24:43 1.5
+++ DOMSupportDefault.cpp 2000/11/02 01:45:28 1.6
@@ -77,7 +77,8 @@
DOMSupportDefault::DOMSupportDefault() :
DOMSupport(),
- m_resolver()
+ m_resolver(),
+ m_pool()
{
}
@@ -97,7 +98,7 @@
-XalanDOMString
+const XalanDOMString&
DOMSupportDefault::getNamespaceOfNode(const XalanNode& theNode) const
{
return m_resolver.getNamespaceOfNode(theNode);
@@ -105,22 +106,53 @@
-XalanDOMString
+const XalanDOMString&
DOMSupportDefault::getExpandedElementName(const XalanElement& elem) const
{
- const XalanDOMString theNamespace = getNamespaceOfNode(elem);
-
- return (0 != length(theNamespace)) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + DOMServices::getLocalNameOfNode(elem)
- : DOMServices::getLocalNameOfNode(elem);
+ return getExpandedName(elem);
}
-XalanDOMString
+const XalanDOMString&
DOMSupportDefault::getExpandedAttributeName(const XalanAttr& attr) const
{
- const XalanDOMString theNamespace = getNamespaceOfNode(attr);
+ return getExpandedName(attr);
+}
+
+
+
+const XalanDOMString&
+DOMSupportDefault::getExpandedName(const XalanNode& node) const
+{
+ const XalanDOMString& theNamespace = getNamespaceOfNode(node);
+
+ const unsigned int theNamespaceLength = length(theNamespace);
+
+ if (0 == theNamespaceLength)
+ {
+ return DOMServices::getLocalNameOfNode(node);
+ }
+ else
+ {
+ const XalanDOMString& theLocalName = DOMServices::getLocalNameOfNode(node);
+
+ XalanDOMString theResult;
+
+ reserve(
+ theResult,
+ theNamespaceLength + DOMServices::s_XMLNamespaceSeparatorStringLength + length(theLocalName) + 1);
+
+ theResult = theNamespace;
+
+ append(theResult, DOMServices::s_XMLNamespaceSeparatorString);
+
+ append(theResult, theLocalName);
- return (0 != length(theNamespace)) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + DOMServices::getLocalNameOfNode(attr)
- : DOMServices::getLocalNameOfNode(attr);
+#if defined(XALAN_NO_MUTABLE)
+ return ((DOMSupportDefault*)this)->m_pool.get(theResult);
+#else
+ return m_pool.get(theResult);
+#endif
+ }
}
1.4 +13 -4 xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp
Index: DOMSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMSupportDefault.hpp 2000/04/11 14:30:44 1.3
+++ DOMSupportDefault.hpp 2000/11/02 01:45:28 1.4
@@ -64,6 +64,10 @@
+#include <PlatformSupport/XalanDOMStringPool.hpp>
+
+
+
#include <DOMSupport/DOMSupport.hpp>
#include <DOMSupport/NamespaceResolver.hpp>
@@ -84,18 +88,23 @@
reset();
// These interfaces are inherited from DOMSupport...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& theNode) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
private:
+
+ const XalanDOMString&
+ getExpandedName(const XalanNode& node) const;
+
+ NamespaceResolver m_resolver;
- NamespaceResolver m_resolver;
+ mutable XalanDOMStringPool m_pool;
};
1.12 +16 -15 xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp
Index: NamespaceResolver.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- NamespaceResolver.cpp 2000/09/05 02:24:43 1.11
+++ NamespaceResolver.cpp 2000/11/02 01:45:29 1.12
@@ -76,7 +76,6 @@
NamespaceResolver::NamespaceResolver() :
- Resettable(),
m_NSInfos()
{
}
@@ -128,7 +127,7 @@
//
// Note that DOM Level 2 binds this value at the time the node is built, which should
// be considerably more efficient.
-XalanDOMString
+const XalanDOMString&
NamespaceResolver::getNamespaceOfNode(const XalanNode& theNode) const
{
#if !defined(XALAN_NO_NAMESPACES)
@@ -170,19 +169,19 @@
hasProcessedNS = false;
}
- XalanDOMString namespaceOfPrefix;
+ const XalanDOMString* namespaceOfPrefix = &DOMServices::s_emptyString;
if(hasProcessedNS)
{
- namespaceOfPrefix = nsInfo.m_namespace;
+ namespaceOfPrefix = &nsInfo.m_namespace;
}
else
{
- XalanDOMString nodeName = theLocalNode->getNodeName();
+ const XalanDOMString& nodeName = theLocalNode->getNodeName();
- unsigned int indexOfNSSep = indexOf(nodeName, XalanUnicode::charColon);
+ unsigned int indexOfNSSep = indexOf(nodeName, XalanUnicode::charColon);
- XalanDOMString prefix;
+ XalanDOMString prefix;
// JKESS CHANGE: Attributes which have no prefix have no namespace,
// per standard Namespaces In XML behavior. They should not inherit from
@@ -195,7 +194,7 @@
// this result via updateNamespace.
// BIG UGLY RETURN HERE!!!!!!!
- return namespaceOfPrefix;
+ return *namespaceOfPrefix;
}
prefix = (indexOfNSSep < length(nodeName))
@@ -210,7 +209,7 @@
// not specified by the NS spec.)
if(equals(prefix, DOMServices::s_XMLString) == true)
{
- namespaceOfPrefix = DOMServices::s_XMLNamespaceURI;
+ namespaceOfPrefix = &DOMServices::s_XMLNamespaceURI;
}
else
{
@@ -225,7 +224,7 @@
candidateNoAncestorXMLNS.reserve(eDefaultVectorSize);
// Hunt upward until resolve namespace or fail to do so.
- while (0 != parent && length(namespaceOfPrefix) == 0)
+ while (0 != parent && length(*namespaceOfPrefix) == 0)
{
if(theIterator != m_NSInfos.end()
&& nsInfo.m_ancestorHasXMLNSAttrs == nsInfo.ANCESTORNOXMLNS)
@@ -254,7 +253,7 @@
{
const XalanNode* attr = nnm->item(i);
- const XalanDOMString aname = attr->getNodeName();
+ const XalanDOMString& aname = attr->getNodeName();
// Quick test of first character, to reduce cost of startsWith.
if(charAt(aname, 0) == charAt(DOMServices::s_XMLNamespaceWithSeparator, 0))
@@ -283,7 +282,7 @@
// If it's the one we're looking for, resolve to NS
if (equals(p, prefix) == true)
{
- namespaceOfPrefix = attr->getNodeValue();
+ namespaceOfPrefix = &attr->getNodeValue();
break;
}
}
@@ -373,8 +372,10 @@
// bit-masks...
if(XalanNode::ATTRIBUTE_NODE != ntype)
{
+ assert(namespaceOfPrefix != 0);
+
// If Attribute's prefix wasn't resolved
- if(0 == length(namespaceOfPrefix))
+ if(0 == length(*namespaceOfPrefix))
{
// In context where other prefixes are defined
if(ancestorsHaveXMLNS == true)
@@ -400,10 +401,10 @@
}
else // Attribute's prefix was resolved, at least that one is declared
{
- updateNamespace(theLocalNode, NSInfo(namespaceOfPrefix, nHasXMLNS));
+ updateNamespace(theLocalNode, NSInfo(*namespaceOfPrefix, nHasXMLNS));
}
}
}
- return namespaceOfPrefix;
+ return *namespaceOfPrefix;
}
1.9 +2 -3 xml-xalan/c/src/DOMSupport/NamespaceResolver.hpp
Index: NamespaceResolver.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/NamespaceResolver.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NamespaceResolver.hpp 2000/09/19 00:24:14 1.8
+++ NamespaceResolver.hpp 2000/11/02 01:45:29 1.9
@@ -78,12 +78,11 @@
-#include <PlatformSupport/Resettable.hpp>
#include <DOMSupport/NSInfo.hpp>
-class XALAN_DOMSUPPORT_EXPORT NamespaceResolver : public Resettable
+class XALAN_DOMSUPPORT_EXPORT NamespaceResolver
{
public:
@@ -104,7 +103,7 @@
* @param theNode DOM node
* @return namespace of 'theNode'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& theNode) const;
#if defined(XALAN_NO_NAMESPACES)
1.5 +2 -2 xml-xalan/c/src/ICUBridge/FunctionICUFormatNumber.cpp
Index: FunctionICUFormatNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/FunctionICUFormatNumber.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionICUFormatNumber.cpp 2000/09/05 02:24:44 1.4
+++ FunctionICUFormatNumber.cpp 2000/11/02 01:45:32 1.5
@@ -75,7 +75,7 @@
FunctionICUFormatNumber::FunctionICUFormatNumberInstaller::FunctionICUFormatNumberInstaller()
{
XPath::installFunction(
- XALAN_STATIC_UCODE_STRING("format-number"),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("format-number")),
FunctionICUFormatNumber());
}
@@ -85,7 +85,7 @@
{
// Reinstall the standard function to overwrite the ICU version...
XPath::installFunction(
- XALAN_STATIC_UCODE_STRING("format-number"),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("format-number")),
FunctionFormatNumber());
}
1.9 +4 -1 xml-xalan/c/src/ICUBridge/ICUBridge.cpp
Index: ICUBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUBridge.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ICUBridge.cpp 2000/09/27 16:38:09 1.8
+++ ICUBridge.cpp 2000/11/02 01:45:32 1.9
@@ -60,7 +60,6 @@
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
#include <PlatformSupport/XalanDecimalFormatSymbols.hpp>
@@ -72,6 +71,10 @@
#include <unicode/coll.h>
#include <unicode/dcfmtsym.h>
#include <unicode/decimfmt.h>
+
+
+
+#include <Include/XalanAutoPtr.hpp>
1.8 +1 -1 xml-xalan/c/src/PlatformSupport/ArenaBlock.hpp
Index: ArenaBlock.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ArenaBlock.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ArenaBlock.hpp 2000/10/12 17:06:53 1.7
+++ ArenaBlock.hpp 2000/11/02 01:45:34 1.8
@@ -364,7 +364,7 @@
size_type
getBlockOffset(const ObjectType* theObject) const
{
- assert(theObject - m_objectBlock < m_blockSize);
+ assert(size_type(theObject - m_objectBlock) < m_blockSize);
return theObject - m_objectBlock;
}
1.14 +100 -109 xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp
Index: AttributeListImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AttributeListImpl.cpp 2000/09/19 14:43:19 1.13
+++ AttributeListImpl.cpp 2000/11/02 01:45:34 1.14
@@ -64,17 +64,18 @@
-#include "DOMStringHelper.hpp"
-#include "XalanAutoPtr.hpp"
+#include <Include/XalanAutoPtr.hpp>
+#include "STLHelper.hpp"
+
+
+
AttributeListImpl::AttributeListImpl() :
AttributeList(),
- m_AttributeKeyMap(),
m_AttributeVector()
{
- m_AttributeVector.reserve(eDefaultVectorSize);
}
@@ -89,28 +90,24 @@
AttributeListImpl::AttributeListImpl(const AttributeListImpl& theSource) :
AttributeList(),
- m_AttributeKeyMap(),
m_AttributeVector()
{
// Use the assignment operator to do the dirty work...
*this = theSource;
assert(getLength() == theSource.getLength());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
}
AttributeListImpl::AttributeListImpl(const AttributeList& theSource) :
AttributeList(),
- m_AttributeKeyMap(),
m_AttributeVector()
{
// Use the assignment operator to do the dirty work...
*this = theSource;
assert(getLength() == theSource.getLength());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
}
@@ -122,7 +119,7 @@
using std::for_each;
#endif
- // Delete all of the objects in the temp vector.
+ // Delete all of the objects in the vector.
for_each(theVector.begin(),
theVector.end(),
DeleteFunctor<AttributeVectorEntry>());
@@ -140,47 +137,38 @@
// Some temporary structures to hold everything
// until we're done.
- AttributeKeyMapType tempMap;
AttributeVectorType tempVector;
const unsigned int theLength = theRHS.getLength();
- // Reserve the appropriate capacity right now...
- tempVector.reserve(theLength);
-
+ if (theLength > 0)
{
+ // Reserve the appropriate capacity right now...
+ tempVector.reserve(theLength);
+
// This will delete everything in tempVector when we're done...
CollectionDeleteGuard<AttributeVectorType,
DeleteFunctor<AttributeVectorEntry> > theGuard(tempVector);
+ typedef AttributeVectorType::const_iterator const_iterator;
+
+ const const_iterator theEnd = theRHS.m_AttributeVector.begin();
+
// Copy the vector entries, and build the index map...
- for(unsigned int i = 0; i < theLength; i++)
+ for(const_iterator i = theRHS.m_AttributeVector.end(); i != theEnd; ++i)
{
- assert(theRHS.m_AttributeVector[i] != 0);
-
- XalanAutoPtr<AttributeVectorEntry> theEntry(
- new AttributeVectorEntry(*theRHS.m_AttributeVector[i]));
+ assert(*i != 0);
// Add the item...
- tempVector.push_back(theEntry.get());
-
- // The entry is now safely in the vector, so release the
- // XalanAutoPtr...
- AttributeVectorEntry* const entry = theEntry.release();
-
- // Create an entry in the index map...
- tempMap.insert(AttributeKeyMapType::value_type(entry->m_Name.begin(),
- entry));
+ tempVector.push_back(new AttributeVectorEntry(**i));
}
// OK, we're safe, so swap the contents of the
// containers. This is guaranteed not to throw.
- m_AttributeKeyMap.swap(tempMap);
m_AttributeVector.swap(tempVector);
}
assert(getLength() == theLength);
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
}
return *this;
@@ -227,8 +215,6 @@
unsigned int
AttributeListImpl::getLength() const
{
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
-
return m_AttributeVector.size();
}
@@ -238,7 +224,6 @@
AttributeListImpl::getName(const unsigned int index) const
{
assert(index < getLength());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
return m_AttributeVector[index]->m_Name.begin();
}
@@ -249,7 +234,6 @@
AttributeListImpl::getType(const unsigned int index) const
{
assert(index < getLength());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
return m_AttributeVector[index]->m_Type.begin();
}
@@ -260,27 +244,51 @@
AttributeListImpl::getValue(const unsigned int index) const
{
assert(index < getLength());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
return m_AttributeVector[index]->m_Value.begin();
}
+struct NameCompareFunctor
+{
+ NameCompareFunctor(const XMLCh* theName) :
+ m_name(theName)
+ {
+ }
+
+ bool
+ operator()(const AttributeListImpl::AttributeVectorEntry* theEntry) const
+ {
+ return equals(theEntry->m_Name.begin(), m_name);
+ }
+
+private:
+
+ const XMLCh* const m_name;
+};
+
+
+
const XMLCh*
AttributeListImpl::getType(const XMLCh* const name) const
{
assert(name != 0);
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
+
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find_if;
+#endif
- // Find the name in the key map.
- const AttributeKeyMapType::const_iterator i =
- m_AttributeKeyMap.find(name);
+ const AttributeVectorType::const_iterator i =
+ find_if(
+ m_AttributeVector.begin(),
+ m_AttributeVector.end(),
+ NameCompareFunctor(name));
- if (i != m_AttributeKeyMap.end())
+ if (i != m_AttributeVector.end())
{
// Found it, so return a pointer to the type.
- return (*i).second->m_Type.begin();
+ return (*i)->m_Type.begin();
}
else
{
@@ -302,16 +310,21 @@
AttributeListImpl::getValue(const XMLCh* const name) const
{
assert(name != 0);
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
+
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find_if;
+#endif
- // Find the name in the key map.
- const AttributeKeyMapType::const_iterator i =
- m_AttributeKeyMap.find(name);
+ const AttributeVectorType::const_iterator i =
+ find_if(
+ m_AttributeVector.begin(),
+ m_AttributeVector.end(),
+ NameCompareFunctor(name));
- if (i != m_AttributeKeyMap.end())
+ if (i != m_AttributeVector.end())
{
// Found it, so return a pointer to the value.
- return (*i).second->m_Value.begin();
+ return (*i)->m_Value.begin();
}
else
{
@@ -332,24 +345,24 @@
// Clear everything out.
m_AttributeVector.clear();
- m_AttributeKeyMap.clear();
}
+
// A convenience function to find the length of a null-terminated
// array of XMLChs
-static const XMLCh*
+inline const XMLCh*
endArray(const XMLCh* data)
{
- const XMLCh* theEnd = data;
+ assert(data != 0);
- while(*theEnd)
+ while(*data)
{
- ++theEnd;
+ ++data;
}
- return theEnd;
+ return data;
}
@@ -360,39 +373,42 @@
const XMLCh* type,
const XMLCh* value)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::copy;
-#endif
-
assert(name != 0);
assert(type != 0);
assert(value != 0);
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
bool fResult = false;
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find_if;
+ using std::copy;
+#endif
+
// Update the attribute, if it's already there...
- const AttributeKeyMapType::iterator i =
- m_AttributeKeyMap.find(name);
+ const AttributeVectorType::const_iterator i =
+ find_if(
+ m_AttributeVector.begin(),
+ m_AttributeVector.end(),
+ NameCompareFunctor(name));
- if (i != m_AttributeKeyMap.end())
+ if (i != m_AttributeVector.end())
{
// This is a special optimization for type, since it's (almost) always "CDATA".
- if (equals(type, (*i).second->m_Type.begin()) == false)
+ if (equals(type, (*i)->m_Type.begin()) == false)
{
// If necessary, create the a new vector and swap them. Otherwise,
// just copy the new data in.
const XMLCh* const theNewTypeEnd = endArray(type) + 1;
- if ((*i).second->m_Type.capacity() < XMLChVectorType::size_type(theNewTypeEnd - type))
+ if ((*i)->m_Type.capacity() < XMLChVectorType::size_type(theNewTypeEnd - type))
{
XMLChVectorType theNewType(type, theNewTypeEnd);
- theNewType.swap((*i).second->m_Type);
+ theNewType.swap((*i)->m_Type);
}
else
{
- copy(type, theNewTypeEnd, (*i).second->m_Type.begin());
+ copy(type, theNewTypeEnd, (*i)->m_Type.begin());
}
}
@@ -400,40 +416,36 @@
// If necessary, create the a new vector and swap them. Otherwise,
// just copy the new data in.
- if ((*i).second->m_Value.capacity() < XMLChVectorType::size_type(theNewValueEnd - value))
+ if ((*i)->m_Value.capacity() < XMLChVectorType::size_type(theNewValueEnd - value))
{
XMLChVectorType theNewValue(value, theNewValueEnd);
- theNewValue.swap((*i).second->m_Value);
+ theNewValue.swap((*i)->m_Value);
}
else
{
- copy(value, theNewValueEnd, (*i).second->m_Value.begin());
+ copy(value, theNewValueEnd, (*i)->m_Value.begin());
}
}
else
{
- XalanAutoPtr<AttributeVectorEntry> theEntry(
- new AttributeVectorEntry(XMLChVectorType(name, endArray(name) + 1),
- XMLChVectorType(value, endArray(value) + 1),
- XMLChVectorType(type, endArray(type) + 1)));
+ if (m_AttributeVector.capacity() == 0)
+ {
+ m_AttributeVector.reserve(eDefaultVectorSize);
+ }
+
+ XalanAutoPtr<AttributeVectorEntry> theEntry(new AttributeVectorEntry(name, value, type));
// Add the new one.
m_AttributeVector.push_back(theEntry.get());
// The entry is now safely in the vector, so release the
// XalanAutoPtr...
- AttributeVectorEntry* const entry = theEntry.release();
+ theEntry.release();
- // Create an entry in the index map.
- m_AttributeKeyMap.insert(AttributeKeyMapType::value_type(entry->m_Name.begin(), entry));
-
fResult = true;
}
- assert(m_AttributeKeyMap.find(name) != m_AttributeKeyMap.end());
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
-
return fResult;
}
@@ -443,46 +455,25 @@
AttributeListImpl::removeAttribute(const XMLCh* name)
{
assert(name != 0);
- assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
#if !defined(XALAN_NO_NAMESPACES)
- using std::bind1st;
- using std::equal_to;
using std::find_if;
#endif
bool fResult = false;
-
- // Find it in the key map.
- const AttributeKeyMapType::iterator i =
- m_AttributeKeyMap.find(name);
-
- if (i != m_AttributeKeyMap.end())
- {
- // Found it, so now find the entry in the
- // vector.
- const AttributeVectorType::iterator j =
- find_if(m_AttributeVector.begin(),
- m_AttributeVector.end(),
- bind1st(equal_to<AttributeVectorEntry*>(), (*i).second));
- assert(j != m_AttributeVector.end());
-
- // This will delete the entry, even if something
- // bad happens updating the containers.
- XalanAutoPtr<AttributeVectorEntry> theGuard(*j);
-
- // Erase it from the vector.
- m_AttributeVector.erase(j);
- assert(m_AttributeVector.size() ==
- m_AttributeKeyMap.size() - 1);
-
- // Erase it from the key map.
- m_AttributeKeyMap.erase(i);
+ // Update the attribute, if it's already there...
+ const AttributeVectorType::iterator i =
+ find_if(
+ m_AttributeVector.begin(),
+ m_AttributeVector.end(),
+ NameCompareFunctor(name));
- assert(m_AttributeVector.size() ==
- m_AttributeKeyMap.size());
+ if (i != m_AttributeVector.end())
+ {
+ delete *i;
+ m_AttributeVector.erase(i);
fResult = true;
}
1.12 +12 -20 xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp
Index: AttributeListImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AttributeListImpl.hpp 2000/09/19 14:43:21 1.11
+++ AttributeListImpl.hpp 2000/11/02 01:45:34 1.12
@@ -64,7 +64,6 @@
-#include <map>
#include <vector>
@@ -74,7 +73,6 @@
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/STLHelper.hpp>
@@ -157,8 +155,6 @@
void
swap(AttributeListImpl& theOther)
{
- m_AttributeKeyMap.swap(theOther.m_AttributeKeyMap);
-
m_AttributeVector.swap(theOther.m_AttributeVector);
}
@@ -191,10 +187,19 @@
m_Type(theType)
{
}
+
+ AttributeVectorEntry(const XMLCh* theName,
+ const XMLCh* theValue,
+ const XMLCh* theType) :
+ m_Name(theName, theName + length(theName) + 1),
+ m_Value(theValue, theValue + length(theValue) + 1),
+ m_Type(theType, theType + length(theType) + 1)
+ {
+ }
- const XMLChVectorType m_Name;
- XMLChVectorType m_Value;
- XMLChVectorType m_Type;
+ XMLChVectorType m_Name;
+ XMLChVectorType m_Value;
+ XMLChVectorType m_Type;
};
typedef AttributeVectorEntry::XMLChVectorType XMLChVectorType;
@@ -202,21 +207,9 @@
#if defined(XALAN_NO_NAMESPACES)
// This vector will hold the entries.
typedef vector<AttributeVectorEntry*> AttributeVectorType;
-
- // This map will associate a name with a pointer to the entry that corresponds
- // to that name.
- typedef map<const XMLCh*,
- AttributeVectorEntry*,
- less_null_terminated_arrays<XMLCh> > AttributeKeyMapType;
#else
// This vector will hold the entries.
typedef std::vector<AttributeVectorEntry*> AttributeVectorType;
-
- // This map will associate a name with a pointer to the entry that corresponds
- // to that name.
- typedef std::map<const XMLCh*,
- AttributeVectorEntry*,
- less_null_terminated_arrays<XMLCh> > AttributeKeyMapType;
#endif
private:
@@ -235,7 +228,6 @@
static void
deleteEntries(AttributeVectorType& theVector);
- AttributeKeyMapType m_AttributeKeyMap;
AttributeVectorType m_AttributeVector;
};
1.41 +378 -211 xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp
Index: DOMStringHelper.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- DOMStringHelper.cpp 2000/10/11 21:13:34 1.40
+++ DOMStringHelper.cpp 2000/11/02 01:45:35 1.41
@@ -96,10 +96,13 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include "DoubleSupport.hpp"
#include "STLHelper.hpp"
#include "XalanOutputStream.hpp"
-#include "XalanAutoPtr.hpp"
#include "XalanUnicode.hpp"
@@ -331,41 +334,55 @@
+static const XalanDOMChar theDummyEmptyString = 0;
+
+
+
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
startsWith(
- const XalanDOMString& theDOMString,
+ const XalanDOMChar* theString,
const XalanDOMString& theSubstring)
{
- const bool fStringIsEmpty = isEmpty(theDOMString);
- const bool fSubstringIsEmpty = isEmpty(theSubstring);
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theSubstring);
- // $$$ ToDo: Are these cases with the empty strings
- // correct?
- if (fStringIsEmpty == true)
- {
- if (fSubstringIsEmpty == false)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- else if (isEmpty(theSubstring) == true)
- {
- // Apparently, Java believes this to be true;
- return true;
- }
- else
- {
- return startsWith(c_wstr(theDOMString), c_wstr(theSubstring));
- }
+ return startsWith(theString, theBuffer == 0 ? &theDummyEmptyString : theBuffer);
}
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+startsWith(
+ const XalanDOMString& theString,
+ const XalanDOMChar* theSubstring)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theString);
+
+ return startsWith(theBuffer == 0 ? &theDummyEmptyString : theBuffer, theSubstring);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+startsWith(
+ const XalanDOMString& theString,
+ const XalanDOMString& theSubstring)
+{
+ const XalanDOMChar* const theStringBuffer =
+ c_wstr(theString);
+
+ const XalanDOMChar* const theSubstringBuffer =
+ c_wstr(theSubstring);
+
+ return startsWith(
+ theStringBuffer == 0 ? &theDummyEmptyString : theStringBuffer,
+ theSubstringBuffer == 0 ? &theDummyEmptyString : theSubstringBuffer);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
endsWith(
const XalanDOMChar* theString,
const XalanDOMChar* theSubstring)
@@ -578,7 +595,7 @@
// parameter.
theBuffer.reserve(theLength);
- const XalanDOMChar* const ptr = theString.rawBuffer();
+ const XalanDOMChar* const ptr = toCharArray(theString);
#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
XalanCopy(
@@ -596,13 +613,49 @@
}
else
{
+#if defined(XALAN_USE_CUSTOM_STRING)
+ return theString.substr(theStartIndex, theLength);
+#elif defined(XALAN_USE_STD_STRING)
+ return theString.substr(theStartIndex, theLength);
+#else
return theString.substringData(theStartIndex, theLength);
+#endif
}
}
}
+template <class SizeType, class FunctionType>
+XalanDOMString
+TransformString(
+ const XalanDOMChar* theInputString,
+ SizeType theInputStringLength,
+ FunctionType theFunction)
+{
+ assert(theInputString != 0);
+
+ vector<XalanDOMChar> theConvertedString;
+
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanTransform(
+ theInputString,
+ theInputString + theInputStringLength,
+ back_inserter(theConvertedString),
+ theFunction);
+#else
+ transform(
+ theInputString,
+ theInputString + theInputStringLength,
+ back_inserter(theConvertedString),
+ theFunction);
+#endif
+
+ return XalanDOMString(theConvertedString.begin(), theConvertedString.size());
+}
+
+
+
template <class FunctionType>
XalanDOMString
TransformXalanDOMString(
@@ -617,26 +670,10 @@
}
else
{
- vector<XalanDOMChar> theConvertedString;
-
const XalanDOMChar* const theBuffer = c_wstr(theInputString);
assert(theBuffer != 0);
-#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
- XalanTransform(
- theBuffer,
- theBuffer + theStringLength,
- back_inserter(theConvertedString),
- theFunction);
-#else
- transform(
- theBuffer,
- theBuffer + theStringLength,
- back_inserter(theConvertedString),
- theFunction);
-#endif
-
- return XalanDOMString(theConvertedString.begin(), theConvertedString.size());
+ return TransformString(theBuffer, theStringLength, theFunction);
}
}
@@ -644,6 +681,14 @@
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCase(const XalanDOMChar* theString)
+{
+ return TransformString(theString, length(theString), towlower);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
toLowerCase(const XalanDOMString& theString)
{
return TransformXalanDOMString(theString, towlower);
@@ -652,31 +697,73 @@
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCase(const XalanDOMChar* theString)
+{
+ return TransformString(theString, length(theString), towupper);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
toUpperCase(const XalanDOMString& theString)
{
return TransformXalanDOMString(theString, towupper);
}
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCaseASCII(const XalanDOMChar* theString)
+{
+ return TransformString(theString, length(theString), toLowerASCII);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCaseASCII(const XalanDOMString& theString)
+{
+ return TransformXalanDOMString(theString, toLowerASCII);
+}
+
+
-inline bool
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCaseASCII(const XalanDOMChar* theString)
+{
+ return TransformString(theString, length(theString), toUpperASCII);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCaseASCII(const XalanDOMString& theString)
+{
+ return TransformXalanDOMString(theString, toUpperASCII);
+}
+
+
+
+template <class Type, class SizeType, class FunctionType>
+bool
doEqualsIgnoreCase(
- const XalanDOMChar* theLHS,
- const XalanDOMChar* theRHS,
- unsigned int theLength)
+ const Type* theLHS,
+ const Type* theRHS,
+ SizeType theLength,
+ FunctionType theToUpperFunction)
{
// Check each character, converting to uppercase
// for the test.
- unsigned int i = 0;
+ SizeType i = 0;
for(; i < theLength; i++)
{
- const XalanDOMChar charLHS = theLHS[i];
- const XalanDOMChar charRHS = theRHS[i];
+ const Type charLHS = theLHS[i];
+ const Type charRHS = theRHS[i];
if (charLHS != charRHS &&
- XalanDOMChar(towupper(charLHS)) != charRHS &&
- charLHS != XalanDOMChar(towupper(charRHS)))
+ Type(theToUpperFunction(charLHS)) != charRHS &&
+ charLHS != Type(theToUpperFunction(charRHS)))
{
break;
}
@@ -695,10 +782,12 @@
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-equalsIgnoreCase(
+template <class FunctionType>
+bool
+doEqualsIgnoreCase(
const XalanDOMChar* theLHS,
- const XalanDOMChar* theRHS)
+ const XalanDOMChar* theRHS,
+ FunctionType theUpperCaseFunction)
{
assert(theLHS != 0);
assert(theRHS != 0);
@@ -710,7 +799,7 @@
// If they are equal, then compare
if (theLength == length(theRHS))
{
- fResult = doEqualsIgnoreCase(theLHS, theRHS, theLength);
+ fResult = doEqualsIgnoreCase(theLHS, theRHS, theLength, theUpperCaseFunction);
}
return fResult;
@@ -718,10 +807,12 @@
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-equalsIgnoreCase(
+template <class FunctionType>
+bool
+doEqualsIgnoreCase(
const XalanDOMString& theLHS,
- const XalanDOMString& theRHS)
+ const XalanDOMString& theRHS,
+ FunctionType theUpperCaseFunction)
{
const bool fLHSIsEmpty = isEmpty(theLHS);
const bool fRHSIsEmpty = isEmpty(theRHS);
@@ -746,7 +837,7 @@
if (theLHSLength == length(theRHS))
{
- return doEqualsIgnoreCase(c_wstr(theLHS), c_wstr(theRHS), theLHSLength);
+ return doEqualsIgnoreCase(c_wstr(theLHS), c_wstr(theRHS), theLHSLength, theUpperCaseFunction);
}
else
{
@@ -757,6 +848,98 @@
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return doEqualsIgnoreCase(theLHS, theRHS, towupper);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theRHS);
+
+ return equalsIgnoreCase(theLHS, theBuffer == 0 ? &theDummyEmptyString : theBuffer);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theLHS);
+
+ return equalsIgnoreCase(theBuffer == 0 ? &theDummyEmptyString : theBuffer, theRHS);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ return doEqualsIgnoreCase(theLHS, theRHS, towupper);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return doEqualsIgnoreCase(theLHS, theRHS, toUpperASCII);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theRHS);
+
+ return equalsIgnoreCaseASCII(theLHS, theBuffer == 0 ? &theDummyEmptyString : theBuffer);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theLHS);
+
+ return equalsIgnoreCaseASCII(theBuffer == 0 ? &theDummyEmptyString : theBuffer, theRHS);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ return doEqualsIgnoreCase(theLHS, theRHS, toUpperASCII);
+}
+
+
+
template <class Type, class SizeType>
int
doCompare(
@@ -891,27 +1074,28 @@
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
-compareIgnoreCase(
- const XalanDOMChar* theLHS,
- const XalanDOMChar* theRHS)
+template <class Type, class SizeType, class FunctionType>
+int
+doCompareIgnoreCase(
+ const Type* theLHS,
+ SizeType theLHSLength,
+ const Type* theRHS,
+ SizeType theRHSLength,
+ FunctionType theToUpperFunction)
{
- unsigned const int theLHSLength = length(theLHS);
- unsigned const int theRHSLength = length(theRHS);
-
int theResult = 0;
if (theLHSLength != 0 || theRHSLength != 0)
{
- XalanDOMChar theLHSChar = 0;
- XalanDOMChar theRHSChar = 0;
+ Type theLHSChar = 0;
+ Type theRHSChar = 0;
- unsigned int i = 0;
+ SizeType i = 0;
for(; i < theLHSLength && i < theRHSLength; i++)
{
- theLHSChar = towupper(theLHS[i]);
- theRHSChar = towupper(theRHS[i]);
+ theLHSChar = theToUpperFunction(theLHS[i]);
+ theRHSChar = theToUpperFunction(theRHS[i]);
if (theLHSChar != theRHSChar)
{
@@ -942,7 +1126,7 @@
// We didn't reach the end of _either_ string, so
// return the difference between the two characters
// that caused the problem.
- theResult = theLHSChar - theRHSChar;
+ theResult = int(theLHSChar - theRHSChar);
}
}
@@ -951,6 +1135,78 @@
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return doCompareIgnoreCase(theLHS, length(theLHS), theRHS, length(theRHS), towupper);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theRHS);
+
+ return compareIgnoreCase(theLHS, theBuffer == 0 ? &theDummyEmptyString : theBuffer);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theLHS);
+
+ return compareIgnoreCase(theBuffer == 0 ? &theDummyEmptyString : theBuffer, theRHS);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return doCompareIgnoreCase(theLHS, length(theLHS), theRHS, length(theRHS), toUpperASCII);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theRHS);
+
+ return compareIgnoreCaseASCII(theLHS, theBuffer == 0 ? &theDummyEmptyString : theBuffer);
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ const XalanDOMChar* const theBuffer =
+ c_wstr(theLHS);
+
+ return compareIgnoreCaseASCII(theBuffer == 0 ? &theDummyEmptyString : theBuffer, theRHS);
+}
+
+
+
struct WideStringLexicalCompare
{
int
@@ -977,6 +1233,19 @@
+struct WideStringIgnoreCaseCompareASCII
+{
+ int
+ operator()(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS) const
+ {
+ return compareIgnoreCaseASCII(theLHS, theRHS);
+ }
+};
+
+
+
struct WideStringCollationCompare
{
int
@@ -993,9 +1262,9 @@
template<class CompareFunctionType>
int
DOMStringCompare(
- CompareFunctionType theCompareFunction,
const XalanDOMString& theLHS,
- const XalanDOMString& theRHS)
+ const XalanDOMString& theRHS,
+ CompareFunctionType theCompareFunction)
{
const bool fLHSIsEmpty = isEmpty(theLHS);
const bool fRHSIsEmpty = isEmpty(theRHS);
@@ -1038,9 +1307,7 @@
const XalanDOMString& theLHS,
const XalanDOMString& theRHS)
{
- return DOMStringCompare(WideStringLexicalCompare(),
- theLHS,
- theRHS);
+ return DOMStringCompare(theLHS, theRHS, WideStringLexicalCompare());
}
@@ -1050,21 +1317,27 @@
const XalanDOMString& theLHS,
const XalanDOMString& theRHS)
{
- return DOMStringCompare(WideStringIgnoreCaseCompare(),
- theLHS,
- theRHS);
+ return DOMStringCompare(theLHS, theRHS, WideStringIgnoreCaseCompare());
}
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ return DOMStringCompare(theLHS, theRHS, WideStringIgnoreCaseCompareASCII());
+}
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
collationCompare(
const XalanDOMString& theLHS,
const XalanDOMString& theRHS)
{
- return DOMStringCompare(WideStringCollationCompare(),
- theLHS,
- theRHS);
+ return DOMStringCompare(theLHS, theRHS, WideStringCollationCompare());
}
@@ -1371,9 +1644,9 @@
// We don't need to transcode, so just make it a
// wide character string...
- wchar_t theResult[MAX_PRINTF_DIGITS + 1];
+ XalanDOMChar theResult[MAX_PRINTF_DIGITS + 1];
- const unsigned int theLength = length(theBuffer);
+ const unsigned int theLength = strlen(theBuffer);
#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
XalanCopy(theBuffer, theBuffer + theLength, theResult);
@@ -1399,9 +1672,9 @@
// We don't need to transcode, so just make it a
// wide character string...
- wchar_t theResult[MAX_PRINTF_DIGITS + 1];
+ XalanDOMChar theResult[MAX_PRINTF_DIGITS + 1];
- const unsigned int theLength = length(theBuffer);
+ const unsigned int theLength = strlen(theBuffer);
#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
XalanCopy(theBuffer, theBuffer + theLength, theResult);
@@ -1437,9 +1710,9 @@
// We don't need to transcode, so just make it a
// wide character string...
- wchar_t theResult[MAX_PRINTF_DIGITS + 1];
+ XalanDOMChar theResult[MAX_PRINTF_DIGITS + 1];
- const unsigned int theLength = length(theBuffer);
+ const unsigned int theLength = strlen(theBuffer);
#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
XalanCopy(theBuffer, theBuffer + theLength, theResult);
@@ -1499,7 +1772,7 @@
theFormatter << theUnsignedLong << '\0';
- wchar_t theResult[MAX_PRINTF_DIGITS + 1];
+ XalanDOMChar theResult[MAX_PRINTF_DIGITS + 1];
const unsigned int theLength = length(theBuffer);
@@ -1516,24 +1789,30 @@
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-isWhitespace(const XalanDOMString& string)
+isXMLWhitespace(const XalanDOMString& string)
{
const unsigned int theLength = length(string);
- for(unsigned int s = 0; s < theLength; s++)
+ if (theLength == 0)
{
- if (!isXMLWhitespace(charAt(string, s)))
- return false;
+ return true;
}
+ else
+ {
+ const XalanDOMChar* const theBuffer =
+ c_wstr(string);
- return true;
+ assert(theBuffer != 0);
+
+ return isXMLWhitespace(theBuffer, 0, theLength);
+ }
}
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-isWhitespace(
- const XalanDOMChar* ch,
+isXMLWhitespace(
+ const XalanDOMChar ch[],
unsigned int start,
unsigned int length)
{
@@ -1546,116 +1825,4 @@
}
return true;
-}
-
-
-
-static bool
-doTranscodeToLocalCodePage(
- const XalanDOMChar* sourceString,
- unsigned int sourceStringLength,
- bool sourceStringIsNullTerminated,
- CharVectorType& targetVector,
- bool terminate)
-{
- // Short circuit if it's a null pointer, or of length 0.
- if (!sourceString || (!sourceString[0]))
- {
- if (terminate == true)
- {
- targetVector.resize(1);
-
- targetVector.back() = '\0';
- }
- else
- {
- targetVector.resize(0);
- }
-
- return true;
- }
-
- const XalanDOMChar* tempSource = 0;
-
- // If our char sizes are not the same, we have to use a temp buffer.
- XalanArrayAutoPtr<wchar_t> tempSourceJanitor;
-
-#if !defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
- // This is a short-cut for when the sourceString is mull-terminated _and_
- // XalanDOMChar and wchar_t are the same thing.
- if (sourceStringIsNullTerminated == true)
- {
- tempSource = sourceString;
- }
- else
-#endif
- {
- if (sourceStringIsNullTerminated == true)
- {
- sourceStringLength = length(sourceString);
- }
-
- tempSourceJanitor.reset(new wchar_t[sourceStringLength + 1]);
-
- for (unsigned int index = 0; index < sourceStringLength; ++index)
- {
- tempSourceJanitor[index] = wchar_t(sourceString[index]);
- }
-
- tempSourceJanitor[sourceStringLength] = 0;
-
- tempSource = tempSourceJanitor.get();
- }
-
- // See how many chars we need to transcode.
- const size_t targetLen = ::wcstombs(0, tempSource, 0);
-
- if (targetLen == size_t(-1))
- {
- return false;
- }
- else
- {
- // Resize, adding one byte if terminating...
- targetVector.resize(terminate == true ? targetLen + 1 : targetLen);
-
- // And transcode our temp source buffer to the local buffer. Terminate
- //
- if (wcstombs(&targetVector[0], tempSource, targetLen) == size_t(-1))
- {
- return false;
- }
- else
- {
- if (terminate == true)
- {
- targetVector.back() = '\0';
- }
-
- return true;
- }
- }
-}
-
-
-
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-TranscodeToLocalCodePage(
- const XalanDOMChar* sourceString,
- unsigned int sourceStringLength,
- CharVectorType& targetVector,
- bool terminate)
-{
- return doTranscodeToLocalCodePage(sourceString, sourceStringLength, false, targetVector, terminate);
-}
-
-
-
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-TranscodeToLocalCodePage(
- const XalanDOMChar* sourceString,
- CharVectorType& targetVector,
- bool terminate)
-{
- return doTranscodeToLocalCodePage(sourceString, 0, true, targetVector, terminate);
}
1.32 +733 -213 xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp
Index: DOMStringHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- DOMStringHelper.hpp 2000/10/11 19:43:04 1.31
+++ DOMStringHelper.hpp 2000/11/02 01:45:35 1.32
@@ -100,21 +100,47 @@
// This macro has been defined to deal with certain C++ compilers which
// do not create Unicode strings when the "L" string constant prefix is
// used. It is meant _only_ for use with static strings.
-// It is _not_ designed to be thread-safe, because there will always be
-// at least one global static transcoded string that will trigger the
-// code at startup.
#if defined(XALAN_LSTRSUPPORT)
#define XALAN_STATIC_UCODE_STRING(str) L##str
+/**
+ * This is a convenience function to allow for identical
+ * for platforms that support Unicode wide static strings
+ * and platforms that don't.
+ *
+ * See the previous macro definition for more information.
+ *
+ * @param theString the string to copy
+ * @return a reference to the string passed
+ */
+inline const XalanDOMString
+StaticStringToDOMString(const XalanDOMChar* theString)
+{
+ return XalanDOMString(theString);
+}
+
+
+
#else
+
+#define XALAN_STATIC_UCODE_STRING(str) TranscodeFromLocalCodePage(str)
+
+/**
+ * Determines if a range in an array contains only whitespace
+ *
+ * @param ch target array
+ * @param start starting index to examine
+ * @param length number of characters to examine
+ * @return true if specified range contains only whitespace
+ */
+inline const XalanDOMString&
+StaticStringToDOMString(const XalanDOMString& theString)
+{
+ return theString;
+}
-// Makes sure the Xerces platform is initialized, then
-// transcodes the string.
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(const XalanDOMString)
-initializeAndTranscode(const char* theString);
-#define XALAN_STATIC_UCODE_STRING(str) initializeAndTranscode(str)
#endif
@@ -139,35 +165,41 @@
/**
- * Reserve some space in the string for more efficient
- * concatenation...
+ * Get the underlying representation of the target XalanDOMString as a
+ * null-terminated string
*
* @param theString target string
- * @param theCount The amount of space to reserve
+ * @return null-terminated string of XalanDOMChar
*/
-inline void
-reserve(
- XalanDOMString& theString,
- unsigned int theCount)
+inline const XalanDOMChar*
+c_wstr(const XalanDOMString& theString)
{
- theString.reserve(theCount);
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theString.c_str();
+#else
+ const XalanDOMChar* const ptr = theString.rawBuffer();
+
+ assert(!ptr || ptr[theString.length()] == '\0');
+
+ return ptr;
+#endif
}
/**
- * Get the underlying representation of the target XalanDOMString as a
+ * Get the underlying representation of the target CharVectorType as a
* null-terminated string
*
* @param theString target string
- * @return null-terminated string of XalanDOMChar
+ * @return null-terminated string of chars
*/
-inline const XalanDOMChar*
-c_wstr(const XalanDOMString& theString)
+inline const char*
+c_str(const CharVectorType& theString)
{
- const XalanDOMChar* const ptr = theString.rawBuffer();
+ const char* const ptr = &theString[0];
- assert(!ptr || ptr[theString.length()] == '\0');
+ assert(!ptr || ptr[theString.size() - 1] == '\0');
return ptr;
}
@@ -207,15 +239,36 @@
inline const XalanDOMChar*
toCharArray(const XalanDOMString& theString)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theString.c_str();
+#else
return theString.rawBuffer();
+#endif
+}
+
+
+
+/**
+ * Reserve some space in the string for more efficient
+ * concatenation...
+ *
+ * @param theString target string
+ * @param theCount The amount of space to reserve
+ */
+inline void
+reserve(
+ XalanDOMString& theString,
+ unsigned int theCount)
+{
+ theString.reserve(theCount);
}
/**
- * Simulates the java String method length() for a XalanDOMString
+ * Get the length of a XalanDOMString
*
- * @param theDOMString target string
+ * @param theString target string
* @return the length of the target string
*/
inline unsigned int
@@ -227,7 +280,7 @@
/**
- * Simulates the java String method length() for a null-terminated buffer of
+ * Get the length of a null-terminated buffer of
* XalanDOMChar characters
*
* @param theBuffer target string
@@ -238,11 +291,6 @@
{
assert(theBuffer != 0);
- // For the time being, we're using our own custom routine,
- // since performance is better.
-#if defined(XALAN_USE_WCHAR_SUPPORT)
- return wcslen(theBuffer);
-#else
const XalanDOMChar* theBufferPointer = theBuffer;
while(*theBufferPointer != 0)
@@ -251,7 +299,6 @@
}
return theBufferPointer - theBuffer;
-#endif
}
@@ -456,7 +503,35 @@
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
startsWith(
- const XalanDOMString& theDOMString,
+ const XalanDOMChar* theString,
+ const XalanDOMString& theSubstring);
+
+
+
+/**
+ * Simulates the java String method startsWith().
+ *
+ * @param theDOMString target string to search
+ * @param theSubstring substring searched for
+ * @return true if the target string begins with the substring
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+startsWith(
+ const XalanDOMString& theString,
+ const XalanDOMChar* theSubstring);
+
+
+
+/**
+ * Simulates the java String method startsWith().
+ *
+ * @param theDOMString target string to search
+ * @param theSubstring substring searched for
+ * @return true if the target string begins with the substring
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+startsWith(
+ const XalanDOMString& theString,
const XalanDOMString& theSubstring);
@@ -470,11 +545,16 @@
*/
inline bool
startsWith(
- const XalanDOMString& theDOMString,
+ const XalanDOMString& theString,
const char* theSubstring)
{
- return startsWith(theDOMString,
- XalanDOMString(theSubstring));
+ return startsWith(
+ theString,
+#if defined(XALAN_USE_STD_STRING)
+ TranscodeFromLocalCodePage(theSubstring));
+#else
+ XalanDOMString(theSubstring));
+#endif
}
@@ -664,38 +744,6 @@
-// Standard vector of XalanDOMChars and chars
-#if defined(XALAN_NO_NAMESPACES)
-typedef vector<XalanDOMChar> XalanDOMCharVectorType;
-
-typedef vector<char> CharVectorType;
-#else
-typedef std::vector<XalanDOMChar> XalanDOMCharVectorType;
-
-typedef std::vector<char> CharVectorType;
-#endif
-
-
-
-/**
- * Get the underlying representation of the target CharVectorType as a
- * null-terminated string
- *
- * @param theString target string
- * @return null-terminated string of chars
- */
-inline const char*
-c_str(const CharVectorType& theString)
-{
- const char* const ptr = &theString[0];
-
- assert(!ptr || ptr[theString.size() - 1] == '\0');
-
- return ptr;
-}
-
-
-
/**
* Outputs the target string to the specified stream
*
@@ -946,21 +994,11 @@
inline XalanDOMString
clone(const XalanDOMString& theString)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theString;
+#else
return theString.clone();
-}
-
-
-
-/**
- * Determines whether character represents white space
- *
- * @param theChar target character
- * @return true if character represents white space
- */
-inline bool
-isXMLWhitespace(XalanDOMChar theChar)
-{
- return XalanXMLChar::isWhitespace(theChar) ? true : false;
+#endif
}
@@ -977,7 +1015,25 @@
const XalanDOMString& theString,
unsigned int theIndex)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theString[theIndex];
+#else
return theString.charAt(theIndex);
+#endif
+}
+
+
+
+/**
+ * Determines whether character represents white space
+ *
+ * @param theChar target character
+ * @return true if character represents white space
+ */
+inline bool
+isXMLWhitespace(XalanDOMChar theChar)
+{
+ return XalanXMLChar::isWhitespace(theChar) ? true : false;
}
@@ -1057,6 +1113,18 @@
* @return string containing lower case characters
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCase(const XalanDOMChar* theString);
+
+
+
+/**
+ * Simulates the java String method toLowerCase(). Returns a new string
+ * containing only lower case characters of target string.
+ *
+ * @param theString target string
+ * @return string containing lower case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
toLowerCase(const XalanDOMString& theString);
@@ -1069,63 +1137,171 @@
* @return string containing upper case characters
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
-toUpperCase(const XalanDOMString& theString);
+toUpperCase(const XalanDOMChar* theString);
-#if !defined(XALAN_AMBIGUOUS_EVEN_IF_NOT_CALLED)
-// These two function are specifically not defined, and
-// should produce ambiguity during compilation. This
-// is necessary because the Xerces XalanDOMString class
-// defines == as referring to the same underlying
-// handle, not identical strings, as C++ programmers
-// would expect.
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-operator==(
- const XalanDOMString& theLHS,
- const XalanDOMString& theRHS);
+/**
+ * Simulates the java String method toUpperCase(). Returns a new string
+ * containing only upper case characters of target string.
+ *
+ * @param theString target string
+ * @return string containing upper case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCase(const XalanDOMString& theString);
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-operator!=(
- const XalanDOMString& theLHS,
- const XalanDOMString& theRHS);
-#endif
+/**
+ * Converts ASCII alphabetic characters from upper case to
+ * lower case. This function works only with the Unicode
+ * characters A-Z.
+ *
+ * @param theString target string
+ * @return string containing lower case characters
+ */
+inline XalanDOMChar
+toLowerASCII(XalanDOMChar theChar)
+{
+ if (theChar >= XalanUnicode::charLetter_A && theChar <= XalanUnicode::charLetter_Z)
+ {
+ return XalanDOMChar(theChar - (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
+ }
+ else
+ {
+ return theChar;
+ }
+}
/**
- * Compare the contents of two strings.
- *
- * @param theLHS first string to compare
- * @param theRHS second string to compare
- * @return Returns 0 for equal strings, less than 0 if theLHS is less
- * than theRHS, or greater than 0 if theRHS is greater than theLHS.
- * @see operator<()
+ * Converts ASCII alphabetic characters from lower case to
+ * upper case. This function works only with the Unicode
+ * characters a-z.
+ *
+ * @param theString target string
+ * @return string containing upper case characters
*/
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
-compare(
- const CharVectorType& theLHS,
- const CharVectorType& theRHS);
+inline XalanDOMChar
+toUpperASCII(XalanDOMChar theChar)
+{
+ if (theChar >= XalanUnicode::charLetter_a && theChar <= XalanUnicode::charLetter_z)
+ {
+ return XalanDOMChar(theChar + (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
+ }
+ else
+ {
+ return theChar;
+ }
+}
-// For the time being, we're using our own custom routine,
-// since performance is better.
+/**
+ * Converts ASCII alphabetic characters from upper case to
+ * lower case. This function works only with the characters
+ * a-z and A-Z.
+ *
+ * @param theString target string
+ * @return string containing lower case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCaseASCII(const XalanDOMChar* theString);
-#if defined(XALAN_USE_WCHAR_SUPPORT)
+
/**
- * Compare the contents of two strings.
- *
+ * Converts ASCII alphabetic characters from upper case to
+ * lower case. This function works only with the characters
+ * a-z and A-Z.
+ *
+ * @param theString target string
+ * @return string containing lower case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toLowerCaseASCII(const XalanDOMString& theString);
+
+
+
+/**
+ * Converts ASCII alphabetic characters from lower case to
+ * upper case. This function works only with the characters
+ * a-z and A-Z.
+ *
+ * @param theString target string
+ * @return string containing upper case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCaseASCII(const XalanDOMChar* theString);
+
+
+
+/**
+ * Converts ASCII alphabetic characters from lower case to
+ * upper case. This function works only with the characters
+ * a-z and A-Z.
+ *
+ * @param theString target string
+ * @return string containing upper case characters
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
+toUpperCaseASCII(const XalanDOMString& theString);
+
+
+
+#if defined(XALAN_USE_XERCES_DOMSTRING) && !defined(XALAN_AMBIGUOUS_EVEN_IF_NOT_CALLED)
+// These two function are specifically not defined, and
+// should produce ambiguity during compilation. This
+// is necessary because the Xerces XalanDOMString class
+// defines == as referring to the same underlying
+// handle, not identical strings, as C++ programmers
+// would expect.
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+operator==(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+operator!=(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS);
+#endif
+
+
+
+/**
+ * Compare the contents of two strings.
+ *
* @param theLHS first string to compare
* @param theRHS second string to compare
* @return Returns 0 for equal strings, less than 0 if theLHS is less
* than theRHS, or greater than 0 if theRHS is greater than theLHS.
- * @see operator<
- * @see collationCompare
+ * @see operator<()
*/
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compare(
+ const CharVectorType& theLHS,
+ const CharVectorType& theRHS);
+
+
+
+// For the time being, we're using our own custom routine,
+// since performance is better.
+
+#if defined(XALAN_USE_WCHAR_SUPPORT)
+
+/**
+ * Compare the contents of two strings.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
inline int
compare(
const XalanDOMChar* theLHS,
@@ -1153,8 +1329,6 @@
* @param theRHS second string to compare
* @return Returns 0 for equal strings, less than 0 if theLHS is less
* than theRHS, or greater than 0 if theRHS is greater than theLHS.
- * @see operator<
- * @see collationCompare
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
compareIgnoreCase(
@@ -1163,6 +1337,89 @@
+/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner. Only the characters a-z and A-Z are considered for
+ * the comparison.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner. Only the characters a-z and A-Z are considered for
+ * the comparison.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner. Only the characters a-z and A-Z are considered for
+ * the comparison.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS);
+
+
+
#if defined(XALAN_USE_WCHAR_SUPPORT)
/**
@@ -1234,6 +1491,25 @@
/**
+ * Compare the contents of two strings, in a case insensitive
+ * manner. Only the characters a-z and A-Z are considered for
+ * the comparison.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return Returns 0 for equal strings, less than 0 if theLHS is less
+ * than theRHS, or greater than 0 if theRHS is greater than theLHS.
+ * @see operator<
+ * @see collationCompare
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
+compareIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+/**
* Compare the contents of two strings using the
* the collation settings of the current code page.
*
@@ -1280,7 +1556,11 @@
{
assert(theLHS != 0);
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theLHS == theRHS;
+#else
return theRHS.equals(theLHS);
+#endif
}
@@ -1298,7 +1578,11 @@
{
assert(theRHS != 0);
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theLHS == theRHS;
+#else
return theLHS.equals(theRHS);
+#endif
}
@@ -1316,7 +1600,13 @@
{
assert(theRHS != 0);
+#if defined(XALAN_USE_CUSTOM_STRING)
+ return theLHS == XalanDOMString(theRHS);
+#elif defined(XALAN_USE_STD_STRING)
+ return theLHS == TranscodeFromLocalCodePage(theRHS);
+#else
return theLHS.equals(theRHS) ? true : false;
+#endif
}
@@ -1332,7 +1622,11 @@
equals(const XalanDOMChar* theLHS,
const char* theRHS)
{
+#if defined(XALAN_USE_STD_STRING)
+ return equals(theLHS, TranscodeFromLocalCodePage(theRHS));
+#else
return equals(theLHS, XalanDOMString(theRHS));
+#endif
}
@@ -1351,7 +1645,11 @@
assert(theLHS != 0);
assert(theRHS != 0);
+#if defined(XALAN_USE_STD_STRING)
+ return equals(TranscodeFromLocalCodePage(theLHS), theRHS);
+#else
return equals(XalanDOMString(theLHS), theRHS);
+#endif
}
@@ -1368,7 +1666,11 @@
const XalanDOMString& theLHS,
const XalanDOMString& theRHS)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return theLHS == theRHS;
+#else
return theLHS.equals(theRHS) ? true : false;
+#endif
}
@@ -1396,6 +1698,94 @@
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
equalsIgnoreCase(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCase(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case.
+ * Only the characters A-Z and a-z are considered.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case.
+ * Only the characters A-Z and a-z are considered.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case.
+ * Only the characters A-Z and a-z are considered.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS);
+
+
+
+/**
+ * Compare the contents of two strings for equality, without regard for case
+ * Only the characters A-Z and a-z are considered.
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the case-insensitive contents of both strings are identical
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
+equalsIgnoreCaseASCII(
const XalanDOMString& theLHS,
const XalanDOMString& theRHS);
@@ -1439,6 +1829,49 @@
+#if defined(XALAN_USE_STD_STRING)
+
+inline const XalanDOMString
+operator+(
+ const char* theLHS,
+ const XalanDOMString& theRHS)
+{
+ return TranscodeFromLocalCodePage(theLHS) + theRHS;
+}
+
+
+
+inline const XalanDOMString
+operator+(
+ const XalanDOMString& theLHS,
+ const char* theRHS)
+{
+ return theLHS + TranscodeFromLocalCodePage(theRHS);
+}
+
+
+
+inline const XalanDOMString
+operator+(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ return XalanDOMString(theLHS) + theRHS;
+}
+
+
+
+inline const XalanDOMString
+operator+(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return theLHS + XalanDOMString(theRHS);
+}
+#endif
+
+
+
/**
* Concatenate two strings
*
@@ -1451,8 +1884,120 @@
XalanDOMString& theString,
const XalanDOMString& theStringToAppend)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.append(theStringToAppend);
+#else
theString.appendData(theStringToAppend);
+#endif
+
+ return theString;
+}
+
+
+
+/**
+ * Concatenate two strings
+ *
+ * @param theString target string
+ * @param theStringToAppend string to add to target
+ * @return string with contents of 'theStringToAppend' added to target string
+ */
+inline XalanDOMString&
+append(
+ XalanDOMString& theString,
+ const XalanDOMChar* theStringToAppend)
+{
+ assert(theStringToAppend != 0);
+
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.append(theStringToAppend);
+#else
+ theString.appendData(theStringToAppend);
+#endif
+
+ return theString;
+}
+
+
+
+/**
+ * Concatenate two strings
+ *
+ * @param theString target string
+ * @param theStringToAppend string to add to target
+ * @return string with contents of 'theStringToAppend' added to target string
+ */
+inline XalanDOMString&
+append(
+ XalanDOMString& theString,
+ const char* theStringToAppend)
+{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.append(TranscodeFromLocalCodePage(theStringToAppend));
+#else
+ theString.appendData(theStringToAppend);
+#endif
+
+ return theString;
+}
+
+
+/**
+ * Concatenate a string and a character
+ *
+ * @param theString target string
+ * @param theCharToAppend the character to add to the target
+ * @return string with the character appended
+ */
+inline XalanDOMString&
+append(
+ XalanDOMString& theString,
+ const XalanDOMChar theCharToAppend)
+{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.append(1, theCharToAppend);
+#else
+ theString.appendData(theCharToAppend);
+#endif
+
+ return theString;
+}
+
+
+
+/**
+ * Concatenate a string and a character
+ *
+ * @param theString target string
+ * @param theCharToAppend the character to add to the target
+ * @return string with the character appended
+ */
+inline XalanDOMString&
+append(
+ XalanDOMString& theString,
+ char theCharToAppend)
+{
+ // We have to transcode before appending...
+ char theTempBuffer[] = { theCharToAppend, '\0' };
+
+ return append(theString, theTempBuffer);
+}
+
+
+
+inline XalanDOMString&
+insert(
+ XalanDOMString& theString,
+ unsigned int thePosition,
+ const XalanDOMString& theStringToInsert)
+{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.insert(thePosition, theStringToInsert);
+#else
+ theString.insertData(thePosition, theStringToInsert);
+#endif
+
return theString;
}
@@ -1477,11 +2022,15 @@
inline void
clear(XalanDOMString& theString)
{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ theString.erase();
+#else
#if defined(XALAN_OLD_STYLE_CASTS)
theString = (DOM_NullPtr*)0;
#else
theString = static_cast<DOM_NullPtr*>(0);
#endif
+#endif
}
@@ -1892,6 +2441,29 @@
/**
+ * Less than functor for DOMStrings which ignores case for the characters a-z and A-Z
+ *
+ * @param theLHS first string to compare
+ * @param theRHS second string to compare
+ * @return true if the theLHS is less than theRHS, without respect to case.
+ */
+#if defined(XALAN_NO_NAMESPACES)
+struct DOMStringLessThanIgnoreCaseASCIIFunction : public binary_function<const XalanDOMString&, const XalanDOMString&, bool>
+#else
+struct DOMStringLessThanIgnoreCaseASCIIFunction : public std::binary_function<const XalanDOMString&, const XalanDOMString&, bool>
+#endif
+{
+ result_type
+ operator() (first_argument_type theLHS,
+ second_argument_type theRHS) const
+ {
+ return compareIgnoreCase(theLHS, theRHS) < 0 ? true : false;
+ }
+};
+
+
+
+/**
* Less than or equal functor for DOMStrings
*
* @param theLHS first string to compare
@@ -1960,101 +2532,33 @@
-/**
- * Convert a XalanDOMChar string to C++ standard library
- * vector, transcoding to the default local code
- * page.
- *
- * @param sourceString The source string
- * @param sourceStringLength The source string length.
- * @param targetVector The target string
- * @param terminate If true, the transcoded string will be null-terminated
- * @return true if successful, false if not.
- */
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-TranscodeToLocalCodePage(
- const XalanDOMChar* sourceString,
- unsigned int sourceStringLength,
- CharVectorType& targetVector,
- bool terminate = false);
-
-
-
-/**
- * Convert a XalanDOMChar string to C++ standard library
- * vector, transcoding to the default local code
- * page. The string _must_ be null-terminated.
- *
- * @param sourceString The source string
- * @param targetVector The target string
- * @param terminate If true, the transcoded string will be null-terminated
- * @return true if successful, false if not.
- */
-XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-TranscodeToLocalCodePage(
- const XalanDOMChar* sourceString,
- CharVectorType& targetVector,
- bool terminate = false);
-
-
-
/**
- * Convert XalanDOMString to C++ standard library
- * vector, transcoding to the default local code
- * page. Null-terminate the sttring...
- *
- * @param theSourceString source string
- * @return The transcoded string.
- */
-inline const CharVectorType
-TranscodeToLocalCodePage(const XalanDOMChar* sourceString)
-{
- CharVectorType theResult;
-
- TranscodeToLocalCodePage(sourceString, theResult, true);
-
- return theResult;
-}
-
-
-
-/**
- * Convert XalanDOMString to C++ standard library
- * vector, transcoding to the default local code
- * page.
- *
- * @param sourceString The source string
- * @param targetVector The target string
- * @return true if successful, false if not.
+ * This functor is designed to compare 0-terminated wide strings in a case-insensitive
+ * manner. It substitutes for the default less<type*> so that the contents of wide strings
+ * can be compared, rather than just the pointers.
*/
-inline bool
-TranscodeToLocalCodePage(
- const XalanDOMString& sourceString,
- CharVectorType& targetVector,
- bool terminate = false)
-{
- return TranscodeToLocalCodePage(c_wstr(sourceString), targetVector, terminate);
-}
-
-
-
-/**
- * Convert XalanDOMString to C++ standard library
- * vector, transcoding to the default local code
- * page.
- *
- * @param theSourceString source string
- * @return The transcoded string.
- */
-inline const CharVectorType
-TranscodeToLocalCodePage(const XalanDOMString& sourceString)
+#if defined(XALAN_NO_NAMESPACES)
+struct less_no_case_ascii_wide_string : public binary_function<const XalanDOMChar*, const XalanDOMChar*, bool>
+#else
+struct less_no_case_ascii_wide_string : public std::binary_function<const XalanDOMChar*, const XalanDOMChar*, bool>
+#endif
{
- CharVectorType theResult;
-
- TranscodeToLocalCodePage(sourceString, theResult, true);
-
- return theResult;
-}
+ /**
+ * Compare the values of two objects.
+ *
+ *
+ * @param theLHS first object to compare
+ * @param theRHS second object to compare
+ * @return true if objects are the same
+ */
+ result_type
+ operator()(
+ first_argument_type theLHS,
+ second_argument_type theRHS) const
+ {
+ return compareIgnoreCaseASCII(theLHS, theRHS) < 0 ? true : false;
+ }
+};
@@ -2065,7 +2569,7 @@
* @return true if string contains only whitespace
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-isWhitespace(const XalanDOMString& string);
+isXMLWhitespace(const XalanDOMString& string);
@@ -2078,10 +2582,26 @@
* @return true if specified range contains only whitespace
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
-isWhitespace(
- const XalanDOMChar* ch,
- unsigned int start,
- unsigned int length);
+isXMLWhitespace(
+ const XalanDOMChar ch[],
+ unsigned int start,
+ unsigned int length);
+
+
+
+/**
+ * Determines if a null-terminated string contains only whitespace
+ *
+ * @param theString target string
+ * @return true if the string contains only whitespace
+ */
+inline bool
+isXMLWhitespace(const XalanDOMChar* theString)
+{
+ assert(theString != 0);
+
+ return isXMLWhitespace(theString, 0, length(theString));
+}
1.8 +4 -4 xml-xalan/c/src/PlatformSupport/DOMStringPrintWriter.cpp
Index: DOMStringPrintWriter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringPrintWriter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DOMStringPrintWriter.cpp 2000/10/17 17:11:06 1.7
+++ DOMStringPrintWriter.cpp 2000/11/02 01:45:35 1.8
@@ -67,9 +67,9 @@
-DOMStringPrintWriter::DOMStringPrintWriter(const XalanDOMString& theBaseString) :
+DOMStringPrintWriter::DOMStringPrintWriter(XalanDOMString& theString) :
PrintWriter(true),
- m_outputString(theBaseString)
+ m_outputString(theString)
{
}
@@ -108,7 +108,7 @@
unsigned int theOffset,
unsigned int theLength)
{
- write(XalanDOMString(s), theOffset, theLength);
+ write(TranscodeFromLocalCodePage(s), theOffset, theLength);
}
@@ -171,7 +171,7 @@
unsigned int theOffset,
unsigned int theLength)
{
- assert(s != 0);
+ assert(c_wstr(s) != 0);
assert(theLength == UINT_MAX || length(s) >= theOffset + theLength);
if (theOffset == 0 && theLength == UINT_MAX)
1.8 +3 -6 xml-xalan/c/src/PlatformSupport/DOMStringPrintWriter.hpp
Index: DOMStringPrintWriter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringPrintWriter.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DOMStringPrintWriter.hpp 2000/08/28 01:14:40 1.7
+++ DOMStringPrintWriter.hpp 2000/11/02 01:45:35 1.8
@@ -79,15 +79,12 @@
{
public:
- // If a string is passed in, a copy will be made, and all
- // output will be appended to that string.
- explicit
- DOMStringPrintWriter(const XalanDOMString& theBaseString = XalanDOMString());
+ DOMStringPrintWriter(XalanDOMString& theString);
virtual
~DOMStringPrintWriter();
- const XalanDOMString&
+ XalanDOMString&
getString() const
{
return m_outputString;
@@ -191,7 +188,7 @@
protected:
- XalanDOMString m_outputString;
+ XalanDOMString& m_outputString;
private:
1.12 +2 -2 xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp
Index: DirectoryEnumerator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DirectoryEnumerator.hpp 2000/08/29 17:02:43 1.11
+++ DirectoryEnumerator.hpp 2000/11/02 01:45:36 1.12
@@ -209,7 +209,7 @@
#if defined(_MSC_VER)
StringType theSearchSpec(clone(theDirectory));
- theSearchSpec += "\\*";
+ append(theSearchSpec, "\\*");
FindFileStruct theFindData;
@@ -224,7 +224,7 @@
{
if (theFilterPredicate(theFindData) == true)
{
- *theOutputIterator = theFindData.getName();
+ *theOutputIterator = XalanDOMString(theFindData.getName());
}
}
while(_wfindnext(theSearchHandle,
1.4 +39 -0 xml-xalan/c/src/PlatformSupport/ExecutionContext.hpp
Index: ExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ExecutionContext.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExecutionContext.hpp 2000/04/11 14:35:30 1.3
+++ ExecutionContext.hpp 2000/11/02 01:45:36 1.4
@@ -100,6 +100,19 @@
const XalanNode* styleNode = 0) const = 0;
/**
+ * Tell the user of an error, and probably 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 char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ /**
* Tell the user of an warning, and probably throw an exception.
*
* @param msg text of message to output
@@ -113,6 +126,19 @@
const XalanNode* styleNode = 0) const = 0;
/**
+ * Tell the user of an warning, and probably 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
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ /**
* Output a message.
*
* @param msg text of message to output
@@ -124,6 +150,19 @@
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
const XalanNode* styleNode = 0) const = 0;
+
+ /**
+ * Output a message.
+ *
+ * @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
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.10 +1 -1 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp
Index: NamedNodeMapAttributeList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- NamedNodeMapAttributeList.cpp 2000/09/05 02:24:45 1.9
+++ NamedNodeMapAttributeList.cpp 2000/11/02 01:45:36 1.10
@@ -157,7 +157,7 @@
// DOM classes return strings by value, so we have to get
// the value from the node and store the XalanDOMString somewhere
// safe, so we have a vector of XalanDOMStrings to hold everything.
- const XalanNode* theNode = m_nodeMap.getNamedItem(name);
+ const XalanNode* theNode = m_nodeMap.getNamedItem(XalanDOMString(name));
if (theNode == 0)
{
1.4 +43 -3 xml-xalan/c/src/PlatformSupport/StringTokenizer.cpp
Index: StringTokenizer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/StringTokenizer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StringTokenizer.cpp 2000/04/11 20:04:24 1.3
+++ StringTokenizer.cpp 2000/11/02 01:45:36 1.4
@@ -64,9 +64,22 @@
#include "DOMStringHelper.hpp"
+#include "XalanUnicode.hpp"
+const XalanDOMChar StringTokenizer::s_defaultTokens[] =
+{
+ XalanUnicode::charSpace,
+ XalanUnicode::charHTab,
+ XalanUnicode::charLF,
+ XalanUnicode::charCR,
+ XalanUnicode::charFF,
+ 0,
+};
+
+
+
StringTokenizer::StringTokenizer(
const XalanDOMString& theString,
const XalanDOMString& theTokens,
@@ -81,14 +94,42 @@
}
+
+StringTokenizer::StringTokenizer(
+ const XalanDOMString& theString,
+ const XalanDOMChar* theTokens,
+ bool fReturnTokens) :
+ m_String(theString),
+ m_Tokens(XalanDOMString(theTokens)),
+ m_fReturnTokens(fReturnTokens),
+ m_CurrentIndex(0),
+ m_StringLength(length(theString)),
+ m_tokensLength(length(theTokens))
+{
+}
-#if defined(XALAN_LSTRSUPPORT)
+
StringTokenizer::StringTokenizer(
const XalanDOMChar* theString,
const XalanDOMChar* theTokens,
bool fReturnTokens) :
- m_String(theString),
+ m_String(XalanDOMString(theString)),
+ m_Tokens(XalanDOMString(theTokens)),
+ m_fReturnTokens(fReturnTokens),
+ m_CurrentIndex(0),
+ m_StringLength(length(theString)),
+ m_tokensLength(length(theTokens))
+{
+}
+
+
+
+StringTokenizer::StringTokenizer(
+ const XalanDOMChar* theString,
+ const XalanDOMString& theTokens,
+ bool fReturnTokens) :
+ m_String(XalanDOMString(theString)),
m_Tokens(theTokens),
m_fReturnTokens(fReturnTokens),
m_CurrentIndex(0),
@@ -97,7 +138,6 @@
{
}
-#endif
StringTokenizer::~StringTokenizer()
1.7 +31 -6 xml-xalan/c/src/PlatformSupport/StringTokenizer.hpp
Index: StringTokenizer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/StringTokenizer.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StringTokenizer.hpp 2000/05/03 21:58:27 1.6
+++ StringTokenizer.hpp 2000/11/02 01:45:37 1.7
@@ -76,6 +76,21 @@
{
public:
+ static const XalanDOMChar s_defaultTokens[];
+
+ /**
+ * Constructs a tokenizer for the target string
+ *
+ * @param theString string to tokenize
+ * @param theTokens string of delimiters used to parse target, default
+ * is "\t\n\r\f"
+ * @param fReturnTokens if true, delimiter characters are also returned
+ * as tokens, default is false
+ */
+ StringTokenizer(const XalanDOMString& theString,
+ const XalanDOMString& theTokens = XalanDOMString(s_defaultTokens),
+ bool fReturnTokens = false);
+
/**
* Constructs a tokenizer for the target string
*
@@ -86,24 +101,34 @@
* as tokens, default is false
*/
StringTokenizer(const XalanDOMString& theString,
- const XalanDOMString& theTokens = XalanDOMString(XALAN_STATIC_UCODE_STRING(" \t\n\r\f")),
+ const XalanDOMChar* theTokens,
bool fReturnTokens = false);
-#if defined(XALAN_LSTRSUPPORT)
/**
* Constructs a tokenizer for the target string. This version constructs
* from null-terminated wide strings, like those we get from SAX-like APIs.
*
* @param theString string to tokenize
- * @param theTokens string of delimiters used to parse target, default
- * is "\t\n\r\f"
+ * @param theTokens string of delimiters used to parse target.
+ * @param fReturnTokens if true, delimiter characters are also returned
+ * as tokens, default is false
+ */
+ StringTokenizer(const XalanDOMChar* theString,
+ const XalanDOMChar* theTokens = s_defaultTokens,
+ bool fReturnTokens = false);
+
+ /**
+ * Constructs a tokenizer for the target string. This version constructs
+ * from null-terminated wide strings, like those we get from SAX-like APIs.
+ *
+ * @param theString string to tokenize
+ * @param theTokens string of delimiters used to parse target.
* @param fReturnTokens if true, delimiter characters are also returned
* as tokens, default is false
*/
StringTokenizer(const XalanDOMChar* theString,
- const XalanDOMChar* theTokens = XALAN_STATIC_UCODE_STRING(" \t\n\r\f"),
+ const XalanDOMString& theTokens,
bool fReturnTokens = false);
-#endif
virtual
~StringTokenizer();
1.11 +32 -4 xml-xalan/c/src/PlatformSupport/URISupport.cpp
Index: URISupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/URISupport.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- URISupport.cpp 2000/09/27 16:24:07 1.10
+++ URISupport.cpp 2000/11/02 01:45:37 1.11
@@ -75,6 +75,14 @@
URISupport::URLAutoPtrType
URISupport::getURLFromString(const XalanDOMString& urlString)
{
+ return getURLFromString(c_wstr(urlString));
+}
+
+
+
+URISupport::URLAutoPtrType
+URISupport::getURLFromString(const XalanDOMChar* urlString)
+{
URLAutoPtrType url(new XMLURL);
url->setURL(c_wstr(getURLStringFromString(urlString)));
@@ -86,8 +94,18 @@
XalanDOMString
URISupport::getURLStringFromString(const XalanDOMString& urlString)
+{
+ return getURLStringFromString(c_wstr(urlString));
+}
+
+
+
+XalanDOMString
+URISupport::getURLStringFromString(const XalanDOMChar* urlString)
{
- XalanDOMString theNormalizedURI(clone(urlString));
+ assert(urlString != 0);
+
+ XalanDOMString theNormalizedURI(urlString);
// Let's see what sort of URI we have...
const unsigned int len = length(theNormalizedURI);
@@ -153,8 +171,18 @@
URISupport::getURLStringFromString(
const XalanDOMString& urlString,
const XalanDOMString& base)
+{
+ return getURLStringFromString(c_wstr(urlString), c_wstr(base));
+}
+
+
+
+XalanDOMString
+URISupport::getURLStringFromString(
+ const XalanDOMChar* urlString,
+ const XalanDOMChar* base)
{
- XalanDOMString context(clone(base));
+ XalanDOMString context(base);
NormalizeURIText(context);
@@ -202,7 +230,7 @@
}
else
{
- const XalanDOMString theProtocolString(substring(urlString, 0, theColonIndex));
+ const XalanDOMString theProtocolString(substring(urlString, 0, theColonIndex));
// $$$ ToDo: XMLURL::lookupByName() is supposed to be static, but is not.
const XMLURL::Protocols theProtocol =
@@ -277,7 +305,7 @@
URISupport::InvalidURIException::InvalidURIException(const XalanDOMString& theMessage) :
XSLException(theMessage,
- XALAN_STATIC_UCODE_STRING("InvalidURIException"))
+ TranscodeFromLocalCodePage("InvalidURIException"))
{
}
1.5 +48 -3 xml-xalan/c/src/PlatformSupport/URISupport.hpp
Index: URISupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/URISupport.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- URISupport.hpp 2000/09/05 02:24:45 1.4
+++ URISupport.hpp 2000/11/02 01:45:37 1.5
@@ -72,8 +72,11 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <PlatformSupport/XSLException.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
@@ -111,11 +114,28 @@
* Determine the fully qualified URI for a string.
*
* @param urlString string to qualify
+ * @return auto pointer to fully qualified URI
+ */
+ static URLAutoPtrType
+ getURLFromString(const XalanDOMChar* urlString);
+
+ /**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
* @return string to fully qualified URI
*/
static XalanDOMString
- getURLStringFromString(
- const XalanDOMString& urlString);
+ getURLStringFromString(const XalanDOMString& urlString);
+
+ /**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
+ * @return string to fully qualified URI
+ */
+ static XalanDOMString
+ getURLStringFromString(const XalanDOMChar* urlString);
/**
* Determine the fully qualified URI for a string.
@@ -134,6 +154,18 @@
*
* @param urlString string to qualify
* @param base base location for URI
+ * @return auto pointer to fully qualified URI
+ */
+ static URLAutoPtrType
+ getURLFromString(
+ const XalanDOMChar* urlString,
+ const XalanDOMChar* base);
+
+ /**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
+ * @param base base location for URI
* @return string to fully qualified URI
*/
static XalanDOMString
@@ -142,6 +174,18 @@
const XalanDOMString& base);
/**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
+ * @param base base location for URI
+ * @return string to fully qualified URI
+ */
+ static XalanDOMString
+ getURLStringFromString(
+ const XalanDOMChar* urlString,
+ const XalanDOMChar* base);
+
+ /**
* Normalizes the string passed in, replacing
* \ with /.
*
@@ -150,6 +194,7 @@
*/
static XalanDOMString&
NormalizeURIText(XalanDOMString& uriString);
+
class InvalidURIException : public XSLException
{
1.4 +1 -1 xml-xalan/c/src/PlatformSupport/XalanBitmap.cpp
Index: XalanBitmap.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanBitmap.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanBitmap.cpp 2000/10/16 21:06:40 1.3
+++ XalanBitmap.cpp 2000/11/02 01:45:37 1.4
@@ -71,7 +71,7 @@
XalanBitmap::XalanBitmap(unsigned long theSize) :
m_size(theSize),
- m_bitmap((theSize + eBitsPerUnit) / eBitsPerUnit, 0)
+ m_bitmap(unsigned((theSize + eBitsPerUnit) / eBitsPerUnit), BitmapVectorType::value_type(0))
{
}
1.2 +61 -3 xml-xalan/c/src/PlatformSupport/XalanDecimalFormatSymbols.hpp
Index: XalanDecimalFormatSymbols.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanDecimalFormatSymbols.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanDecimalFormatSymbols.hpp 2000/05/08 17:17:05 1.1
+++ XalanDecimalFormatSymbols.hpp 2000/11/02 01:45:37 1.2
@@ -64,6 +64,10 @@
+#include <cassert>
+
+
+
#include <XalanDOM/XalanDOMString.hpp>
@@ -236,12 +240,25 @@
* @param theCurrencySymbol symbol used for local currency
*/
void
- setCurrencySymbol(const XalanDOMString& theCurrencySymbol)
+ setCurrencySymbol(const XalanDOMString& theCurrencySymbol)
{
m_currencySymbol = theCurrencySymbol;
}
/**
+ * Sets the string denoting the local currency, "$", for example
+ *
+ * @param theCurrencySymbol symbol used for local currency
+ */
+ void
+ setCurrencySymbol(const XalanDOMChar* theCurrencySymbol)
+ {
+ assert(theCurrencySymbol != 0);
+
+ m_currencySymbol = theCurrencySymbol;
+ }
+
+ /**
* Sets the character used for decimal sign, '.' for example
*
* @param theDecimalSeparator character used for decimal sign
@@ -286,18 +303,45 @@
}
/**
+ * Sets the string used to represent infinity
+ *
+ * @param theInfinity string used to represent infinity
+ */
+ void
+ setInfinity(const XalanDOMChar* theInfinity)
+ {
+ assert(theInfinity != 0);
+
+ m_infinity = theInfinity;
+ }
+
+ /**
* Sets the international string denoting the local currency
*
* @param theInternationalCurrencySymbol international string denoting the
* local currency
*/
void
- setInternationalCurrencySymbol(const XalanDOMString& theInternationalCurrencySymbol)
+ setInternationalCurrencySymbol(const XalanDOMString& theInternationalCurrencySymbol)
{
m_internationalCurrencySymbol = theInternationalCurrencySymbol;
}
/**
+ * Sets the international string denoting the local currency
+ *
+ * @param theInternationalCurrencySymbol international string denoting the
+ * local currency
+ */
+ void
+ setInternationalCurrencySymbol(const XalanDOMChar* theInternationalCurrencySymbol)
+ {
+ assert(theInternationalCurrencySymbol != 0);
+
+ m_internationalCurrencySymbol = theInternationalCurrencySymbol;
+ }
+
+ /**
* Sets the character used to represent minus sign
*
* @param theMinusSign character used to represent minus sign
@@ -331,7 +375,21 @@
{
m_NaN = theNaN;
}
-
+
+ /**
+ * Sets the string used for a numeric value that cannot be represented
+ * as a number
+ *
+ * @param theNaN string representing "not a number" value
+ */
+ void
+ setNaN(const XalanDOMChar* theNaN)
+ {
+ assert(theNaN != 0);
+
+ m_NaN = theNaN;
+ }
+
/**
* Sets the character used to separate positive and negative subpatterns in
* a pattern
1.2 +17 -9 xml-xalan/c/src/PlatformSupport/XalanFileOutputStream.cpp
Index: XalanFileOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanFileOutputStream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanFileOutputStream.cpp 2000/09/27 16:24:12 1.1
+++ XalanFileOutputStream.cpp 2000/11/02 01:45:38 1.2
@@ -64,8 +64,11 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
@@ -75,10 +78,14 @@
m_fileName(theFileName),
m_handle(0)
{
- const XalanArrayAutoPtr<char> tmpName(theFileName.transcode());
+ const CharVectorType theResult(TranscodeToLocalCodePage(theFileName));
- m_handle = fopen(tmpName.get(), "wb");
+ assert(theResult.size() > 0);
+ const char* const tmpName = &theResult[0];
+
+ m_handle = fopen(tmpName, "wb");
+
if (m_handle == 0)
{
throw XalanFileOutputStreamOpenException(theFileName,
@@ -128,11 +135,11 @@
static XalanDOMString
FormatMessageLocal(
- const XalanDOMString& theMessage,
+ const char* theMessage,
const XalanDOMString& theFileName,
- int theErrorCode)
+ int theErrorCode)
{
- XalanDOMString theResult(clone(theMessage));
+ XalanDOMString theResult(TranscodeFromLocalCodePage(theMessage));
theResult += theFileName;
@@ -145,9 +152,10 @@
theFormatter << ". The error code was "
<< theErrorCode << "." << '\0';
- theResult += theFormatter.str();
+ append(theResult, theFormatter.str());
delete theFormatter.str();
+
return theResult;
}
@@ -160,7 +168,7 @@
"Error opening file: ",
theFileName,
theErrorCode),
- XALAN_STATIC_UCODE_STRING("XalanFileOutputStreamOpenException"))
+ TranscodeFromLocalCodePage("XalanFileOutputStreamOpenException"))
{
}
@@ -179,7 +187,7 @@
"Error writing file: ",
theFileName,
theErrorCode),
- XALAN_STATIC_UCODE_STRING("XalanFileOutputStreamWriteException"))
+ TranscodeFromLocalCodePage("XalanFileOutputStreamWriteException"))
{
}
1.6 +4 -1 xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp
Index: XalanNumberFormat.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanNumberFormat.cpp 2000/09/05 02:24:45 1.5
+++ XalanNumberFormat.cpp 2000/11/02 01:45:38 1.6
@@ -58,9 +58,12 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include "DOMStringHelper.hpp"
#include "STLHelper.hpp"
-#include "XalanAutoPtr.hpp"
1.4 +16 -17 xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp
Index: XalanOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanOutputStream.cpp 2000/10/06 17:51:24 1.3
+++ XalanOutputStream.cpp 2000/11/02 01:45:38 1.4
@@ -76,7 +76,8 @@
m_bufferSize(theBufferSize),
m_buffer(),
m_encoding(),
- m_writeAsUTF16(false)
+ m_writeAsUTF16(false),
+ m_transcodingBuffer()
{
}
@@ -324,7 +325,7 @@
void
XalanOutputStream::setOutputEncoding(const XalanDOMString& theEncoding)
{
- // Flush, just in case. This should problably be an error...
+ // Flush, just in case. This should probably be an error...
flushBuffer();
XalanTranscodingServices::destroyTranscoder(m_transcoder);
@@ -415,14 +416,12 @@
}
else
{
- TranscodeVectorType theTranscodedData;
+ transcode(theBuffer, m_transcodingBuffer);
- transcode(theBuffer, theTranscodedData);
+ assert(&m_transcodingBuffer[0] != 0);
- assert(&theTranscodedData[0] != 0);
-
- writeData(&theTranscodedData[0],
- theTranscodedData.size());
+ writeData(&m_transcodingBuffer[0],
+ m_transcodingBuffer.size());
}
}
catch(const XalanOutputStreamException&)
@@ -498,8 +497,8 @@
XalanOutputStream::UnknownEncodingException::UnknownEncodingException() :
XalanOutputStreamException(
- XALAN_STATIC_UCODE_STRING("Unknown error occurred while transcoding!"),
- XALAN_STATIC_UCODE_STRING("UnknownEncodingException"))
+ TranscodeFromLocalCodePage("Unknown error occurred while transcoding!"),
+ TranscodeFromLocalCodePage("UnknownEncodingException"))
{
}
@@ -513,8 +512,8 @@
XalanOutputStream::UnsupportedEncodingException::UnsupportedEncodingException(const XalanDOMString& theEncoding) :
XalanOutputStreamException(
- XALAN_STATIC_UCODE_STRING("Unsupported encoding: ") + theEncoding,
- XALAN_STATIC_UCODE_STRING("UnsupportedEncodingException")),
+ TranscodeFromLocalCodePage("Unsupported encoding: ") + theEncoding,
+ TranscodeFromLocalCodePage("UnsupportedEncodingException")),
m_encoding(theEncoding)
{
}
@@ -529,10 +528,10 @@
XalanOutputStream::TranscoderInternalFailureException::TranscoderInternalFailureException(const XalanDOMString& theEncoding) :
XalanOutputStreamException(
- XALAN_STATIC_UCODE_STRING("Unknown error occurred while transcoding to ") +
+ TranscodeFromLocalCodePage("Unknown error occurred while transcoding to ") +
theEncoding +
- XALAN_STATIC_UCODE_STRING("!"),
- XALAN_STATIC_UCODE_STRING("TranscoderInternalFailureException")),
+ TranscodeFromLocalCodePage("!"),
+ TranscodeFromLocalCodePage("TranscoderInternalFailureException")),
m_encoding(theEncoding)
{
}
@@ -547,8 +546,8 @@
XalanOutputStream::TranscodingException::TranscodingException() :
XalanOutputStreamException(
- XALAN_STATIC_UCODE_STRING("An error occurred while transcoding!"),
- XALAN_STATIC_UCODE_STRING("TranscodingException"))
+ TranscodeFromLocalCodePage("An error occurred while transcoding!"),
+ TranscodeFromLocalCodePage("TranscodingException"))
{
}
1.3 +2 -0 xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp
Index: XalanOutputStream.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanOutputStream.hpp 2000/10/06 17:51:24 1.2
+++ XalanOutputStream.hpp 2000/11/02 01:45:38 1.3
@@ -338,6 +338,8 @@
XalanDOMString m_encoding;
bool m_writeAsUTF16;
+
+ TranscodeVectorType m_transcodingBuffer;
};
1.3 +8 -8 xml-xalan/c/src/PlatformSupport/XalanOutputStreamPrintWriter.cpp
Index: XalanOutputStreamPrintWriter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStreamPrintWriter.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanOutputStreamPrintWriter.cpp 2000/10/02 20:51:19 1.2
+++ XalanOutputStreamPrintWriter.cpp 2000/11/02 01:45:38 1.3
@@ -136,7 +136,7 @@
{
assert(s != 0);
- if (theLength == -1)
+ if (theLength == UINT_MAX)
{
if (theOffset == 0)
{
@@ -163,7 +163,7 @@
{
assert(s != 0);
- if (theLength == -1)
+ if (theLength == UINT_MAX)
{
if (theOffset == 0)
{
@@ -192,9 +192,9 @@
void
XalanOutputStreamPrintWriter::write(
- const DOMString& s,
- unsigned int theOffset,
- unsigned int theLength)
+ const XalanDOMString& s,
+ unsigned int theOffset,
+ unsigned int theLength)
{
write(c_wstr(s), theOffset, theLength);
}
@@ -244,7 +244,7 @@
unsigned int theLength)
{
assert(s != 0);
- assert(theLength >= 0 || theLength == -1);
+ assert(theLength >= 0 || theLength == UINT_MAX);
write(s,
0,
@@ -278,7 +278,7 @@
void
-XalanOutputStreamPrintWriter::print(const DOMString& s)
+XalanOutputStreamPrintWriter::print(const XalanDOMString& s)
{
m_OutputStream.write(c_wstr(s));
}
@@ -372,7 +372,7 @@
void
-XalanOutputStreamPrintWriter::println(const DOMString& s)
+XalanOutputStreamPrintWriter::println(const XalanDOMString& s)
{
print(s);
1.2 +7 -6 xml-xalan/c/src/PlatformSupport/XalanStdOutputStream.cpp
Index: XalanStdOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanStdOutputStream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanStdOutputStream.cpp 2000/09/27 16:24:12 1.1
+++ XalanStdOutputStream.cpp 2000/11/02 01:45:39 1.2
@@ -118,16 +118,16 @@
-static DOMString
+static XalanDOMString
FormatMessageLocal(
- const DOMString& theMessage,
- int theErrorCode)
+ const char* theMessage,
+ int theErrorCode)
{
#if !defined(XALAN_NO_NAMESPACES)
using std::ostrstream;
#endif
- DOMString theResult(clone(theMessage));
+ XalanDOMString theResult(TranscodeFromLocalCodePage(theMessage));
ostrstream theFormatter;
@@ -135,9 +135,10 @@
<< theErrorCode
<< "." << '\0';
- theResult += theFormatter.str();
+ append(theResult, theFormatter.str());
delete theFormatter.str();
+
return theResult;
}
@@ -147,7 +148,7 @@
int theErrorCode) :
XalanOutputStreamException(FormatMessageLocal("Error writing to standard stream!",
theErrorCode),
- XALAN_STATIC_UCODE_STRING("XercesStdTextOutputStreamWriteException"))
+ TranscodeFromLocalCodePage("XercesStdTextOutputStreamWriteException"))
{
}
1.4 +3 -2 xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.cpp
Index: XalanTranscodingServices.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanTranscodingServices.cpp 2000/10/07 15:23:41 1.3
+++ XalanTranscodingServices.cpp 2000/11/02 01:45:39 1.4
@@ -321,8 +321,8 @@
XalanTranscodingServices::UnrepresentableCharacterException::UnrepresentableCharacterException(
XalanDOMChar theCharacter,
const XalanDOMString& theEncoding) :
- XSLException(XalanDOMString("Unable to represent a character in the specified encoding"),
- XalanDOMString("UnrepresentableCharacterException")),
+ XSLException(TranscodeFromLocalCodePage("Unable to represent a character in the specified encoding"),
+ TranscodeFromLocalCodePage("UnrepresentableCharacterException")),
m_badCharacter(theCharacter),
m_encoding(theEncoding)
{
@@ -362,6 +362,7 @@
theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("WINDOWS-1250")), 0xFF)); // Windows 1250 Peter Smolik
theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("UTF-8")), 0xFFFF)); // Universal Transformation Format 8
+ theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("UTF-16")), 0xFFFF));
theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("US-ASCII")), 0x7F));
theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("ISO-8859-1")), 0xFF));
theMap.insert(value_type(XalanDOMString(XALAN_STATIC_UCODE_STRING("ISO-8859-2")), 0xFF));
1.3 +4 -0 xml-xalan/c/src/PlatformSupport/XalanUnicode.hpp
Index: XalanUnicode.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanUnicode.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanUnicode.hpp 2000/09/19 14:43:51 1.2
+++ XalanUnicode.hpp 2000/11/02 01:45:39 1.3
@@ -80,6 +80,7 @@
{
charHTab = 0x09,
charLF = 0x0A,
+ charFF = 0x0C,
charCR = 0x0D,
charSpace = 0x20,
@@ -187,6 +188,7 @@
charLetter_t = 0x74,
charLetter_u = 0x75,
charLetter_y = 0x79,
+ charLetter_z = 0x7A,
charLeftCurlyBracket = 0x7B,
@@ -200,6 +202,7 @@
static const XalanDOMChar charHTab = 0x09;
static const XalanDOMChar charLF = 0x0A;
static const XalanDOMChar charCR = 0x0D;
+ static const XalanDOMChar charFF = 0x0C;
static const XalanDOMChar charSpace = 0x20;
static const XalanDOMChar charExclamationMark = 0x21;
@@ -306,6 +309,7 @@
static const XalanDOMChar charLetter_t = 0x74;
static const XalanDOMChar charLetter_u = 0x75;
static const XalanDOMChar charLetter_y = 0x79;
+ static const XalanDOMChar charLetter_z = 0x7A;
static const XalanDOMChar charLeftCurlyBracket = 0x7B;
1.1 xml-xalan/c/src/PlatformSupport/XalanDOMStringPool.cpp
Index: XalanDOMStringPool.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file...
#include "XalanDOMStringPool.hpp"
const XalanDOMString XalanDOMStringPool::s_emptyString;
XalanDOMStringPool::XalanDOMStringPool() :
m_strings(),
m_index()
{
}
XalanDOMStringPool::~XalanDOMStringPool()
{
}
void
XalanDOMStringPool::clear()
{
// Clear by swapping things, which is
// guaranteed to free up all allocated memory.
XalanDOMStringCollectionType().swap(m_strings);
IteratorMapType().swap(m_index);
}
XalanDOMStringPool::size_type
XalanDOMStringPool::size() const
{
assert(m_strings.size() == m_index.size());
return m_strings.size();
}
const XalanDOMString&
XalanDOMStringPool::get(const XalanDOMString& theString)
{
return get(c_wstr(theString));
}
const XalanDOMString&
XalanDOMStringPool::get(const XalanDOMChar* theString)
{
assert(m_strings.size() == m_index.size());
if (theString == 0 || *theString == 0)
{
return s_emptyString;
}
else
{
// Find the string...
const IteratorMapType::const_iterator i =
m_index.find(theString);
if (i != m_index.end())
{
// Already there, so return it...
return *(*i).second;
}
else
{
#if 1
// Not found, so insert the string...
const XalanDOMStringCollectionType::iterator theIterator =
m_strings.insert(m_strings.end(), XalanDOMString());
XalanDOMString& theNewString = *theIterator;
theNewString = theString;
#else
// Not found, so insert the string...
const XalanDOMStringCollectionType::const_iterator theIterator =
m_strings.insert(m_strings.end(), XalanDOMString(theString));
const XalanDOMString& theNewString = *theIterator;
#endif
// Add an index entry...
m_index.insert(IteratorMapType::value_type(c_wstr(theNewString), theIterator));
assert(m_strings.size() == m_index.size());
return theNewString;
}
}
}
1.1 xml-xalan/c/src/PlatformSupport/XalanDOMStringPool.hpp
Index: XalanDOMStringPool.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680)
#define XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <PlatformSupport/PlatformSupportDefinitions.hpp>
#include <deque>
#include <map>
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/STLHelper.hpp>
class XALAN_PLATFORMSUPPORT_EXPORT XalanDOMStringPool
{
public:
#if defined(XALAN_NO_NAMESPACES)
typedef deque<XalanDOMString> XalanDOMStringCollectionType;
typedef map<
const XalanDOMChar*,
XalanDOMStringCollectionType::const_iterator,
less_null_terminated_arrays<const XalanDOMChar*> > IteratorMapType;
#else
typedef std::deque<XalanDOMString> XalanDOMStringCollectionType;
typedef std::map<
const XalanDOMChar*,
XalanDOMStringCollectionType::const_iterator,
less_null_terminated_arrays<const XalanDOMChar> > IteratorMapType;
#endif
typedef XalanDOMStringCollectionType::size_type size_type;
explicit
XalanDOMStringPool();
virtual
~XalanDOMStringPool();
/**
* Clear the pool.
*
* @param thePair key-value pair
*/
virtual void
clear();
/**
* Get the number of strings in the pool
*
* @param thePair key-value pair
*/
virtual size_type
size() const;
/**
* Get a pooled string. If the string is not pooled, it is added.
*
* @param theString The string to pool.
* @return a const reference to the pooled string.
*/
virtual const XalanDOMString&
get(const XalanDOMString& theString);
/**
* Get a pooled string. If the string is not pooled, it is added.
*
* @param theString The string to pool.
* @return a const reference to the pooled string.
*/
virtual const XalanDOMString&
get(const XalanDOMChar* theString);
private:
// Not implemented, for now...
XalanDOMStringPool(const XalanDOMStringPool&);
XalanDOMStringPool&
operator=(const XalanDOMStringPool&);
bool
operator==(const XalanDOMStringPool&) const;
// Data members...
XalanDOMStringCollectionType m_strings;
IteratorMapType m_index;
static const XalanDOMString s_emptyString;
};
#endif // !defined(XALANDOMSTRINGPOOL_HEADER_GUARD_1357924680)
1.3 +1 -1 xml-xalan/c/src/TestXPath/NodeNameTreeWalker.cpp
Index: NodeNameTreeWalker.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/TestXPath/NodeNameTreeWalker.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NodeNameTreeWalker.cpp 2000/04/11 14:44:36 1.2
+++ NodeNameTreeWalker.cpp 2000/11/02 01:45:46 1.3
@@ -119,7 +119,7 @@
void
NodeNameTreeWalker::startNode(XalanNode* node)
{
- const XalanDOMString theNodeName = node->getNodeName();
+ const XalanDOMString& theNodeName = node->getNodeName();
if (equals(theNodeName, m_nodeName) == true)
{
1.21 +12 -12 xml-xalan/c/src/TestXPath/TestXPath.cpp
Index: TestXPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/TestXPath/TestXPath.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TestXPath.cpp 2000/09/27 16:38:41 1.20
+++ TestXPath.cpp 2000/11/02 01:45:46 1.21
@@ -93,10 +93,6 @@
-#include <DOMSupport/DOMSupportDefault.hpp>
-
-
-
#include <XPath/ElementPrefixResolverProxy.hpp>
#include <XPath/XPathInit.hpp>
#include <XPath/XObjectFactoryDefault.hpp>
@@ -115,6 +111,7 @@
+#include <XercesParserLiaison/XercesDOMSupport.hpp>
#include <XercesParserLiaison/XercesParserLiaison.hpp>
@@ -655,7 +652,7 @@
theXPath1);
theXPathProcessor.initXPath(*theXPath1,
- "following-sibling::*",
+ TranscodeFromLocalCodePage("following-sibling::*"),
thePrefixResolver,
theXPathEnvSupport);
@@ -665,7 +662,7 @@
theXPath2);
theXPathProcessor.initXPath(*theXPath2,
- "descendant::*",
+ TranscodeFromLocalCodePage("descendant::*"),
thePrefixResolver,
theXPathEnvSupport);
@@ -835,7 +832,7 @@
TestNumericResult(theXPathProcessor,
*theXPath,
- theNumericTestInput[i],
+ TranscodeFromLocalCodePage(theNumericTestInput[i]),
thePrintWriter,
theNumericTestExpectedOutput[i],
theXPathEnvSupport,
@@ -966,9 +963,9 @@
TestStringResult(theXPathProcessor,
*theXPath,
- theStringTestInput[i],
+ TranscodeFromLocalCodePage(theStringTestInput[i]),
thePrintWriter,
- theStringTestExpectedOutput[i],
+ TranscodeFromLocalCodePage(theStringTestExpectedOutput[i]),
theXPathEnvSupport,
0,
ElementPrefixResolverProxy(0, theXPathEnvSupport, theXPathSupport),
@@ -1101,7 +1098,7 @@
TestBooleanResult(theXPathProcessor,
*theXPath,
- theBooleanTestInput[i],
+ TranscodeFromLocalCodePage(theBooleanTestInput[i]),
thePrintWriter,
theBooleanTestExpectedOutput[i],
theXPathEnvSupport,
@@ -1257,7 +1254,7 @@
theXPathEnvSupport,
theXPathSupport,
theLiaison,
- XALAN_STATIC_UCODE_STRING("/xsl-test/conf/Axes/"),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("/xsl-test/conf/Axes/")),
thePrintWriter,
theExecutionContext);
}
@@ -1286,7 +1283,7 @@
XPathInit theXPathInit;
XPathEnvSupportDefault theXPathEnvSupport;
- DOMSupportDefault theDOMSupport;
+ XercesDOMSupport theDOMSupport;
XPathSupportDefault theXPathSupport(theDOMSupport);
XObjectFactoryDefault theXObjectFactory;
XPathFactoryDefault theXPathFactory;
@@ -1310,6 +1307,9 @@
}
XMLPlatformUtils::Terminate();
+
+ const unsigned short foo1 = '\f';
+ const unsigned short foo2 = '\v';
return 0;
}
1.45 +56 -16 xml-xalan/c/src/TestXSLT/process.cpp
Index: process.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/TestXSLT/process.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- process.cpp 2000/10/17 13:25:14 1.44
+++ process.cpp 2000/11/02 01:45:48 1.45
@@ -83,13 +83,16 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/DOMStringPrintWriter.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
#include <PlatformSupport/XalanOutputStreamPrintWriter.hpp>
#include <PlatformSupport/XalanFileOutputStream.hpp>
#include <PlatformSupport/XalanStdOutputStream.hpp>
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <DOMSupport/DOMSupportDefault.hpp>
@@ -111,6 +114,7 @@
#include <XMLSupport/FormatterToDOM.hpp>
#include <XMLSupport/FormatterToHTML.hpp>
+#include <XMLSupport/FormatterToNull.hpp>
#include <XMLSupport/FormatterToText.hpp>
#include <XMLSupport/FormatterToXML.hpp>
#include <XMLSupport/FormatterTreeWalker.hpp>
@@ -212,6 +216,11 @@
<< " [-ESCAPECDATA (Strip CDATA sections of their brackets, but escape.)"
<< endl
<< endl
+ << "The following option is valid only with -HTML."
+ << endl
+ << endl
+ << " [-NOINDENT (Turns off HTML indenting..]"
+ << endl
<< "The following option is valid only with -XML."
<< endl
<< endl
@@ -246,6 +255,8 @@
bool traceTemplateChildren;
bool shouldWriteXMLHeader;
bool doValidation;
+ bool noIndent;
+ bool formatToNull;
int indentAmount;
int outputType;
CharVectorType outFileName;
@@ -268,10 +279,12 @@
traceTemplateChildren(false),
shouldWriteXMLHeader(true),
doValidation(false),
- indentAmount(0),
+ noIndent(false),
+ formatToNull(false),
+ indentAmount(-1),
outputType(-1),
- specialCharacters(),
outFileName(),
+ specialCharacters(),
xslFileName(),
inFileName()
{
@@ -371,6 +384,10 @@
fSuccess = false;
}
}
+ else if (!stricmp("-NOINDENT", argv[i]))
+ {
+ p.noIndent = true;
+ }
else if (!stricmp("-INDENT", argv[i]))
{
++i;
@@ -383,7 +400,7 @@
{
fSuccess = false;
}
- }
+ }
else if(!stricmp("-VALIDATE", argv[i]))
{
p.doValidation = true;
@@ -472,6 +489,10 @@
p.outputType = FormatterListener::OUTPUT_METHOD_DOM;
}
+ else if(!stricmp("-NULL", argv[i]))
+ {
+ p.formatToNull = true;
+ }
else if(!stricmp("-STRIPCDATA", argv[i]))
{
p.stripCData = true;
@@ -517,6 +538,8 @@
bool shouldWriteXMLHeader,
bool stripCData,
bool escapeCData,
+ bool noIndent,
+ bool formatToNull,
PrintWriter& resultWriter,
int indentAmount,
const XalanDOMString& mimeEncoding,
@@ -525,7 +548,11 @@
{
FormatterListener* formatter = 0;
- if(FormatterListener::OUTPUT_METHOD_XML == outputType)
+ if (formatToNull == true)
+ {
+ formatter = new FormatterToNull;
+ }
+ else if(FormatterListener::OUTPUT_METHOD_XML == outputType)
{
XalanDOMString version;
bool outputIndent = false;
@@ -537,7 +564,7 @@
if (stylesheet != 0)
{
version = stylesheet->m_version;
- outputIndent = stylesheet->getOutputIndent();
+
mediatype = stylesheet->m_mediatype;
doctypeSystem = stylesheet->getOutputDoctypeSystem();
doctypePublic = stylesheet->getOutputDoctypePublic();
@@ -563,12 +590,12 @@
}
else if(FormatterListener::OUTPUT_METHOD_TEXT == outputType)
{
- formatter = new FormatterToText(resultWriter);
+ formatter = new FormatterToText(resultWriter, mimeEncoding);
}
else if(FormatterListener::OUTPUT_METHOD_HTML == outputType)
{
XalanDOMString version;
- bool outputIndent = false;
+ bool outputIndent = !noIndent;
XalanDOMString mediatype;
XalanDOMString doctypeSystem;
XalanDOMString doctypePublic;
@@ -577,7 +604,12 @@
if (stylesheet != 0)
{
version = stylesheet->m_version;
- outputIndent = stylesheet->getOutputIndent();
+
+ if (noIndent == false)
+ {
+ outputIndent = stylesheet->getOutputIndent();
+ }
+
mediatype = stylesheet->m_mediatype;
doctypeSystem = stylesheet->getOutputDoctypeSystem();
doctypePublic = stylesheet->getOutputDoctypePublic();
@@ -620,7 +652,7 @@
}
else
{
- return new XalanFileOutputStream(c_str(params.outFileName));
+ return new XalanFileOutputStream(TranscodeFromLocalCodePage(c_str(params.outFileName)));
}
}
@@ -728,8 +760,8 @@
for ( ; it != params.paramsMap.end(); ++it)
{
processor.setStylesheetParam(
- c_str((*it).first),
- c_str((*it).second));
+ TranscodeFromLocalCodePage(c_str((*it).first)),
+ TranscodeFromLocalCodePage(c_str((*it).second)));
}
}
@@ -740,8 +772,12 @@
{
xmlParserLiaison.setIndent(params.indentAmount);
}
+
+ if (params.specialCharacters.size() != 0)
+ {
+ xmlParserLiaison.setSpecialCharacters(TranscodeFromLocalCodePage(c_str(params.specialCharacters)));
+ }
- xmlParserLiaison.setSpecialCharacters(c_str(params.specialCharacters));
xmlParserLiaison.SetShouldExpandEntityRefs(params.shouldExpandEntityRefs);
xmlParserLiaison.setUseValidation(params.doValidation);
@@ -756,7 +792,7 @@
if(0 != params.xslFileName.size())
{
- xslFileName = c_str(params.xslFileName);
+ xslFileName = TranscodeFromLocalCodePage(c_str(params.xslFileName));
}
const StylesheetRoot* stylesheet = 0;
@@ -777,6 +813,8 @@
params.shouldWriteXMLHeader,
params.stripCData,
params.escapeCData,
+ params.noIndent,
+ params.formatToNull,
resultWriter,
xmlParserLiaison.getIndent(),
mimeEncoding,
@@ -868,6 +906,8 @@
params.shouldWriteXMLHeader,
params.stripCData,
params.escapeCData,
+ params.noIndent,
+ false,
resultWriter,
xmlParserLiaison.getIndent(),
mimeEncoding,
@@ -1028,7 +1068,7 @@
{
cout << endl
<< "XalanDOMException caught. The code is "
- << e.getExceptionCode()
+ << int(e.getExceptionCode())
<< "."
<< endl;
@@ -1042,7 +1082,7 @@
}
#if !defined(NDEBUG)
- const unsigned long theInstanceCount =
+ const size_t theInstanceCount =
XalanNode::getInstanceCount();
if (theInstanceCount > 0)
1.11 +3 -3 xml-xalan/c/src/XMLSupport/FormatterToDOM.cpp
Index: FormatterToDOM.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToDOM.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FormatterToDOM.cpp 2000/09/05 02:24:48 1.10
+++ FormatterToDOM.cpp 2000/11/02 01:45:50 1.11
@@ -147,13 +147,13 @@
const XMLCh* const name,
AttributeList& attrs)
{
- XalanElement* const elem = m_doc->createElement(name);
+ XalanElement* const elem = m_doc->createElement(XalanDOMString(name));
const int nAtts = attrs.getLength();
for(int i = 0; i < nAtts; i++)
{
- elem->setAttribute(attrs.getName(i), attrs.getValue(i));
+ elem->setAttribute(XalanDOMString(attrs.getName(i)), XalanDOMString(attrs.getValue(i)));
}
append(elem);
@@ -210,7 +210,7 @@
void
FormatterToDOM::entityReference(const XMLCh* const name)
{
- append(m_doc->createEntityReference(name));
+ append(m_doc->createEntityReference(XalanDOMString(name)));
}
1.30 +213 -161 xml-xalan/c/src/XMLSupport/FormatterToHTML.cpp
Index: FormatterToHTML.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToHTML.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- FormatterToHTML.cpp 2000/10/11 19:43:04 1.29
+++ FormatterToHTML.cpp 2000/11/02 01:45:50 1.30
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
/**
- * $Id: FormatterToHTML.cpp,v 1.29 2000/10/11 19:43:04 auriemma Exp $
+ * $Id: FormatterToHTML.cpp,v 1.30 2000/11/02 01:45:50 dbertoni Exp $
*
* $State: Exp $
*
@@ -100,7 +100,7 @@
"Tau", "Upsilon", "Phi", "Chi",
"Psi", "Omega", 0
};
-
+
static const char* const theHTMLSymbols2[] =
{
"alpha", "beta",
@@ -223,7 +223,10 @@
standalone,
OUTPUT_METHOD_HTML),
m_currentElementName(),
- m_inBlockElem(false)
+ m_inBlockElem(false),
+ m_isRawStack(),
+ m_isScriptOrStyleElem(false),
+ m_isFirstElem(true)
{
initCharsMap();
}
@@ -286,7 +289,7 @@
const FormatterToHTML::ElemDesc&
-FormatterToHTML::getElemDesc(const XalanDOMString& name)
+FormatterToHTML::getElemDesc(const XalanDOMChar* name)
{
const ElementFlagsMapType::const_iterator i =
s_elementFlags.find(name);
@@ -353,27 +356,37 @@
void
+FormatterToHTML::endDocument()
+{
+ m_isFirstElem = true;
+
+ FormatterToXML::endDocument();
+}
+
+
+
+void
FormatterToHTML::startElement(
const XMLCh* const name,
AttributeList& attrs)
{
- const bool savedDoIndent = m_doIndent;
-
writeParentTagEnd();
- const XalanDOMString nameUpper = toUpperCase(name);
-
const ElemDesc& elemDesc =
- getElemDesc(nameUpper);
+ getElemDesc(name);
bool isBlockElement = elemDesc.is(ElemDesc::BLOCK);
+ m_isScriptOrStyleElem =
+ equalsIgnoreCaseASCII(name, c_wstr(s_scriptString)) ||
+ equalsIgnoreCaseASCII(name, c_wstr(s_styleString));
+
if(m_ispreserve == true)
{
m_ispreserve = false;
}
else if(m_doIndent &&
- length(m_currentElementName) != 0 &&
+ m_isFirstElem == false &&
(m_inBlockElem == false || isBlockElement == true))
{
m_startNewLine = true;
@@ -385,8 +398,6 @@
m_isRawStack.push_back(elemDesc.is(ElemDesc::RAW));
- m_currentElementName = nameUpper;
-
accum(XalanUnicode::charLessThanSign);
accum(name);
@@ -405,7 +416,7 @@
m_isprevtext = false;
- m_doIndent = savedDoIndent;
+ m_isFirstElem = false;
}
@@ -419,10 +430,8 @@
m_isRawStack.pop_back();
- const XalanDOMString nameUpper = toUpperCase(name);
-
const ElemDesc& elemDesc =
- getElemDesc(nameUpper);
+ getElemDesc(name);
const bool isBlockElement = elemDesc.is(ElemDesc::BLOCK);
@@ -452,8 +461,6 @@
accum(XalanUnicode::charSolidus);
accum(name);
accum(XalanUnicode::charGreaterThanSign);
-
- m_currentElementName = name;
}
else
{
@@ -490,6 +497,8 @@
}
}
+ m_isFirstElem = false;
+
m_isprevtext = false;
}
@@ -532,8 +541,6 @@
m_ispreserve = true;
- unsigned int pos = 0;
-
for (unsigned int i = 0; i < length; ++i)
{
const XalanDOMChar ch = chars[i];
@@ -569,15 +576,15 @@
}
else if (XalanUnicode::charLessThanSign == ch)
{
- pos = copyEntityIntoBuffer(s_ltString, pos);
+ copyEntityIntoBuffer(s_ltString);
}
else if (XalanUnicode::charGreaterThanSign == ch)
{
- pos = copyEntityIntoBuffer(s_gtString, pos);
+ copyEntityIntoBuffer(s_gtString);
}
else if (XalanUnicode::charAmpersand == ch)
{
- pos = copyEntityIntoBuffer(s_ampString, pos);
+ copyEntityIntoBuffer(s_ampString);
}
else if(ch >= 9 && ch <= 126)
{
@@ -585,29 +592,29 @@
}
else if(ch >= 160 && ch <= 255)
{
- pos = copyEntityIntoBuffer(theHTMLLatin1Symbols[ch - 160], pos);
+ copyEntityIntoBuffer(theHTMLLatin1Symbols[ch - 160]);
}
else if(ch >= 913 && ch <= 937 && ch != 930)
{
- pos = copyEntityIntoBuffer(theHTMLSymbols1[ch - 913], pos);
+ copyEntityIntoBuffer(theHTMLSymbols1[ch - 913]);
}
else if(ch >= 945 && ch <= 969)
{
- pos = copyEntityIntoBuffer(theHTMLSymbols2[ch - 945], pos);
+ copyEntityIntoBuffer(theHTMLSymbols2[ch - 945]);
}
else if(ch >= 977 && ch <= 978)
{
// subtract the unused characters
- pos = copyEntityIntoBuffer(theHTMLSymbols2[ch - 945 - 7], pos);
+ copyEntityIntoBuffer(theHTMLSymbols2[ch - 945 - 7]);
}
else if(ch == 982)
{
// subtract the unused characters
- pos = copyEntityIntoBuffer(theHTMLSymbols2[ch - 945 - 10], pos);
+ copyEntityIntoBuffer(theHTMLSymbols2[ch - 945 - 10]);
}
else if (402 == ch)
{
- pos = copyEntityIntoBuffer(s_fnofString, pos);
+ copyEntityIntoBuffer(s_fnofString);
}
else if (m_isUTF8 == true && 0xd800 <= ch && ch < 0xdc00)
{
@@ -668,8 +675,7 @@
const XMLCh* const ch,
const unsigned int length)
{
- if(equalsIgnoreCase(m_currentElementName, c_wstr(s_scriptString)) == true ||
- equalsIgnoreCase(m_currentElementName, c_wstr(s_styleString)) == true)
+ if(m_isScriptOrStyleElem == true)
{
writeParentTagEnd();
@@ -851,39 +857,85 @@
-unsigned int
-FormatterToHTML::copyEntityIntoBuffer(
- const XalanDOMChar* s,
- unsigned int pos)
+void
+FormatterToHTML::copyEntityIntoBuffer(const XalanDOMChar* s)
{
const unsigned int len = length(s);
accum(XalanUnicode::charAmpersand);
- for(unsigned int i= 0; i < len; ++i)
+ for(unsigned int i = 0; i < len; ++i)
{
accum(s[i]);
}
accum(XalanUnicode::charSemicolon);
+}
+
+
+
+void
+FormatterToHTML::copyEntityIntoBuffer(const char* s)
+{
+ const unsigned int len = strlen(s);
- return pos;
+ accum(XalanUnicode::charAmpersand);
+
+ for(unsigned int i = 0; i < len; ++i)
+ {
+ accum(s[i]);
+ }
+
+ accum(XalanUnicode::charSemicolon);
}
void
+FormatterToHTML::copyEntityIntoBuffer(const XalanDOMString& s)
+{
+ const unsigned int len = length(s);
+
+ accum(XalanUnicode::charAmpersand);
+
+ for(unsigned int i = 0; i < len; ++i)
+ {
+ accum(s[i]);
+ }
+
+ accum(XalanUnicode::charSemicolon);
+}
+
+
+
+void
+FormatterToHTML::copyEntityIntoBuffer(const XalanDOMCharVectorType& s)
+{
+
+ ;
+
+ accum(XalanUnicode::charAmpersand);
+
+ for(XalanDOMCharVectorType::const_iterator i = s.begin(); (*i) != 0; ++i)
+ {
+ accum(*i);
+ }
+
+ accum(XalanUnicode::charSemicolon);
+}
+
+
+
+void
FormatterToHTML::processAttribute(
const XalanDOMChar* name,
const XalanDOMChar* value,
const ElemDesc& elemDesc)
{
- const XalanDOMString nameUpper = toUpperCase(name);
-
accum(XalanUnicode::charSpace);
- if(elemDesc.isAttrFlagSet(nameUpper, ElemDesc::ATTREMPTY) == true &&
- (length(value) == 0) || equalsIgnoreCase(value, name) == true)
+ if(elemDesc.isAttrFlagSet(name, ElemDesc::ATTREMPTY) == true &&
+ (length(value) == 0) || equalsIgnoreCaseASCII(value, name) == true)
{
accum(name);
}
@@ -893,7 +945,7 @@
accum(XalanUnicode::charEqualsSign);
accum(XalanUnicode::charQuoteMark);
- if(elemDesc.isAttrFlagSet(nameUpper, ElemDesc::ATTRURL) == true)
+ if(elemDesc.isAttrFlagSet(name, ElemDesc::ATTRURL) == true)
{
writeAttrURI(value, m_encoding);
}
@@ -956,503 +1008,503 @@
// HTML 4.0 loose DTD
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BASEFONT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BASEFONT")),
ElemDesc(0|ElemDesc::EMPTY)));
PairType theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("FRAME"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("FRAME")),
ElemDesc(0|ElemDesc::EMPTY|ElemDesc::BLOCK)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("SRC"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("SRC")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("FRAMESET"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("FRAMESET")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("NOFRAMES"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("NOFRAMES")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("ISINDEX"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("ISINDEX")),
ElemDesc(0|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("APPLET"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("APPLET")),
ElemDesc(0|ElemDesc::WHITESPACESENSITIVE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("CENTER"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CENTER")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DIR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DIR")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("MENU"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("MENU")),
ElemDesc(0|ElemDesc::BLOCK)));
// HTML 4.0 strict DTD
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TT")),
ElemDesc(0|ElemDesc::FONTSTYLE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("I"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("I")),
ElemDesc(0|ElemDesc::FONTSTYLE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("B"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("B")),
ElemDesc(0|ElemDesc::FONTSTYLE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BIG"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BIG")),
ElemDesc(0|ElemDesc::FONTSTYLE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SMALL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SMALL")),
ElemDesc(0|ElemDesc::FONTSTYLE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("EM"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("EM")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("STRONG"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("STRONG")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DFN"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DFN")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("CODE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CODE")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SAMP"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SAMP")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("KBD"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("KBD")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("VAR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("VAR")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("CITE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CITE")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("ABBR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("ABBR")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("ACRONYM"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("ACRONYM")),
ElemDesc(0|ElemDesc::PHRASE)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SUP"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SUP")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SUB"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SUB")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SPAN"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SPAN")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BDO"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BDO")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BR")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BODY"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BODY")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("ADDRESS"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("ADDRESS")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DIV"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DIV")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("A"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("A")),
ElemDesc(0|ElemDesc::SPECIAL)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("HREF"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("NAME"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("HREF")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("NAME")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("MAP"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("MAP")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("AREA"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("AREA")),
ElemDesc(0|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("LINK"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("LINK")),
ElemDesc(0|ElemDesc::HEADMISC|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("IMG"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("IMG")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL|ElemDesc::EMPTY|ElemDesc::WHITESPACESENSITIVE)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("SRC"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("LONGDESC"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("USEMAP"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("SRC")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("LONGDESC")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("USEMAP")), ElemDesc::ATTRURL);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("OBJECT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("OBJECT")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL|ElemDesc::HEADMISC|ElemDesc::WHITESPACESENSITIVE)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CLASSID"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CODEBASE"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DATA"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("ARCHIVE"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("USEMAP"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CLASSID")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CODEBASE")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DATA")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("ARCHIVE")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("USEMAP")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("PARAM"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("PARAM")),
ElemDesc(0|ElemDesc::EMPTY)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("HR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("HR")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET|ElemDesc::EMPTY)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("P"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("P")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H1"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H1")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H2"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H2")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H3"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H3")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H4"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H4")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H5"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H5")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("H6"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("H6")),
ElemDesc(0|ElemDesc::HEAD|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("PRE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("PRE")),
ElemDesc(0|ElemDesc::PREFORMATTED|ElemDesc::BLOCK)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("Q"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("Q")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CITE"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CITE")), ElemDesc::ATTRURL);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BLOCKQUOTE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BLOCKQUOTE")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CITE"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CITE")), ElemDesc::ATTRURL);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("INS"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("INS")),
ElemDesc(0)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CITE"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CITE")), ElemDesc::ATTRURL);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DEL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DEL")),
ElemDesc(0)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CITE"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CITE")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DL")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DT")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("DD"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("DD")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("OL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("OL")),
ElemDesc(0|ElemDesc::LIST|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("UL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("UL")),
ElemDesc(0|ElemDesc::LIST|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("LI"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("LI")),
ElemDesc(0|ElemDesc::BLOCK)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("FORM"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("FORM")),
ElemDesc(0|ElemDesc::BLOCK)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("ACTION"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("ACTION")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("LABEL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("LABEL")),
ElemDesc(0|ElemDesc::FORMCTRL)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("INPUT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("INPUT")),
ElemDesc(0|ElemDesc::FORMCTRL|ElemDesc::INLINELABEL|ElemDesc::EMPTY)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("SRC"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("USEMAP"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("CHECKED"), ElemDesc::ATTREMPTY);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DISABLED"), ElemDesc::ATTREMPTY);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("READONLY"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("SRC")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("USEMAP")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("CHECKED")), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DISABLED")), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("READONLY")), ElemDesc::ATTREMPTY);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SELECT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SELECT")),
ElemDesc(0|ElemDesc::FORMCTRL|ElemDesc::INLINELABEL)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("READONLY"), ElemDesc::ATTREMPTY);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("MULTIPLE"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("READONLY")), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("MULTIPLE")), ElemDesc::ATTREMPTY);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("OPTGROUP"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("OPTGROUP")),
ElemDesc(0)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DISABLED"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DISABLED")), ElemDesc::ATTREMPTY);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("OPTION"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("OPTION")),
ElemDesc(0)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DISABLED"), ElemDesc::ATTREMPTY);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("SELECTED"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DISABLED")), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("SELECTED")), ElemDesc::ATTREMPTY);
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TEXTAREA"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TEXTAREA")),
ElemDesc(0|ElemDesc::FORMCTRL|ElemDesc::INLINELABEL)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DISABLED"), ElemDesc::ATTREMPTY);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("READONLY"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DISABLED")), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("READONLY")), ElemDesc::ATTREMPTY);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("FIELDSET"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("FIELDSET")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("LEGEND"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("LEGEND")),
ElemDesc(0)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BUTTON"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BUTTON")),
ElemDesc(0|ElemDesc::FORMCTRL|ElemDesc::INLINELABEL)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("DISABLED"), ElemDesc::ATTREMPTY);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("DISABLED")), ElemDesc::ATTREMPTY);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TABLE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TABLE")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("CAPTION"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("CAPTION")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("THEAD"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("THEAD")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TFOOT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TFOOT")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TBODY"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TBODY")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("COLGROUP"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("COLGROUP")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("COL"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("COL")),
ElemDesc(0|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TR"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TR")),
ElemDesc(0|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TH"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TH")),
ElemDesc(0)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TD"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TD")),
ElemDesc(0)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("HEAD"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("HEAD")),
ElemDesc(0|ElemDesc::BLOCK)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("PROFILE"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("PROFILE")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("TITLE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("TITLE")),
ElemDesc(0|ElemDesc::BLOCK)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("BASE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("BASE")),
ElemDesc(0|ElemDesc::EMPTY|ElemDesc::BLOCK)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("HREF"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("HREF")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("META"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("META")),
ElemDesc(0|ElemDesc::HEADMISC|ElemDesc::EMPTY|ElemDesc::BLOCK)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("STYLE"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("STYLE")),
ElemDesc(0|ElemDesc::HEADMISC|ElemDesc::RAW|ElemDesc::BLOCK)));
theResult =
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("SCRIPT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("SCRIPT")),
ElemDesc(0|ElemDesc::SPECIAL|ElemDesc::ASPECIAL|ElemDesc::HEADMISC|ElemDesc::RAW)));
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("SRC"), ElemDesc::ATTRURL);
- (*theResult.first).second.setAttr(XALAN_STATIC_UCODE_STRING("FOR"), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("SRC")), ElemDesc::ATTRURL);
+ (*theResult.first).second.setAttr(c_wstr(XALAN_STATIC_UCODE_STRING("FOR")), ElemDesc::ATTRURL);
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("NOSCRIPT"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("NOSCRIPT")),
ElemDesc(0|ElemDesc::BLOCK|ElemDesc::BLOCKFORM|ElemDesc::BLOCKFORMFIELDSET)));
theElementFlags.insert(
ElementFlagsMapType::value_type(
- XALAN_STATIC_UCODE_STRING("HTML"),
+ c_wstr(XALAN_STATIC_UCODE_STRING("HTML")),
ElemDesc(0|ElemDesc::BLOCK)));
}
1.12 +30 -36 xml-xalan/c/src/XMLSupport/FormatterToHTML.hpp
Index: FormatterToHTML.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToHTML.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FormatterToHTML.hpp 2000/08/31 19:42:55 1.11
+++ FormatterToHTML.hpp 2000/11/02 01:45:50 1.12
@@ -58,7 +58,7 @@
#define FORMATTERTOHTML_HEADER_GUARD_1357924680
/**
- * $Id: FormatterToHTML.hpp,v 1.11 2000/08/31 19:42:55 dbertoni Exp $
+ * $Id: FormatterToHTML.hpp,v 1.12 2000/11/02 01:45:50 dbertoni Exp $
*
* $State: Exp $
*
@@ -83,11 +83,11 @@
-#include <PlatformSupport/DOMStringHelper.hpp>
+#include <Include/XalanArrayKeyMap.hpp>
-#include <XPath/QName.hpp>
+#include <PlatformSupport/DOMStringHelper.hpp>
@@ -144,6 +144,9 @@
startDocument();
virtual void
+ endDocument();
+
+ virtual void
startElement(
const XMLCh* const name,
AttributeList& attrs);
@@ -223,7 +226,7 @@
void
setAttr(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
unsigned int flags)
{
m_attrs.insert(AttributeMapType::value_type(name, flags));
@@ -231,7 +234,7 @@
bool
isAttrFlagSet(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
unsigned int flags) const
{
const AttributeMapType::const_iterator i =
@@ -249,11 +252,10 @@
private:
- #if defined(XALAN_NO_NAMESPACES)
- typedef map<XalanDOMString, unsigned int, less<XalanDOMString> > AttributeMapType;
- #else
- typedef std::map<XalanDOMString, unsigned int> AttributeMapType;
- #endif
+ typedef XalanArrayKeyMap<
+ XalanDOMChar,
+ unsigned int,
+ less_no_case_ascii_wide_string> AttributeMapType;
const unsigned int m_flags;
@@ -261,13 +263,10 @@
};
-#if defined(XALAN_NO_NAMESPACES)
- typedef map<XalanDOMString,
+ typedef XalanArrayKeyMap<
+ XalanDOMChar,
ElemDesc,
- less<XalanDOMString> > ElementFlagsMapType;
-#else
- typedef std::map<XalanDOMString, ElemDesc> ElementFlagsMapType;
-#endif
+ less_no_case_ascii_wide_string> ElementFlagsMapType;
protected:
@@ -348,27 +347,18 @@
void
initCharsMap();
- unsigned int
- copyEntityIntoBuffer(
- const XalanDOMChar* s,
- unsigned int pos);
-
- unsigned int
- copyEntityIntoBuffer(
- const XalanDOMString& s,
- unsigned int pos)
- {
- return copyEntityIntoBuffer(c_wstr(s), pos);
- }
+ void
+ copyEntityIntoBuffer(const XalanDOMChar* s);
- unsigned int
- copyEntityIntoBuffer(
- const XalanDOMCharVectorType& s,
- unsigned int pos)
- {
- return copyEntityIntoBuffer(c_wstr(s), pos);
- }
+ void
+ copyEntityIntoBuffer(const char* s);
+
+ void
+ copyEntityIntoBuffer(const XalanDOMString& s);
+ void
+ copyEntityIntoBuffer(const XalanDOMCharVectorType& s);
+
/**
* Get an ElemDesc instance for the specified name.
*
@@ -376,7 +366,7 @@
* @return a const reference to the ElemDesc instance.
*/
static const ElemDesc&
- getElemDesc(const XalanDOMString& name);
+ getElemDesc(const XalanDOMChar* name);
/**
* Initialize the map of element flags.
@@ -415,6 +405,10 @@
bool m_inBlockElem;
BoolStackType m_isRawStack;
+
+ bool m_isScriptOrStyleElem;
+
+ bool m_isFirstElem;
};
1.11 +1 -0 xml-xalan/c/src/XMLSupport/FormatterToText.cpp
Index: FormatterToText.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToText.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FormatterToText.cpp 2000/10/07 15:25:33 1.10
+++ FormatterToText.cpp 2000/11/02 01:45:51 1.11
@@ -188,6 +188,7 @@
#endif
if (chars[i] > m_maxCharacter)
{
+ //$$$ ToDo: Figure out what we're going to do here...
}
m_writer.write(chars[i]);
1.34 +54 -30 xml-xalan/c/src/XMLSupport/FormatterToXML.cpp
Index: FormatterToXML.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToXML.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- FormatterToXML.cpp 2000/10/11 19:43:04 1.33
+++ FormatterToXML.cpp 2000/11/02 01:45:51 1.34
@@ -158,7 +158,7 @@
catch(const XalanOutputStream::UnsupportedEncodingException&)
{
// Default to UTF-8 if the requested encoding is not supported...
- theStream->setOutputEncoding(XalanTranscodingServices::s_utf8String);
+ theStream->setOutputEncoding(XalanDOMString(XalanTranscodingServices::s_utf8String));
m_encoding = XalanTranscodingServices::s_utf8String;
}
@@ -242,7 +242,7 @@
void
-FormatterToXML::outputDocTypeDecl(const XalanDOMString& name)
+FormatterToXML::outputDocTypeDecl(const XalanDOMChar* name)
{
accum(s_doctypeHeaderStartString); // "<!DOCTYPE "
@@ -303,11 +303,22 @@
void
+FormatterToXML::accum(const char* chars)
+{
+ for(; *chars!= 0; ++chars)
+ {
+ accum(XalanDOMChar(*chars));
+ }
+}
+
+
+
+void
FormatterToXML::accum(const XalanDOMChar* chars)
{
- for(const XalanDOMChar* current = chars; *current != 0; ++current)
+ for(; *chars!= 0; ++chars)
{
- accum(*current);
+ accum(*chars);
}
}
@@ -348,9 +359,9 @@
void
FormatterToXML::throwInvalidUTF16SurrogateException(XalanDOMChar ch)
{
- const XalanDOMString theMessage("Invalid UTF-16 surrogate detected: " +
+ const XalanDOMString theMessage(TranscodeFromLocalCodePage("Invalid UTF-16 surrogate detected: ") +
UnsignedLongToHexDOMString(ch) +
- " ?");
+ TranscodeFromLocalCodePage(" ?"));
throw SAXException(c_wstr(theMessage));
}
@@ -362,10 +373,10 @@
XalanDOMChar ch,
unsigned int next)
{
- const XalanDOMString theMessage("Invalid UTF-16 surrogate detected: " +
+ const XalanDOMString theMessage(TranscodeFromLocalCodePage("Invalid UTF-16 surrogate detected: ") +
UnsignedLongToHexDOMString(ch) +
UnsignedLongToHexDOMString(next) +
- " ?");
+ TranscodeFromLocalCodePage(" ?"));
throw SAXException(c_wstr(theMessage));
}
@@ -572,25 +583,6 @@
if(m_shouldWriteXMLHeader == true)
{
- XalanDOMString encoding = m_encoding;
-
- if(isEmpty(encoding) == true)
- {
- /*
- java:
- try
- {
- encoding = System.getProperty("file.encoding");
- encoding = FormatterToXML.convertJava2MimeEncoding( encoding );
- }
- catch(SecurityException se)
- {
- encoding = "ISO-8859-1";
- }
- */
- encoding = XALAN_STATIC_UCODE_STRING("ISO-8859-1");
- }
-
accum(s_xmlHeaderStartString); // "<?xml version=\""
if (length(m_version) != 0)
@@ -603,7 +595,15 @@
}
accum(s_xmlHeaderEncodingString); // "\" encoding=\""
- accum(encoding);
+
+ if (isEmpty(m_encoding) == true)
+ {
+ accum(XALAN_STATIC_UCODE_STRING("ISO-8859-1"));
+ }
+ else
+ {
+ accum(m_encoding);
+ }
if (length(m_standalone) != 0)
{
@@ -940,7 +940,16 @@
if(i != 0 && i < end - 1)
{
- accum(XALAN_STATIC_UCODE_STRING("<![CDATA["));
+ // "<![CDATA["
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charExclamationMark);
+ accum(XalanUnicode::charLeftSquareBracket);
+ accum(XalanUnicode::charLetter_C);
+ accum(XalanUnicode::charLetter_D);
+ accum(XalanUnicode::charLetter_A);
+ accum(XalanUnicode::charLetter_T);
+ accum(XalanUnicode::charLetter_A);
+ accum(XalanUnicode::charLeftSquareBracket);
}
}
else if(isCData == true &&
@@ -949,7 +958,22 @@
XalanUnicode::charRightSquareBracket == ch[i + 1] &&
XalanUnicode::charGreaterThanSign == ch[ i + 2])
{
- accum(XALAN_STATIC_UCODE_STRING("]]]]><![CDATA[>"));
+ // "]]]]><![CDATA[>"
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charGreaterThanSign);
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charExclamationMark);
+ accum(XalanUnicode::charLeftSquareBracket);
+ accum(XalanUnicode::charLetter_C);
+ accum(XalanUnicode::charLetter_D);
+ accum(XalanUnicode::charLetter_A);
+ accum(XalanUnicode::charLetter_T);
+ accum(XalanUnicode::charLetter_A);
+ accum(XalanUnicode::charLeftSquareBracket);
+ accum(XalanUnicode::charGreaterThanSign);
i += 2;
}
1.20 +11 -2 xml-xalan/c/src/XMLSupport/FormatterToXML.hpp
Index: FormatterToXML.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToXML.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- FormatterToXML.hpp 2000/10/07 15:25:34 1.19
+++ FormatterToXML.hpp 2000/11/02 01:45:51 1.20
@@ -356,12 +356,21 @@
accum(XalanDOMChar ch);
/**
- * Append a mull-termiated array of wide character to
+ * Append a null-terminated array of characters to
* the buffer.
*
* @chars the array to append
*/
void
+ accum(const char* chars);
+
+ /**
+ * Append a null-terminated array of wide characters to
+ * the buffer.
+ *
+ * @chars the array to append
+ */
+ void
accum(const XalanDOMChar* chars);
/**
@@ -654,7 +663,7 @@
* @param name the name of the doctype.
*/
void
- outputDocTypeDecl(const XalanDOMString& name);
+ outputDocTypeDecl(const XalanDOMChar* name);
/**
* Process an attribute.
1.4 +2 -2 xml-xalan/c/src/XMLSupport/FormatterTreeWalker.cpp
Index: FormatterTreeWalker.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterTreeWalker.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FormatterTreeWalker.cpp 2000/04/11 14:43:01 1.3
+++ FormatterTreeWalker.cpp 2000/11/02 01:45:51 1.4
@@ -165,7 +165,7 @@
static_cast<const XalanText*>(node);
#endif
- const XalanDOMString data = theTextNode->getData();
+ const XalanDOMString& data = theTextNode->getData();
m_formatterListener.cdata(c_wstr(data),
length(data));
@@ -181,7 +181,7 @@
static_cast<const XalanText*>(node);
#endif
- const XalanDOMString data = theTextNode->getData();
+ const XalanDOMString& data = theTextNode->getData();
m_formatterListener.characters(c_wstr(data), length(data));
}
1.7 +4 -4 xml-xalan/c/src/XMLSupport/XMLParserLiaison.hpp
Index: XMLParserLiaison.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/XMLParserLiaison.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLParserLiaison.hpp 2000/08/31 19:42:58 1.6
+++ XMLParserLiaison.hpp 2000/11/02 01:45:52 1.7
@@ -120,7 +120,7 @@
*/
virtual XalanDocument*
parseXMLStream(
- InputSource& inputSource,
+ const InputSource& inputSource,
const XalanDOMString& identifier = XalanDOMString()) = 0;
/**
@@ -136,7 +136,7 @@
*/
virtual void
parseXMLStream(
- InputSource& inputSource,
+ const InputSource& inputSource,
DocumentHandler& handler,
const XalanDOMString& identifier = XalanDOMString()) = 0;
@@ -163,7 +163,7 @@
* @param elem DOM element queried
* @return string for expanded name of element
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const = 0;
/**
@@ -172,7 +172,7 @@
* @param attr attribute queried
* @return string for expanded name of attribute
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const = 0;
/**
1.9 +7 -7 xml-xalan/c/src/XMLSupport/XMLParserLiaisonDefault.cpp
Index: XMLParserLiaisonDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/XMLParserLiaisonDefault.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLParserLiaisonDefault.cpp 2000/08/31 19:42:58 1.8
+++ XMLParserLiaisonDefault.cpp 2000/11/02 01:45:52 1.9
@@ -103,10 +103,10 @@
XalanDocument*
XMLParserLiaisonDefault::parseXMLStream(
- InputSource& /* inputSource */,
+ const InputSource& /* inputSource */,
const XalanDOMString& /* identifier */)
{
- throw XMLSupportException("parseXMLStream() not supported in XMLParserLiaisonDefault!");
+ throw XMLSupportException(TranscodeFromLocalCodePage("parseXMLStream() not supported in XMLParserLiaisonDefault!"));
return 0;
}
@@ -115,11 +115,11 @@
void
XMLParserLiaisonDefault::parseXMLStream(
- InputSource& /* inputSource */,
+ const InputSource& /* inputSource */,
DocumentHandler& /* handler */,
const XalanDOMString& /* identifier */)
{
- throw XMLSupportException("parseXMLStream() not supported in XMLParserLiaisonDefault!");
+ throw XMLSupportException(TranscodeFromLocalCodePage("parseXMLStream() not supported in XMLParserLiaisonDefault!"));
}
@@ -127,7 +127,7 @@
XalanDocument*
XMLParserLiaisonDefault::createDocument()
{
- throw XMLSupportException("createDocument() not supported in XMLParserLiaisonDefault!");
+ throw XMLSupportException(TranscodeFromLocalCodePage("createDocument() not supported in XMLParserLiaisonDefault!"));
return 0;
}
@@ -145,7 +145,7 @@
/**
* Returns the element name with the namespace expanded.
*/
-XalanDOMString
+const XalanDOMString&
XMLParserLiaisonDefault::getExpandedElementName(const XalanElement& elem) const
{
return m_DOMSupport.getExpandedElementName(elem);
@@ -156,7 +156,7 @@
/**
* Returns the attribute name with the namespace expanded.
*/
-XalanDOMString
+const XalanDOMString&
XMLParserLiaisonDefault::getExpandedAttributeName(const XalanAttr& attr) const
{
return m_DOMSupport.getExpandedAttributeName(attr);
1.6 +4 -4 xml-xalan/c/src/XMLSupport/XMLParserLiaisonDefault.hpp
Index: XMLParserLiaisonDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/XMLParserLiaisonDefault.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLParserLiaisonDefault.hpp 2000/08/31 19:42:58 1.5
+++ XMLParserLiaisonDefault.hpp 2000/11/02 01:45:52 1.6
@@ -103,12 +103,12 @@
virtual XalanDocument*
parseXMLStream(
- InputSource& inputSource,
+ const InputSource& inputSource,
const XalanDOMString& identifier = XalanDOMString());
virtual void
parseXMLStream(
- InputSource& inputSource,
+ const InputSource& inputSource,
DocumentHandler& handler,
const XalanDOMString& identifier = XalanDOMString());
@@ -118,10 +118,10 @@
virtual XalanDocument*
getDOMFactory();
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
virtual const XalanDOMString&
1.1 xml-xalan/c/src/XMLSupport/FormatterToNull.cpp
Index: FormatterToNull.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file
#include "FormatterToNull.hpp"
FormatterToNull::FormatterToNull() :
FormatterListener(OUTPUT_METHOD_NONE)
{
}
FormatterToNull::~FormatterToNull()
{
}
void
FormatterToNull::setDocumentLocator(const Locator* const /* locator */)
{
}
void
FormatterToNull::startDocument()
{
}
void
FormatterToNull::endDocument()
{
}
void
FormatterToNull::startElement(
const XMLCh* const /* name */,
AttributeList& /* attrs */)
{
}
void
FormatterToNull::endElement(
const XMLCh* const /* name */)
{
}
void
FormatterToNull::characters(
const XMLCh* const /* chars */,
const unsigned int /* length */)
{
}
void
FormatterToNull::charactersRaw(
const XMLCh* const /* chars */,
const unsigned int /*length */)
{
}
void
FormatterToNull::entityReference(const XMLCh* const /* name */)
{
}
void
FormatterToNull::ignorableWhitespace(
const XMLCh* const /* chars */,
const unsigned int /* length */)
{
}
void
FormatterToNull::processingInstruction(
const XMLCh* const /* target */,
const XMLCh* const /* data */)
{
}
void
FormatterToNull::resetDocument()
{
}
void
FormatterToNull::comment(const XMLCh* const /* data */)
{
}
void
FormatterToNull::cdata(
const XMLCh* const /* ch */,
const unsigned int /* length */)
{
}
1.1 xml-xalan/c/src/XMLSupport/FormatterToNull.hpp
Index: FormatterToNull.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(FORMATTERTONULL_HEADER_GUARD_1357924680)
#define FORMATTERTONULL_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <XMLSupport/XMLSupportDefinitions.hpp>
// Base class header file.
#include <XMLSupport/FormatterListener.hpp>
/**
* This class takes SAX events (in addition to some extra events
* that SAX doesn't handle yet) and produces absolutely nothing.
* This is useful for profiling situations where serialization
* obscures things.
*/
class XALAN_XMLSUPPORT_EXPORT FormatterToNull : public FormatterListener
{
public:
/**
* FormatterToNull instance constructor.
*/
explicit
FormatterToNull();
virtual
~FormatterToNull();
// These methods are inherited from FormatterListener ...
virtual void
setDocumentLocator(const Locator* const locator);
virtual void
startDocument();
virtual void
endDocument();
virtual void
startElement(
const XMLCh* const name,
AttributeList& attrs);
virtual void
endElement(const XMLCh* const name);
virtual void
characters(
const XMLCh* const chars,
const unsigned int length);
virtual void
charactersRaw(
const XMLCh* const chars,
const unsigned int length);
virtual void
entityReference(const XMLCh* const name);
virtual void
ignorableWhitespace(
const XMLCh* const chars,
const unsigned int length);
virtual void
processingInstruction(
const XMLCh* const target,
const XMLCh* const data);
virtual void
resetDocument();
virtual void
comment(const XMLCh* const data);
virtual void
cdata(
const XMLCh* const ch,
const unsigned int length);
private:
// These are not implemented.
FormatterToNull(const FormatterToNull&);
FormatterToNull&
operator=(const FormatterToNull&);
bool
operator==(const FormatterToNull&) const;
};
#endif // FORMATTERTONULL_HEADER_GUARD_1357924680
1.4 +22 -10 xml-xalan/c/src/XPath/ElementPrefixResolverProxy.cpp
Index: ElementPrefixResolverProxy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ElementPrefixResolverProxy.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElementPrefixResolverProxy.cpp 2000/04/11 14:46:03 1.3
+++ ElementPrefixResolverProxy.cpp 2000/11/02 01:45:56 1.4
@@ -63,18 +63,27 @@
+#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include "XPathEnvSupport.hpp"
#include "XPathSupport.hpp"
+const XalanDOMString ElementPrefixResolverProxy::s_emptyString;
+
+
+
ElementPrefixResolverProxy::ElementPrefixResolverProxy(
const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const XPathSupport& support) :
m_namespaceContext(namespaceContext),
m_envSupport(envSupport),
- m_support(support)
+ m_support(support),
+ m_uri()
{
}
@@ -86,12 +95,12 @@
-XalanDOMString
+const XalanDOMString&
ElementPrefixResolverProxy::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
if (m_namespaceContext == 0)
{
- return XalanDOMString();
+ return s_emptyString;
}
else
{
@@ -101,15 +110,18 @@
-XalanDOMString
+const XalanDOMString&
ElementPrefixResolverProxy::getURI() const
{
- if (m_namespaceContext == 0)
+ if (m_namespaceContext != 0 && length(m_uri) == 0)
{
- return XalanDOMString();
+#if defined(XALAN_NO_MUTABLE)
+ ((ElementPrefixResolverProxy*)this)->m_uri =
+#else
+ m_uri =
+#endif
+ m_envSupport.findURIFromDoc(m_namespaceContext->getOwnerDocument());
}
- else
- {
- return m_envSupport.findURIFromDoc(m_namespaceContext->getOwnerDocument());
- }
+
+ return m_uri;
}
1.5 +16 -5 xml-xalan/c/src/XPath/ElementPrefixResolverProxy.hpp
Index: ElementPrefixResolverProxy.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ElementPrefixResolverProxy.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElementPrefixResolverProxy.hpp 2000/04/11 14:46:03 1.4
+++ ElementPrefixResolverProxy.hpp 2000/11/02 01:45:56 1.5
@@ -69,6 +69,10 @@
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class XPathEnvSupport;
class XPathSupport;
class XalanElement;
@@ -96,17 +100,24 @@
// These methods are inherited from PrefixResolver ...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getURI() const;
private:
+
+ const XalanElement* const m_namespaceContext;
+
+ const XPathEnvSupport& m_envSupport;
+
+ const XPathSupport& m_support;
+
+ mutable XalanDOMString m_uri;
- const XalanElement* const m_namespaceContext;
- const XPathEnvSupport& m_envSupport;
- const XPathSupport& m_support;
+ // A dummy string to return when we need an emtpy string...
+ static const XalanDOMString s_emptyString;
};
1.5 +21 -2 xml-xalan/c/src/XPath/FunctionConcat.hpp
Index: FunctionConcat.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionConcat.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionConcat.hpp 2000/04/11 14:46:04 1.4
+++ FunctionConcat.hpp 2000/11/02 01:45:56 1.5
@@ -111,11 +111,30 @@
context);
}
+ unsigned int theCombinedLength = 0;
+
+ const XObjectArgVectorType::const_iterator theEnd = args.end();
+
+ {
+ XObjectArgVectorType::const_iterator i = args.begin();
+
+ for(; i != theEnd; ++i)
+ {
+ theCombinedLength += length((*i)->str());
+ }
+ }
+
XalanDOMString theResult;
+
+ reserve(theResult, theCombinedLength + 1);
- for(XObjectArgVectorType::size_type i = 0; i < theArgCount; i++)
{
- theResult += args[i]->str();
+ XObjectArgVectorType::const_iterator i = args.begin();
+
+ for(; i != theEnd; ++i)
+ {
+ theResult += (*i)->str();
+ }
}
return executionContext.getXObjectFactory().createString(theResult);
1.15 +3 -2 xml-xalan/c/src/XPath/FunctionID.hpp
Index: FunctionID.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionID.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- FunctionID.hpp 2000/10/12 13:53:11 1.14
+++ FunctionID.hpp 2000/11/02 01:45:56 1.15
@@ -84,6 +84,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -282,9 +283,9 @@
for (unsigned int i = 0 ; i < theNodeCount; i++)
{
- m_resultString += m_executionContext.getNodeData(*theValue.item(i));
+ m_executionContext.getNodeData(*theValue.item(i), m_resultString);
- m_resultString += " ";
+ append(m_resultString, XalanUnicode::charSpace);
}
}
1.9 +1 -1 xml-xalan/c/src/XPath/FunctionLang.hpp
Index: FunctionLang.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLang.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FunctionLang.hpp 2000/09/19 14:53:46 1.8
+++ FunctionLang.hpp 2000/11/02 01:45:57 1.9
@@ -133,7 +133,7 @@
#endif
const XalanDOMString langVal =
- theElementNode->getAttribute(XALAN_STATIC_UCODE_STRING("xml:lang"));
+ theElementNode->getAttribute(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("xml:lang")));
if(0 != length(langVal))
{
1.9 +29 -14 xml-xalan/c/src/XPath/FunctionLocalName.hpp
Index: FunctionLocalName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLocalName.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FunctionLocalName.hpp 2000/08/28 01:15:40 1.8
+++ FunctionLocalName.hpp 2000/11/02 01:45:57 1.9
@@ -113,7 +113,7 @@
context);
}
- XalanDOMString theData;
+ XObject* theResult = 0;
if (theSize == 0)
{
@@ -121,6 +121,10 @@
{
executionContext.error("The local-name() function requires a non-null context node!");
}
+ else
+ {
+ theResult = getLocalName(executionContext, *context);
+ }
}
else
{
@@ -128,25 +132,17 @@
const NodeRefListBase& theNodeList = args[0]->nodeset();
- if (theNodeList.getLength() > 0)
+ if (theNodeList.getLength() == 0)
{
- context = theNodeList.item(0);
+ theResult = executionContext.getXObjectFactory().createString(XalanDOMString());
}
- }
-
- if (context != 0)
- {
- const XalanNode::NodeType theType = context->getNodeType();
-
- if(theType == XalanNode::ATTRIBUTE_NODE ||
- theType == XalanNode::ELEMENT_NODE ||
- theType == XalanNode::PROCESSING_INSTRUCTION_NODE)
+ else
{
- theData = executionContext.getLocalNameOfNode(*context);
+ theResult = getLocalName(executionContext, *theNodeList.item(0));
}
}
- return executionContext.getXObjectFactory().createString(theData);
+ return theResult;
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
@@ -160,6 +156,25 @@
}
private:
+
+ XObject*
+ getLocalName(
+ XPathExecutionContext& executionContext,
+ const XalanNode& node)
+ {
+ const XalanNode::NodeType theType = node.getNodeType();
+
+ if(theType == XalanNode::ATTRIBUTE_NODE ||
+ theType == XalanNode::ELEMENT_NODE ||
+ theType == XalanNode::PROCESSING_INSTRUCTION_NODE)
+ {
+ return executionContext.getXObjectFactory().createString(executionContext.getLocalNameOfNode(node));
+ }
+ else
+ {
+ return executionContext.getXObjectFactory().createString(XalanDOMString());
+ }
+ }
// Not implemented...
FunctionLocalName&
1.7 +38 -5 xml-xalan/c/src/XPath/FunctionName.hpp
Index: FunctionName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionName.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FunctionName.hpp 2000/06/01 16:27:23 1.6
+++ FunctionName.hpp 2000/11/02 01:45:57 1.7
@@ -79,6 +79,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/NodeRefListBase.hpp>
#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
@@ -108,7 +112,7 @@
{
const XObjectArgVectorType::size_type theSize = args.size();
- XalanDOMString theResult;
+ XObject* theResult = 0;
if(theSize == 0)
{
@@ -119,7 +123,7 @@
}
else
{
- theResult = executionContext.getNameOfNode(*context);
+ theResult = getName(executionContext, *context);
}
}
else if (theSize == 1)
@@ -128,11 +132,15 @@
const NodeRefListBase& theNodeList = args[0]->nodeset();
- if (theNodeList.getLength() != 0)
+ if (theNodeList.getLength() == 0)
+ {
+ theResult = executionContext.getXObjectFactory().createString(XalanDOMString());
+ }
+ else
{
assert(theNodeList.item(0) != 0);
- theResult = executionContext.getNameOfNode(*theNodeList.item(0));
+ theResult = getName(executionContext, *theNodeList.item(0));
}
}
else
@@ -141,7 +149,9 @@
context);
}
- return executionContext.getXObjectFactory().createString(theResult);
+ assert(theResult != 0);
+
+ return theResult;
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
@@ -155,6 +165,29 @@
}
private:
+
+ XObject*
+ getName(
+ XPathExecutionContext& executionContext,
+ const XalanNode& node)
+ {
+// if (node.getNodeType() == XalanNode::ATTRIBUTE_NODE)
+// {
+// const XalanDOMString& theName = executionContext.getNameOfNode(node);
+
+// if (startsWith(theName, DOMServices::s_XMLNamespaceWithSeparator) == true)
+// {
+// }
+// else
+// {
+// return executionContext.getXObjectFactory().createString();
+// }
+// }
+// else
+ {
+ return executionContext.getXObjectFactory().createString(executionContext.getNameOfNode(node));
+ }
+ }
// Not implemented...
FunctionName&
1.7 +10 -8 xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp
Index: FunctionNamespaceURI.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FunctionNamespaceURI.hpp 2000/08/14 16:33:54 1.6
+++ FunctionNamespaceURI.hpp 2000/11/02 01:45:57 1.7
@@ -100,7 +100,7 @@
int /* opPos */,
const XObjectArgVectorType& args)
{
- XalanDOMString theNamespace;
+ const XalanDOMString* theNamespace = 0;
if (args.size() > 1)
{
@@ -137,7 +137,7 @@
executionContext);
}
- return executionContext.getXObjectFactory().createString(theNamespace);
+ return executionContext.getXObjectFactory().createString(theNamespace == 0 ? XalanDOMString() : *theNamespace);
}
virtual Function*
@@ -148,20 +148,22 @@
private:
- static XalanDOMString
+ static const XalanDOMString*
getNamespaceFromNodeSet(const XObject& theXObject,
XPathExecutionContext& theContext)
{
- XalanDOMString theNamespace;
-
const NodeRefListBase& theList = theXObject.nodeset();
- if (theList.getLength() > 0)
+ if (theList.getLength() == 0)
{
- theNamespace = theContext.getNamespaceOfNode(*theList.item(0));
+ return 0;
}
+ else
+ {
+ assert(theList.item(0) != 0);
- return theNamespace;
+ return &theContext.getNamespaceOfNode(*theList.item(0));
+ }
}
// Not implemented...
1.9 +31 -21 xml-xalan/c/src/XPath/FunctionNormalize.hpp
Index: FunctionNormalize.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNormalize.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FunctionNormalize.hpp 2000/10/11 19:43:05 1.8
+++ FunctionNormalize.hpp 2000/11/02 01:45:58 1.9
@@ -105,23 +105,46 @@
{
executionContext.error("The normalize-space() function takes zero arguments or one argument!",
context);
+
+ // Dummy return...
+ return 0;
}
else if (args.size() == 1)
{
- theSourceString = args[0]->str();
+ return normalize(executionContext, args[0]->str());
}
else if (context == 0)
{
executionContext.error("The normalize-space() function requires a non-null context node!",
context);
+
+ // Dummy return...
+ return 0;
}
else
{
- theSourceString = getDefaultStringArgument(executionContext,
- *context);
+ return normalize(executionContext, getDefaultStringArgument(executionContext, *context));
}
+ }
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual Function*
+#else
+ virtual FunctionNormalizeSpace*
+#endif
+ clone() const
+ {
+ return new FunctionNormalizeSpace(*this);
+ }
+
+private:
- const unsigned int theSourceStringLength = length(theSourceString);
+ XObject*
+ normalize(
+ XPathExecutionContext& executionContext,
+ const XalanDOMString& theString)
+ {
+ const unsigned int theStringLength = length(theString);
XalanDOMChar thePreviousChar = 0;
@@ -134,14 +157,13 @@
vector<XalanDOMChar> theVector;
// The result string can only be as large as the source string, so
- // just reserve the space now. Also reserve a space for the
- // terminating 0.
- theVector.reserve(theSourceStringLength + 1);
+ // just reserve the space now.
+ theVector.reserve(theStringLength);
// OK, strip out any multiple spaces...
- for (unsigned int i = 0; i < theSourceStringLength; i++)
+ for (unsigned int i = 0; i < theStringLength; i++)
{
- const XalanDOMChar theCurrentChar = charAt(theSourceString, i);
+ const XalanDOMChar theCurrentChar = charAt(theString, i);
if (isXMLWhitespace(theCurrentChar) == true)
{
@@ -169,18 +191,6 @@
return executionContext.getXObjectFactory().createString(XalanDOMString(theVector.begin(), theVector.size()));
}
-
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual Function*
-#else
- virtual FunctionNormalizeSpace*
-#endif
- clone() const
- {
- return new FunctionNormalizeSpace(*this);
- }
-
-private:
// Not implemented...
FunctionNormalizeSpace&
1.7 +5 -1 xml-xalan/c/src/XPath/FunctionSum.hpp
Index: FunctionSum.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSum.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FunctionSum.hpp 2000/07/13 22:22:31 1.6
+++ FunctionSum.hpp 2000/11/02 01:45:58 1.7
@@ -119,7 +119,11 @@
for (unsigned int i = 0; i < count; i++)
{
- sum += DoubleSupport::toDouble(executionContext.getNodeData(*nl.item(i)));
+ XalanDOMString theData;
+
+ executionContext.getNodeData(*nl.item(i), theData);
+
+ sum += DoubleSupport::toDouble(theData);
}
return executionContext.getXObjectFactory().createNumber(sum);
1.6 +15 -4 xml-xalan/c/src/XPath/NameSpace.hpp
Index: NameSpace.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NameSpace.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NameSpace.hpp 2000/08/28 01:16:16 1.5
+++ NameSpace.hpp 2000/11/02 01:45:58 1.6
@@ -76,6 +76,13 @@
{
public:
+ explicit
+ NameSpace() :
+ m_prefix(),
+ m_uri()
+ {
+ }
+
/**
* Construct a namespace for placement on the
* result tree namespace stack.
@@ -84,10 +91,14 @@
* @param uri URI of namespace
*/
NameSpace(
- const XalanDOMString& prefix = XalanDOMString(),
- const XalanDOMString& uri = XalanDOMString()) :
- m_prefix(prefix),
- m_uri(uri)
+ const XalanDOMString& prefix,
+ const XalanDOMString& uri) :
+ m_prefix(prefix),
+ m_uri(uri)
+ {
+ }
+
+ ~NameSpace()
{
}
1.5 +2 -2 xml-xalan/c/src/XPath/PrefixResolver.hpp
Index: PrefixResolver.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/PrefixResolver.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PrefixResolver.hpp 2000/04/11 14:46:10 1.4
+++ PrefixResolver.hpp 2000/11/02 01:45:58 1.5
@@ -89,7 +89,7 @@
* @param prefix Prefix to resolve
* @return namespace that prefix resolves to, or null if prefix is not found
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const = 0;
/**
@@ -97,7 +97,7 @@
*
* @return URI string
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getURI() const = 0;
};
1.12 +64 -23 xml-xalan/c/src/XPath/QName.cpp
Index: QName.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- QName.cpp 2000/09/05 02:24:50 1.11
+++ QName.cpp 2000/11/02 01:45:58 1.12
@@ -80,6 +80,14 @@
+QName::QName() :
+ m_namespace(),
+ m_localpart()
+{
+}
+
+
+
QName::QName(
const XalanDOMString& theNamespace,
const XalanDOMString& theLocalPart) :
@@ -96,22 +104,20 @@
m_namespace(),
m_localpart()
{
- const unsigned int indexOfNSSep = indexOf(qname, XalanUnicode::charColon);
+ initialize(c_wstr(qname), namespaces);
+}
- if(indexOfNSSep < length(qname))
- {
- const XalanDOMString prefix = substring(qname, 0, indexOfNSSep);
- if(::equals(prefix, DOMServices::s_XMLNamespace))
- return;
- m_namespace = getNamespaceForPrefix(namespaces, prefix);
- if(0 == length(m_namespace))
- {
- throw XSLException(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
- }
- m_localpart = substring(qname, indexOfNSSep + 1);
- }
- else
- m_localpart = qname;
+
+
+QName::QName(
+ const XalanDOMChar* qname,
+ const NamespacesStackType& namespaces) :
+ m_namespace(),
+ m_localpart()
+{
+ assert(qname != 0);
+
+ initialize(qname, namespaces);
}
@@ -158,6 +164,31 @@
void
+QName::initialize(
+ const XalanDOMChar* qname,
+ const NamespacesStackType& namespaces)
+{
+ const unsigned int indexOfNSSep = indexOf(qname, XalanUnicode::charColon);
+
+ if(indexOfNSSep < length(qname))
+ {
+ const XalanDOMString prefix = substring(qname, 0, indexOfNSSep);
+ if(::equals(prefix, DOMServices::s_XMLNamespace))
+ return;
+ m_namespace = getNamespaceForPrefix(namespaces, prefix);
+ if(0 == length(m_namespace))
+ {
+ throw XSLException(TranscodeFromLocalCodePage("Prefix must resolve to a namespace: ") + prefix);
+ }
+ m_localpart = substring(qname, indexOfNSSep + 1);
+ }
+ else
+ m_localpart = qname;
+}
+
+
+
+void
QName::resolvePrefix(
const XalanDOMString& qname,
const PrefixResolver& theResolver)
@@ -185,7 +216,7 @@
if(0 == length(m_namespace))
{
- throw XSLException(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
+ throw XSLException(TranscodeFromLocalCodePage("Prefix must resolve to a namespace: ") + prefix);
}
}
else
@@ -216,8 +247,10 @@
{
for(int j = namespaces.size()-1; j >= 0; j--)
{
- const NameSpace& ns = namespaces[j];
- const XalanDOMString& thisPrefix = ns.getPrefix();
+ const NameSpace& ns = namespaces[j];
+
+ const XalanDOMString& thisPrefix = ns.getPrefix();
+
if(::equals(prefix, thisPrefix))
{
nsURI = &ns.getURI();
@@ -230,8 +263,10 @@
{
for(unsigned int j = 0; j < namespaces.size(); j++)
{
- const NameSpace& ns = namespaces[j];
- const XalanDOMString& thisPrefix = ns.getPrefix();
+ const NameSpace& ns = namespaces[j];
+
+ const XalanDOMString& thisPrefix = ns.getPrefix();
+
if(::equals(prefix, thisPrefix))
{
nsURI = &ns.getURI();
@@ -261,8 +296,10 @@
for(int i = depth-1; i >= 0; i--)
{
- const NamespaceVectorType& namespaces = nsStack[i];
+ const NamespaceVectorType& namespaces = nsStack[i];
+
nsURI = &QName::getNamespaceForPrefix(namespaces, prefix, reverse);
+
if (! ::isEmpty(*nsURI))
break;
}
@@ -316,8 +353,10 @@
{
for(int i = depth-1; i >= 0; i--)
{
- const NamespaceVectorType& namespaces = nsStack[i];
+ const NamespaceVectorType& namespaces = nsStack[i];
+
thePrefix = &QName::getPrefixForNamespace(namespaces, uri, reverse);
+
if (! ::isEmpty(*thePrefix))
break;
}
@@ -326,8 +365,10 @@
{
for(int i = 0; i < depth; i++)
{
- const NamespaceVectorType& namespaces = nsStack[i];
+ const NamespaceVectorType& namespaces = nsStack[i];
+
thePrefix = &QName::getPrefixForNamespace(namespaces, uri, reverse);
+
if (! ::isEmpty(*thePrefix))
break;
}
1.10 +31 -8 xml-xalan/c/src/XPath/QName.hpp
Index: QName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- QName.hpp 2000/08/28 01:17:16 1.9
+++ QName.hpp 2000/11/02 01:45:59 1.10
@@ -64,7 +64,7 @@
-#include <vector>
+#include <deque>
@@ -104,22 +104,29 @@
public:
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<NameSpace> NamespaceVectorType;
- typedef vector<NamespaceVectorType> NamespacesStackType;
+ typedef deque<NameSpace> NamespaceVectorType;
+ typedef deque<NamespaceVectorType> NamespacesStackType;
#else
- typedef std::vector<NameSpace> NamespaceVectorType;
- typedef std::vector<NamespaceVectorType> NamespacesStackType;
+ typedef std::deque<NameSpace> NamespaceVectorType;
+ typedef std::deque<NamespaceVectorType> NamespacesStackType;
#endif
/**
+ * Construct an empty QName.
+ *
+ */
+ explicit
+ QName();
+
+ /**
* Construct a QName, with the supplied namespace and local part.
*
* @param theNamespace namespace string
* @param theLocalPart local part string
*/
QName(
- const XalanDOMString& theNamespace = XalanDOMString(),
- const XalanDOMString& theLocalPart = XalanDOMString());
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& theLocalPart);
/**
* Construct a QName from a string, resolving the prefix using the given
@@ -134,6 +141,17 @@
/**
* Construct a QName from a string, resolving the prefix using the given
+ * namespace vector stack. The default namespace is not resolved.
+ *
+ * @param qname QName string
+ * @param namespaces namespace vector stack to use
+ */
+ QName(
+ const XalanDOMChar* qname,
+ const NamespacesStackType& namespaces);
+
+ /**
+ * Construct a QName from a string, resolving the prefix using the given
* namespace context. The default namespace is not resolved.
*
* @param qname QName string
@@ -272,8 +290,13 @@
private:
void
+ initialize(
+ const XalanDOMChar* qname,
+ const NamespacesStackType& namespaces);
+
+ void
resolvePrefix(
- const XalanDOMString& qname,
+ const XalanDOMString& qname,
const PrefixResolver& theResolver);
XalanDOMString m_namespace;
1.10 +14 -18 xml-xalan/c/src/XPath/ResultTreeFrag.cpp
Index: ResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ResultTreeFrag.cpp 2000/08/10 18:37:30 1.9
+++ ResultTreeFrag.cpp 2000/11/02 01:45:59 1.10
@@ -68,6 +68,10 @@
+const XalanDOMString ResultTreeFrag::s_emptyString;
+
+
+
ResultTreeFrag::ResultTreeFrag(XalanDocument& theOwnerDocument) :
ResultTreeFragBase(),
XalanNodeList(),
@@ -107,18 +111,18 @@
-XalanDOMString
+const XalanDOMString&
ResultTreeFrag::getNodeName() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
ResultTreeFrag::getNodeValue() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -359,26 +363,26 @@
-XalanDOMString
+const XalanDOMString&
ResultTreeFrag::getNamespaceURI() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
ResultTreeFrag::getPrefix() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
ResultTreeFrag::getLocalName() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -402,14 +406,6 @@
ResultTreeFrag::getIndex() const
{
return 0;
-}
-
-
-
-XalanDOMString
-ResultTreeFrag::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
}
1.10 +7 -8 xml-xalan/c/src/XPath/ResultTreeFrag.hpp
Index: ResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ResultTreeFrag.hpp 2000/08/10 18:37:31 1.9
+++ ResultTreeFrag.hpp 2000/11/02 01:45:59 1.10
@@ -109,10 +109,10 @@
// These interfaces are inherited from XalanDocumentFragment...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
virtual NodeType
@@ -179,13 +179,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
virtual void
@@ -197,9 +197,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual ResultTreeFragBase*
#else
@@ -234,6 +231,8 @@
#endif
NodeVectorType m_children;
+
+ static const XalanDOMString s_emptyString;
};
1.9 +5 -8 xml-xalan/c/src/XPath/ResultTreeFragBase.hpp
Index: ResultTreeFragBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFragBase.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ResultTreeFragBase.hpp 2000/08/10 18:37:31 1.8
+++ ResultTreeFragBase.hpp 2000/11/02 01:45:59 1.9
@@ -100,10 +100,10 @@
// These interfaces are inherited from XalanDocumentFragment...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
virtual NodeType
@@ -170,13 +170,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
virtual void
@@ -187,9 +187,6 @@
virtual unsigned long
getIndex() const = 0;
-
- virtual XalanDOMString
- getXSLTData() const = 0;
virtual ResultTreeFragBase*
clone(bool deep) const = 0;
1.26 +8 -7 xml-xalan/c/src/XPath/SimpleNodeLocator.cpp
Index: SimpleNodeLocator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- SimpleNodeLocator.cpp 2000/10/05 16:07:31 1.25
+++ SimpleNodeLocator.cpp 2000/11/02 01:45:59 1.26
@@ -493,7 +493,8 @@
score = xpath.s_MatchScoreNone;
- executionContext.error("unknown match operation!", localContext);
+ executionContext.error(TranscodeFromLocalCodePage("unknown match operation!"), localContext);
+
break;
}
@@ -1364,7 +1365,7 @@
const int argLen =
currentExpression.getOpCodeMapValue(opPos + XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
- executionContext.error("unknown axis: " + stepType, context);
+ executionContext.error(TranscodeFromLocalCodePage("Unknown axis!"), context);
return argLen + 3;
}
@@ -1432,7 +1433,7 @@
}
else
{
- executionContext.error("Arg length of processing-instruction() node test is incorrect!");
+ executionContext.error(TranscodeFromLocalCodePage("Arg length of processing-instruction() node test is incorrect!"));
}
}
@@ -1497,7 +1498,7 @@
if(isTotallyWild == false && processNamespaces == true)
{
- const XalanDOMString contextNS = executionContext.getNamespaceOfNode(*context);
+ const XalanDOMString& contextNS = executionContext.getNamespaceOfNode(*context);
if(0 != length(targetNS) && 0 != length(contextNS))
{
@@ -1531,7 +1532,7 @@
{
assert(context->getNodeType() == XalanNode::ATTRIBUTE_NODE);
- const XalanDOMString attrName =
+ const XalanDOMString& attrName =
context->getNodeName();
const bool isNamespace =
@@ -1561,7 +1562,7 @@
{
if (isNamespace == false)
{
- const XalanDOMString localAttrName =
+ const XalanDOMString& localAttrName =
executionContext.getLocalNameOfNode(*context);
if (equals(localAttrName, targetLocalName) == true)
@@ -1582,7 +1583,7 @@
#endif
assert(theAttrNode != 0);
- const XalanDOMString theNamespace =
+ const XalanDOMString& theNamespace =
theAttrNode->getValue();
if (equals(theNamespace, targetLocalName) == true)
1.18 +6 -2 xml-xalan/c/src/XPath/XNodeSet.cpp
Index: XNodeSet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XNodeSet.cpp 2000/10/12 13:53:11 1.17
+++ XNodeSet.cpp 2000/11/02 01:46:00 1.18
@@ -68,6 +68,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include "ResultTreeFrag.hpp"
#include "MutableNodeRefList.hpp"
#include "XObjectTypeCallback.hpp"
@@ -174,9 +178,9 @@
else
{
#if defined(XALAN_NO_MUTABLE)
- ((XNodeSet*)this)->m_cachedStringValue = theNode->getXSLTData();
+ DOMServices::getNodeData(*theNode, ((XNodeSet*)this)->m_cachedStringValue);
#else
- m_cachedStringValue = theNode->getXSLTData();
+ DOMServices::getNodeData(*theNode, m_cachedStringValue);
#endif
}
}
1.16 +1 -1 xml-xalan/c/src/XPath/XNodeSet.hpp
Index: XNodeSet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XNodeSet.hpp 2000/09/19 14:56:03 1.15
+++ XNodeSet.hpp 2000/11/02 01:46:00 1.16
@@ -70,7 +70,7 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
1.13 +59 -15 xml-xalan/c/src/XPath/XObject.cpp
Index: XObject.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XObject.cpp 2000/09/27 16:39:35 1.12
+++ XObject.cpp 2000/11/02 01:46:00 1.13
@@ -106,7 +106,7 @@
double
XObject::num() const
{
- throw XObjectInvalidCastException(getTypeString(), XALAN_STATIC_UCODE_STRING("number"));
+ throw XObjectInvalidCastException(getTypeString(), TranscodeFromLocalCodePage("number"));
// This is just a dummy value to satisfy the compiler.
return 0.0;
@@ -117,7 +117,7 @@
bool
XObject::boolean() const
{
- throw XObjectInvalidCastException(getTypeString(), XALAN_STATIC_UCODE_STRING("boolean"));
+ throw XObjectInvalidCastException(getTypeString(), TranscodeFromLocalCodePage("boolean"));
// This is just a dummy value to satisfy the compiler.
return false;
@@ -128,7 +128,7 @@
const XalanDOMString&
XObject::str() const
{
- throw XObjectInvalidCastException(getTypeString(), XALAN_STATIC_UCODE_STRING("string"));
+ throw XObjectInvalidCastException(getTypeString(), TranscodeFromLocalCodePage("string"));
// This is just a dummy value to satisfy the compiler.
return s_nullString;
@@ -139,7 +139,7 @@
const ResultTreeFragBase&
XObject::rtree(XPathExecutionContext& /* executionContext */) const
{
- throw XObjectInvalidCastException(getTypeString(), XALAN_STATIC_UCODE_STRING("result tree fragment"));
+ throw XObjectInvalidCastException(getTypeString(), TranscodeFromLocalCodePage("result tree fragment"));
// This is just a dummy value to satisfy the compiler.
#if defined(XALAN_OLD_STYLE_CASTS)
@@ -158,7 +158,7 @@
const NodeRefListBase&
XObject::nodeset() const
{
- throw XObjectInvalidCastException(getTypeString(), XALAN_STATIC_UCODE_STRING("node set"));
+ throw XObjectInvalidCastException(getTypeString(), TranscodeFromLocalCodePage("node set"));
// error will throw, so this is just a dummy
// value to satisfy the compiler.
@@ -167,10 +167,12 @@
-const XalanDOMString
-getStringFromNode(const XalanNode& theNode)
+void
+getStringFromNode(
+ const XalanNode& theNode,
+ XalanDOMString& theString)
{
- return theNode.getXSLTData();
+ DOMServices::getNodeData(theNode, theString);
}
@@ -185,7 +187,19 @@
const XalanDOMString
operator()(const XalanNode& theNode) const
{
- return getStringFromNode(theNode);
+ XalanDOMString theString;
+
+ getStringFromNode(theNode, theString);
+
+ return theString;
+ }
+
+ void
+ operator()(
+ const XalanNode& theNode,
+ XalanDOMString& theString) const
+ {
+ getStringFromNode(theNode, theString);
}
};
@@ -193,8 +207,26 @@
double
getNumberFromNode(const XalanNode& theNode)
+{
+ XalanDOMString theString;
+
+ getStringFromNode(theNode, theString);
+
+ return DoubleSupport::toDouble(theString);
+}
+
+
+
+void
+getNumberFromNode(
+ const XalanNode& theNode,
+ double& theNumber)
{
- return DoubleSupport::toDouble(getStringFromNode(theNode));
+ XalanDOMString theString;
+
+ getStringFromNode(theNode, theString);
+
+ theNumber = DoubleSupport::toDouble(theString);
}
@@ -211,6 +243,14 @@
{
return getNumberFromNode(theNode);
}
+
+ void
+ operator()(
+ const XalanNode& theNode,
+ double& theNumber) const
+ {
+ getNumberFromNode(theNode, theNumber);
+ }
};
@@ -245,18 +285,20 @@
{
const XalanNode* const theLHSNode = theLHSNodeSet.item(i);
assert(theLHSNode != 0);
+
+ XalanDOMString s1;
- const XalanDOMString s1 =
- theTypeFunction(*theLHSNode);
+ theTypeFunction(*theLHSNode, s1);
for(unsigned int k = 0; k < len2 && theResult == false; k++)
{
const XalanNode* const theRHSNode = theRHSNodeSet.item(k);
assert(theRHSNode != 0);
- const XalanDOMString s2 =
- theTypeFunction(*theRHSNode);
+ XalanDOMString s2;
+ theTypeFunction(*theRHSNode, s2);
+
if(theCompareFunction(s1, s2) == true)
{
theResult = true;
@@ -285,8 +327,10 @@
{
const XalanNode* const theLHSNode = theLHSNodeSet.item(i);
assert(theLHSNode != 0);
+
+ Type theLHS;
- const Type theLHS = theTypeFunction(*theLHSNode);
+ theTypeFunction(*theLHSNode, theLHS);
if (theCompareFunction(theLHS, theRHS) == true)
{
1.14 +1 -1 xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp
Index: XObjectFactoryDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XObjectFactoryDefault.hpp 2000/10/13 21:20:52 1.13
+++ XObjectFactoryDefault.hpp 2000/11/02 01:46:00 1.14
@@ -86,7 +86,7 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
1.31 +8 -8 xml-xalan/c/src/XPath/XPath.cpp
Index: XPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- XPath.cpp 2000/10/03 15:27:00 1.30
+++ XPath.cpp 2000/11/02 01:46:00 1.31
@@ -410,7 +410,7 @@
{
const XalanDOMString theOpCode = LongToDOMString(m_expression.m_opMap[opPos]);
- executionContext.error(XalanDOMString("ERROR! Unknown op code: ") + theOpCode,
+ executionContext.error(TranscodeFromLocalCodePage("ERROR! Unknown op code: ") + theOpCode,
context);
}
break;
@@ -465,7 +465,7 @@
}
else
{
- executionContext.error("Expected match pattern in getMatchScore!",
+ executionContext.error(TranscodeFromLocalCodePage("Expected match pattern in getMatchScore!"),
context);
}
@@ -482,7 +482,7 @@
int /* stepType */,
XPathExecutionContext& executionContext) const
{
- executionContext.warn("XPath needs a derived object to implement nodeTest!",
+ executionContext.warn(TranscodeFromLocalCodePage("XPath needs a derived object to implement nodeTest!"),
context);
return s_MatchScoreNone;
@@ -665,7 +665,7 @@
int /* opPos */,
XPathExecutionContext& executionContext) const
{
- executionContext.warn("XPath needs a derived object to implement step!",
+ executionContext.warn(TranscodeFromLocalCodePage("XPath needs a derived object to implement step!"),
context);
return 0;
@@ -996,7 +996,7 @@
XPathExecutionContext& executionContext) const
{
// Actually, this is no longer supported by xpath...
- executionContext.warn("Old syntax: quo(...) is no longer defined in XPath.");
+ executionContext.warn(TranscodeFromLocalCodePage("Old syntax: quo(...) is no longer defined in XPath."));
return div(context, opPos, executionContext);
}
@@ -1169,15 +1169,15 @@
}
catch(...)
{
- executionContext.error(XalanDOMString("Could not get variable named ") + varName.str());
+ executionContext.error(TranscodeFromLocalCodePage("Could not get variable named ") + varName.str());
throw;
}
if(0 == result)
{
- executionContext.warn(XalanDOMString("VariableReference given for variable out ") +
- XalanDOMString("of context or without definition! Name = ") +
+ executionContext.warn(TranscodeFromLocalCodePage("VariableReference given for variable out ") +
+ TranscodeFromLocalCodePage("of context or without definition! Name = ") +
varName.str(),
context);
}
1.24 +31 -28 xml-xalan/c/src/XPath/XPathExecutionContext.hpp
Index: XPathExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContext.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XPathExecutionContext.hpp 2000/09/27 16:39:35 1.23
+++ XPathExecutionContext.hpp 2000/11/02 01:46:01 1.24
@@ -197,7 +197,7 @@
* @param n DOM node queried
* @return namespace string corresponding to 'n'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const = 0;
/**
@@ -208,7 +208,7 @@
* @param node DOM node whose name is returned
* @return name of the node
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const = 0;
/**
@@ -217,7 +217,7 @@
* @param n node queried
* @return local name string corresponding to 'n'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const = 0;
/**
@@ -243,13 +243,14 @@
/**
* Get node data recursively.
- * (Note whitespace issues.)
*
* @param n DOM node queried
- * @return string of data for node 'n'
+ * @param s string to which the node's data will be appended.
*/
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const = 0;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const = 0;
/**
* Given a valid element id, return the corresponding element.
@@ -260,8 +261,8 @@
*/
virtual XalanElement*
getElementByID(
- const XalanDOMString& id,
- const XalanDocument& doc) const = 0;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const = 0;
/**
* Retrieve node list for current context.
@@ -612,7 +613,7 @@
* @param prefix prefix for a namespace
* @return URI corresponding to namespace
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const = 0;
/**
@@ -681,22 +682,6 @@
virtual void
setThrowFoundIndex(bool fThrow) = 0;
- /**
- * Sets the current match pattern.
- *
- * @param thePattern new match pattern
- */
- virtual void
- setCurrentPattern(const XalanDOMString& thePattern) = 0;
-
- /**
- * Retrieve the current match pattern.
- *
- * @return current match pattern
- */
- virtual XalanDOMString
- getCurrentPattern() const = 0;
-
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const = 0;
@@ -731,16 +716,34 @@
const XalanNode* styleNode = 0) const = 0;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.22 +46 -64 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XPathExecutionContextDefault.cpp 2000/10/02 15:48:23 1.21
+++ XPathExecutionContextDefault.cpp 2000/11/02 01:46:01 1.22
@@ -187,7 +187,7 @@
-XalanDOMString
+const XalanDOMString&
XPathExecutionContextDefault::getNamespaceOfNode(const XalanNode& n) const
{
return m_xpathSupport.getNamespaceOfNode(n);
@@ -195,7 +195,7 @@
-XalanDOMString
+const XalanDOMString&
XPathExecutionContextDefault::getNameOfNode(const XalanNode& n) const
{
return m_xpathSupport.getNameOfNode(n);
@@ -203,7 +203,7 @@
-XalanDOMString
+const XalanDOMString&
XPathExecutionContextDefault::getLocalNameOfNode(const XalanNode& n) const
{
return m_xpathSupport.getLocalNameOfNode(n);
@@ -229,10 +229,12 @@
-XalanDOMString
-XPathExecutionContextDefault::getNodeData(const XalanNode& n) const
+void
+XPathExecutionContextDefault::getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const
{
- return m_xpathSupport.getNodeData(n);
+ m_xpathSupport.getNodeData(n, s);
}
@@ -502,7 +504,7 @@
-XalanDOMString
+const XalanDOMString&
XPathExecutionContextDefault::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
assert(m_prefixResolver != 0);
@@ -552,58 +554,43 @@
const XalanNode* sourceNode,
const XalanNode* /* styleNode */) const
{
- XalanDOMString emsg;
-
- const XalanDOMString theCurrentPattern(getCurrentPattern());
-
- if (length(theCurrentPattern) != 0)
- {
- emsg = XalanDOMString("pattern = '") +
- theCurrentPattern +
- XalanDOMString("'\n");
- }
-
- emsg += msg;
-
if (m_xpathEnvSupport.problem(XPathEnvSupport::eXPATHProcessor,
XPathEnvSupport::eError,
m_prefixResolver,
sourceNode,
- emsg,
+ msg,
0,
0) == true)
{
// $$$ ToDo: Do something with the PrefixResolver here...
- throw XPathException(emsg, 0);
+ throw XPathException(msg, 0);
}
}
void
+XPathExecutionContextDefault::error(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ error(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
XPathExecutionContextDefault::warn(
const XalanDOMString& msg,
const XalanNode* sourceNode,
const XalanNode* /* styleNode */) const
{
- XalanDOMString emsg;
-
- const XalanDOMString theCurrentPattern(getCurrentPattern());
-
- if (length(theCurrentPattern) != 0)
- {
- emsg = XalanDOMString("pattern = '") +
- theCurrentPattern +
- XalanDOMString("'\n");
- }
-
- emsg += msg;
-
if (m_xpathEnvSupport.problem(XPathEnvSupport::eXPATHProcessor,
XPathEnvSupport::eWarning,
m_prefixResolver,
sourceNode,
- emsg,
+ msg,
0,
0) == true)
{
@@ -615,29 +602,27 @@
void
+XPathExecutionContextDefault::warn(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ warn(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
XPathExecutionContextDefault::message(
const XalanDOMString& msg,
const XalanNode* sourceNode,
const XalanNode* /* styleNode */) const
{
- XalanDOMString emsg;
-
- const XalanDOMString theCurrentPattern(getCurrentPattern());
-
- if (length(theCurrentPattern) != 0)
- {
- emsg = XalanDOMString("pattern = '") +
- theCurrentPattern +
- XalanDOMString("'\n");
- }
-
- emsg += msg;
-
if (m_xpathEnvSupport.problem(XPathEnvSupport::eXPATHProcessor,
XPathEnvSupport::eMessage,
m_prefixResolver,
sourceNode,
- emsg,
+ msg,
0,
0) == true)
{
@@ -648,6 +633,17 @@
+void
+XPathExecutionContextDefault::message(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ message(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
bool
XPathExecutionContextDefault::getThrowFoundIndex() const
{
@@ -660,20 +656,6 @@
XPathExecutionContextDefault::setThrowFoundIndex(bool fThrow)
{
m_throwFoundIndex = fThrow;
-}
-
-
-void
-XPathExecutionContextDefault::setCurrentPattern(const XalanDOMString& thePattern)
-{
- m_currentPattern = thePattern;
-}
-
-
-XalanDOMString
-XPathExecutionContextDefault::getCurrentPattern() const
-{
- return m_currentPattern;
}
1.22 +28 -14 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XPathExecutionContextDefault.hpp 2000/09/19 14:56:37 1.21
+++ XPathExecutionContextDefault.hpp 2000/11/02 01:46:01 1.22
@@ -140,13 +140,13 @@
virtual bool
isIgnorableWhitespace(const XalanText& node) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const;
virtual XalanNode*
@@ -157,8 +157,10 @@
const XalanNode& node1,
const XalanNode& node2) const;
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const;
virtual XalanElement*
getElementByID(
@@ -243,7 +245,7 @@
virtual void
setPrefixResolver(const PrefixResolver* thePrefixResolver);
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const;
virtual XalanDocument*
@@ -266,12 +268,6 @@
virtual void
setThrowFoundIndex(bool fThrow);
- virtual void
- setCurrentPattern(const XalanDOMString& thePattern);
-
- virtual XalanDOMString
- getCurrentPattern() const;
-
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const;
@@ -293,16 +289,34 @@
const XalanNode* styleNode = 0) const;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
#if defined(XALAN_NO_NAMESPACES)
typedef vector<MutableNodeRefList*> NodeRefListCacheType;
1.18 +4 -4 xml-xalan/c/src/XPath/XPathExpression.cpp
Index: XPathExpression.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XPathExpression.cpp 2000/10/17 17:30:11 1.17
+++ XPathExpression.cpp 2000/11/02 01:46:02 1.18
@@ -124,7 +124,7 @@
<< " was detected."
<< '\0';
- return theFormatter.str();
+ return TranscodeFromLocalCodePage(theFormatter.str());
}
@@ -169,7 +169,7 @@
<< " arguments(s) were supplied."
<< '\0';
- return theFormatter.str();
+ return TranscodeFromLocalCodePage(theFormatter.str());
}
@@ -209,7 +209,7 @@
<< "."
<< '\0';
- return theFormatter.str();
+ return TranscodeFromLocalCodePage(theFormatter.str());
}
@@ -244,7 +244,7 @@
<< "."
<< '\0';
- return theFormatter.str();
+ return TranscodeFromLocalCodePage(theFormatter.str());
}
1.11 +1 -1 xml-xalan/c/src/XPath/XPathExpression.hpp
Index: XPathExpression.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathExpression.hpp 2000/10/03 15:27:02 1.10
+++ XPathExpression.hpp 2000/11/02 01:46:02 1.11
@@ -1249,7 +1249,7 @@
int theOffset,
const XalanDOMString& theToken)
{
- assert(theToken != 0);
+ assert(c_wstr(theToken) != 0);
const int thePosition = int(m_currentPosition) + theOffset;
1.11 +29 -29 xml-xalan/c/src/XPath/XPathFunctionTable.cpp
Index: XPathFunctionTable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFunctionTable.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathFunctionTable.cpp 2000/08/31 19:43:04 1.10
+++ XPathFunctionTable.cpp 2000/11/02 01:46:02 1.11
@@ -181,85 +181,85 @@
{
try
{
- InstallFunction(XALAN_STATIC_UCODE_STRING("last"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("last")),
FunctionLast());
- InstallFunction(XALAN_STATIC_UCODE_STRING("position"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("position")),
FunctionPosition());
- InstallFunction(XALAN_STATIC_UCODE_STRING("count"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("count")),
FunctionCount());
- InstallFunction(XALAN_STATIC_UCODE_STRING("id"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("id")),
FunctionID());
- InstallFunction(XALAN_STATIC_UCODE_STRING("local-name"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("local-name")),
FunctionLocalName());
- InstallFunction(XALAN_STATIC_UCODE_STRING("namespace-uri"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("namespace-uri")),
FunctionNamespaceURI());
- InstallFunction(XALAN_STATIC_UCODE_STRING("name"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("name")),
FunctionName());
- InstallFunction(XALAN_STATIC_UCODE_STRING("string"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("string")),
FunctionString());
- InstallFunction(XALAN_STATIC_UCODE_STRING("concat"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("concat")),
FunctionConcat());
- InstallFunction(XALAN_STATIC_UCODE_STRING("starts-with"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("starts-with")),
FunctionStartsWith());
- InstallFunction(XALAN_STATIC_UCODE_STRING("contains"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("contains")),
FunctionContains());
- InstallFunction(XALAN_STATIC_UCODE_STRING("substring-before"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("substring-before")),
FunctionSubstringBefore());
- InstallFunction(XALAN_STATIC_UCODE_STRING("substring-after"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("substring-after")),
FunctionSubstringAfter());
- InstallFunction(XALAN_STATIC_UCODE_STRING("substring"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("substring")),
FunctionSubstring());
- InstallFunction(XALAN_STATIC_UCODE_STRING("string-length"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("string-length")),
FunctionStringLength());
- InstallFunction(XALAN_STATIC_UCODE_STRING("normalize-space"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("normalize-space")),
FunctionNormalizeSpace());
- InstallFunction(XALAN_STATIC_UCODE_STRING("translate"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("translate")),
FunctionTranslate());
- InstallFunction(XALAN_STATIC_UCODE_STRING("boolean"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("boolean")),
FunctionBoolean());
- InstallFunction(XALAN_STATIC_UCODE_STRING("not"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("not")),
FunctionNot());
- InstallFunction(XALAN_STATIC_UCODE_STRING("true"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("true")),
FunctionTrue());
- InstallFunction(XALAN_STATIC_UCODE_STRING("false"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("false")),
FunctionFalse());
- InstallFunction(XALAN_STATIC_UCODE_STRING("lang"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("lang")),
FunctionLang());
- InstallFunction(XALAN_STATIC_UCODE_STRING("number"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("number")),
FunctionNumber());
- InstallFunction(XALAN_STATIC_UCODE_STRING("sum"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("sum")),
FunctionSum());
- InstallFunction(XALAN_STATIC_UCODE_STRING("floor"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("floor")),
FunctionFloor());
- InstallFunction(XALAN_STATIC_UCODE_STRING("ceiling"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("ceiling")),
FunctionCeiling());
- InstallFunction(XALAN_STATIC_UCODE_STRING("round"),
+ InstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("round")),
FunctionRound());
}
@@ -300,7 +300,7 @@
XPathExceptionFunctionNotAvailable::XPathExceptionFunctionNotAvailable(
int theFunctionNumber,
const XalanNode* styleNode) :
- XPathException(XALAN_STATIC_UCODE_STRING("The specified function ID is not available: ") + LongToDOMString(theFunctionNumber),
+ XPathException(TranscodeFromLocalCodePage("The specified function ID is not available: ") + LongToDOMString(theFunctionNumber),
styleNode)
{
}
@@ -310,7 +310,7 @@
XPathExceptionFunctionNotAvailable::XPathExceptionFunctionNotAvailable(
const XalanDOMString& theFunctionName,
const XalanNode* styleNode) :
- XPathException(XALAN_STATIC_UCODE_STRING("The specified function is not available: ") + theFunctionName,
+ XPathException(TranscodeFromLocalCodePage("The specified function is not available: ") + theFunctionName,
styleNode)
{
}
1.26 +91 -40 xml-xalan/c/src/XPath/XPathProcessorImpl.cpp
Index: XPathProcessorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- XPathProcessorImpl.cpp 2000/10/17 17:30:12 1.25
+++ XPathProcessorImpl.cpp 2000/11/02 01:46:02 1.26
@@ -626,6 +626,39 @@
bool
+XPathProcessorImpl::tokenIs(const char* s) const
+{
+ const unsigned int theTokenLength = length(m_token);
+
+ const unsigned int theStringLength = strlen(s);
+
+ if (theTokenLength != theStringLength)
+ {
+ return false;
+ }
+ else
+ {
+ unsigned int i = 0;
+
+ while(i < theStringLength)
+ {
+ if (charAt(m_token, i ) != s[i])
+ {
+ break;
+ }
+ else
+ {
+ ++i;
+ }
+ }
+
+ return i == theStringLength ? true : false;
+ }
+}
+
+
+
+bool
XPathProcessorImpl::tokenIs(char c) const
{
return m_tokenChar == c ? true : false;
@@ -792,9 +825,9 @@
}
else
{
- error(XalanDOMString("Expected ") +
- XalanDOMString(expected) +
- XalanDOMString(", but found: ") +
+ error(TranscodeFromLocalCodePage("Expected ") +
+ TranscodeFromLocalCodePage(expected) +
+ TranscodeFromLocalCodePage(", but found: ") +
m_token);
}
}
@@ -810,11 +843,11 @@
}
else
{
- XalanDOMString theMsg("Expected ");
+ XalanDOMString theMsg(TranscodeFromLocalCodePage("Expected "));
- theMsg += expected;
- theMsg += ", but found: ";
- theMsg += m_token;
+ append(theMsg, expected);
+ append(theMsg, ", but found: ");
+ append(theMsg, m_token);
error(theMsg);
}
@@ -847,6 +880,16 @@
void
+XPathProcessorImpl::warn(
+ const char* msg,
+ XalanNode* sourceNode) const
+{
+ warn(TranscodeFromLocalCodePage(msg), sourceNode);
+}
+
+
+
+void
XPathProcessorImpl::error(
const XalanDOMString& msg,
XalanNode* sourceNode) const
@@ -862,7 +905,7 @@
const XalanDOMString& theCurrentPattern =
m_expression->getCurrentPattern();
- DOMStringPrintWriter thePrintWriter;
+ DOMStringPrintWriter thePrintWriter(emsg);
if (length(theCurrentPattern) != 0)
{
@@ -873,8 +916,6 @@
thePrintWriter.print(msg);
m_expression->dumpRemainingTokenQueue(thePrintWriter);
-
- emsg = thePrintWriter.getString();
}
assert(m_envSupport != 0);
@@ -893,9 +934,19 @@
throw XPathParserException(emsg);
}
}
-
-
+
+
+void
+XPathProcessorImpl::error(
+ const char* msg,
+ XalanNode* sourceNode) const
+{
+ error(TranscodeFromLocalCodePage(msg), sourceNode);
+}
+
+
+
int
XPathProcessorImpl::getKeywordToken(const XalanDOMString& key) const
{
@@ -1622,9 +1673,9 @@
{
if (isValidFunction(m_token) == false)
{
- warn(XalanDOMString("Could not find function: ") +
+ warn(TranscodeFromLocalCodePage("Could not find function: ") +
m_token +
- XalanDOMString("()"));
+ TranscodeFromLocalCodePage("()"));
}
// $$$ ToDo: I believe that this is XSLT functionality. We
@@ -1872,7 +1923,7 @@
if (i == s_axisNames.end())
{
- error(XalanDOMString("illegal axis name: ") +
+ error(TranscodeFromLocalCodePage("illegal axis name: ") +
m_token);
}
else
@@ -1898,7 +1949,7 @@
if (i == s_nodeTypes.end())
{
- error(XalanDOMString("Unknown nodetype: ") +
+ error(TranscodeFromLocalCodePage("Unknown nodetype: ") +
m_token);
}
else
@@ -2079,9 +2130,9 @@
}
else
{
- error(XalanDOMString("Pattern literal (") +
+ error(TranscodeFromLocalCodePage("Pattern literal (") +
m_token +
- XalanDOMString(") needs to be quoted!"));
+ TranscodeFromLocalCodePage(") needs to be quoted!"));
}
}
@@ -2368,10 +2419,10 @@
void
XPathProcessorImpl::initializeFunctionTable(FunctionNameMapType& theFunctions)
{
- theFunctions[XALAN_STATIC_UCODE_STRING("processing-instruction")] = XPathExpression::eNODETYPE_PI;
- theFunctions[XALAN_STATIC_UCODE_STRING("comment")] = XPathExpression::eNODETYPE_COMMENT;
- theFunctions[XALAN_STATIC_UCODE_STRING("text")] = XPathExpression::eNODETYPE_TEXT;
- theFunctions[XALAN_STATIC_UCODE_STRING("node")] = XPathExpression::eNODETYPE_NODE;
+ theFunctions[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("processing-instruction"))] = XPathExpression::eNODETYPE_PI;
+ theFunctions[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("comment"))] = XPathExpression::eNODETYPE_COMMENT;
+ theFunctions[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("text"))] = XPathExpression::eNODETYPE_TEXT;
+ theFunctions[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("node"))] = XPathExpression::eNODETYPE_NODE;
}
@@ -2379,19 +2430,19 @@
void
XPathProcessorImpl::initializeAxisNamesTable(AxisNamesMapType& theAxisNames)
{
- theAxisNames[XALAN_STATIC_UCODE_STRING("ancestor")] = XPathExpression::eFROM_ANCESTORS;
- theAxisNames[XALAN_STATIC_UCODE_STRING("ancestor-or-self")] = XPathExpression::eFROM_ANCESTORS_OR_SELF;
- theAxisNames[XALAN_STATIC_UCODE_STRING("attribute")] = XPathExpression::eFROM_ATTRIBUTES;
- theAxisNames[XALAN_STATIC_UCODE_STRING("child")] = XPathExpression::eFROM_CHILDREN;
- theAxisNames[XALAN_STATIC_UCODE_STRING("descendant")] = XPathExpression::eFROM_DESCENDANTS;
- theAxisNames[XALAN_STATIC_UCODE_STRING("descendant-or-self")] = XPathExpression::eFROM_DESCENDANTS_OR_SELF;
- theAxisNames[XALAN_STATIC_UCODE_STRING("following")] = XPathExpression::eFROM_FOLLOWING;
- theAxisNames[XALAN_STATIC_UCODE_STRING("following-sibling")] = XPathExpression::eFROM_FOLLOWING_SIBLINGS;
- theAxisNames[XALAN_STATIC_UCODE_STRING("parent")] = XPathExpression::eFROM_PARENT;
- theAxisNames[XALAN_STATIC_UCODE_STRING("preceding")] = XPathExpression::eFROM_PRECEDING;
- theAxisNames[XALAN_STATIC_UCODE_STRING("preceding-sibling")] = XPathExpression::eFROM_PRECEDING_SIBLINGS;
- theAxisNames[XALAN_STATIC_UCODE_STRING("self")] = XPathExpression::eFROM_SELF;
- theAxisNames[XALAN_STATIC_UCODE_STRING("namespace")] = XPathExpression::eFROM_NAMESPACE;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("ancestor"))] = XPathExpression::eFROM_ANCESTORS;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("ancestor-or-self"))] = XPathExpression::eFROM_ANCESTORS_OR_SELF;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("attribute"))] = XPathExpression::eFROM_ATTRIBUTES;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("child"))] = XPathExpression::eFROM_CHILDREN;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("descendant"))] = XPathExpression::eFROM_DESCENDANTS;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("descendant-or-self"))] = XPathExpression::eFROM_DESCENDANTS_OR_SELF;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("following"))] = XPathExpression::eFROM_FOLLOWING;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("following-sibling"))] = XPathExpression::eFROM_FOLLOWING_SIBLINGS;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("parent"))] = XPathExpression::eFROM_PARENT;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("preceding"))] = XPathExpression::eFROM_PRECEDING;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("preceding-sibling"))] = XPathExpression::eFROM_PRECEDING_SIBLINGS;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("self"))] = XPathExpression::eFROM_SELF;
+ theAxisNames[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("namespace"))] = XPathExpression::eFROM_NAMESPACE;
}
@@ -2399,11 +2450,11 @@
void
XPathProcessorImpl::initializeNodeTypesTable(NodeTypesMapType& theNodeTypes)
{
- theNodeTypes[XALAN_STATIC_UCODE_STRING("comment")] = XPathExpression::eNODETYPE_COMMENT;
- theNodeTypes[XALAN_STATIC_UCODE_STRING("text")] = XPathExpression::eNODETYPE_TEXT;
- theNodeTypes[XALAN_STATIC_UCODE_STRING("processing-instruction")] = XPathExpression::eNODETYPE_PI;
- theNodeTypes[XALAN_STATIC_UCODE_STRING("node")] = XPathExpression::eNODETYPE_NODE;
- theNodeTypes[XALAN_STATIC_UCODE_STRING("*")] = XPathExpression::eNODETYPE_ANYELEMENT;
+ theNodeTypes[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("comment"))] = XPathExpression::eNODETYPE_COMMENT;
+ theNodeTypes[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("text"))] = XPathExpression::eNODETYPE_TEXT;
+ theNodeTypes[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("processing-instruction"))] = XPathExpression::eNODETYPE_PI;
+ theNodeTypes[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("node"))] = XPathExpression::eNODETYPE_NODE;
+ theNodeTypes[StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("*"))] = XPathExpression::eNODETYPE_ANYELEMENT;
}
1.13 +26 -1 xml-xalan/c/src/XPath/XPathProcessorImpl.hpp
Index: XPathProcessorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XPathProcessorImpl.hpp 2000/10/03 15:27:02 1.12
+++ XPathProcessorImpl.hpp 2000/11/02 01:46:02 1.13
@@ -270,6 +270,14 @@
* if s is also null).
*/
bool
+ tokenIs(const char* s) const;
+
+ /**
+ * Check if m_token==s. If m_token is null, this won't throw
+ * an exception, instead it just returns false (or true
+ * if s is also null).
+ */
+ bool
tokenIs(char c) const;
/**
@@ -363,7 +371,7 @@
*/
void
resetTokenMark(int mark);
-
+
/**
* Consume an expected token, throwing an exception if it
* isn't there.
@@ -387,6 +395,14 @@
XalanNode* sourceNode = 0) const;
/**
+ * Warn the user of an problem.
+ */
+ void
+ warn(
+ const char* msg,
+ XalanNode* sourceNode = 0) const;
+
+ /**
* Tell the user of an error, and probably throw an
* exception.
*/
@@ -394,6 +410,15 @@
error(
const XalanDOMString& msg,
XalanNode* sourceNode = 0) const;
+
+ /**
+ * Tell the user of an error, and probably throw an
+ * exception.
+ */
+ void
+ error(
+ const char* msg,
+ XalanNode* sourceNode = 0) const;
/**
* Given a string, return the corresponding token.
1.8 +11 -12 xml-xalan/c/src/XPath/XPathSupport.hpp
Index: XPathSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupport.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XPathSupport.hpp 2000/06/01 16:27:23 1.7
+++ XPathSupport.hpp 2000/11/02 01:46:03 1.8
@@ -107,7 +107,7 @@
* @param namespaceContext DOM element representing the context for namespace
* @return URI corresponding to namespace
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(
const XalanDOMString& prefix,
const XalanElement& namespaceContext) const = 0;
@@ -118,7 +118,7 @@
* @param node DOM node whose namespace is returned
* @return namespace of node
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const = 0;
/**
@@ -129,7 +129,7 @@
* @param node DOM node whose name is returned
* @return name of the node
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const = 0;
/**
@@ -138,20 +138,19 @@
* @param node DOM node whose name is returned
* @return name of node without namespace
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const = 0;
/**
- * Retrieves data for node recursively.
- * (Note whitespace issues.)
+ * Get node data recursively.
*
- * @param node DOM node whose data is to be returned
- * @param theResolver prefix resolver to use
-
- * @return a string representation of the node's data
+ * @param n DOM node queried
+ * @param s string to which the node's data will be appended.
*/
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const = 0;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const = 0;
/**
* Retrieve the parent of a node. This function has to be implemented,
1.11 +9 -7 xml-xalan/c/src/XPath/XPathSupportDefault.cpp
Index: XPathSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathSupportDefault.cpp 2000/08/22 20:20:50 1.10
+++ XPathSupportDefault.cpp 2000/11/02 01:46:03 1.11
@@ -110,7 +110,7 @@
-XalanDOMString
+const XalanDOMString&
XPathSupportDefault::getNamespaceForPrefix(
const XalanDOMString& prefix,
const XalanElement& namespaceContext) const
@@ -121,7 +121,7 @@
-XalanDOMString
+const XalanDOMString&
XPathSupportDefault::getNamespaceOfNode(const XalanNode& n) const
{
return m_DOMSupport.getNamespaceOfNode(n);
@@ -129,7 +129,7 @@
-XalanDOMString
+const XalanDOMString&
XPathSupportDefault::getNameOfNode(const XalanNode& n) const
{
return DOMServices::getNameOfNode(n);
@@ -137,7 +137,7 @@
-XalanDOMString
+const XalanDOMString&
XPathSupportDefault::getLocalNameOfNode(const XalanNode& n) const
{
return DOMServices::getLocalNameOfNode(n);
@@ -145,10 +145,12 @@
-XalanDOMString
-XPathSupportDefault::getNodeData(const XalanNode& node) const
+void
+XPathSupportDefault::getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const
{
- return DOMServices::getNodeData(node);
+ DOMServices::getNodeData(n, s);
}
1.8 +12 -7 xml-xalan/c/src/XPath/XPathSupportDefault.hpp
Index: XPathSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XPathSupportDefault.hpp 2000/06/01 16:27:23 1.7
+++ XPathSupportDefault.hpp 2000/11/02 01:46:03 1.8
@@ -64,11 +64,14 @@
-#include <XPath/XPathSupport.hpp>
#include <DOMSupport/DOMServices.hpp>
+#include <XPath/XPathSupport.hpp>
+
+
+
class DOMSupport;
@@ -88,22 +91,24 @@
virtual bool
isIgnorableWhitespace(const XalanText& node) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(
const XalanDOMString& prefix,
const XalanElement& namespaceContext) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const;
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const;
virtual XalanNode*
getParentOfNode(const XalanNode& node) const;
1.4 +2 -2 xml-xalan/c/src/XPath/XPointer.cpp
Index: XPointer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPointer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPointer.cpp 2000/04/11 14:46:22 1.3
+++ XPointer.cpp 2000/11/02 01:46:03 1.4
@@ -65,7 +65,7 @@
XSpan*
XPointer::getNode(const XalanDOMString& /* xpointer */)
{
- throw XPathException("Error! XPointer::getNode not yet implemented!");
+ throw XPathException(TranscodeFromLocalCodePage("Error! XPointer::getNode not yet implemented!"));
return 0;
}
@@ -75,7 +75,7 @@
XSpan*
XPointer::getNode(XPath& /* xpath */)
{
- throw XPathException("Error! XPointer::getNode not yet implemented!");
+ throw XPathException(TranscodeFromLocalCodePage("Error! XPointer::getNode not yet implemented!"));
return 0;
}
1.14 +8 -32 xml-xalan/c/src/XPath/XResultTreeFrag.cpp
Index: XResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XResultTreeFrag.cpp 2000/09/19 14:56:43 1.13
+++ XResultTreeFrag.cpp 2000/11/02 01:46:04 1.14
@@ -69,6 +69,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include "NodeRefListBase.hpp"
#include "ResultTreeFragBase.hpp"
#include "XObjectTypeCallback.hpp"
@@ -146,36 +150,8 @@
bool
XResultTreeFrag::boolean() const
{
- bool fResult = false;
-
- const XalanNode* theCurrentNode = m_value->getFirstChild();
-
- while(theCurrentNode != 0)
- {
- if(XalanNode::TEXT_NODE == theCurrentNode->getNodeType())
- {
- const XalanText* const theTextNode =
-#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanText*)theCurrentNode;
-#else
- static_cast<const XalanText*>(theCurrentNode);
-#endif
-
- if (theTextNode->isIgnorableWhitespace() ||
- length(trim(theTextNode->getData())) == 0)
- {
- continue;
- }
-
- fResult = true;
-
- break;
- }
-
- theCurrentNode = theCurrentNode->getNextSibling();
- }
-
- return fResult;
+ // Result tree fragments always evaluate to true.
+ return true;
}
@@ -186,9 +162,9 @@
if (isEmpty(m_cachedStringValue) == true)
{
#if defined(XALAN_NO_MUTABLE)
- ((XResultTreeFrag*)this)->m_cachedStringValue = m_value->getXSLTData();
+ DOMServices::getNodeData(*m_value, ((XResultTreeFrag*)this)->m_cachedStringValue);
#else
- m_cachedStringValue = m_value->getXSLTData();
+ DOMServices::getNodeData(*m_value, m_cachedStringValue);
#endif
}
1.14 +1 -1 xml-xalan/c/src/XPath/XResultTreeFrag.hpp
Index: XResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XResultTreeFrag.hpp 2000/09/19 14:56:44 1.13
+++ XResultTreeFrag.hpp 2000/11/02 01:46:04 1.14
@@ -74,7 +74,7 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
1.13 +1 -1 xml-xalan/c/src/XPath/XString.hpp
Index: XString.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XString.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XString.hpp 2000/09/19 14:56:45 1.12
+++ XString.hpp 2000/11/02 01:46:04 1.13
@@ -74,7 +74,7 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
1.9 +6 -7 xml-xalan/c/src/XSLT/AVT.cpp
Index: AVT.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AVT.cpp 2000/10/12 17:07:44 1.8
+++ AVT.cpp 2000/11/02 01:46:17 1.9
@@ -108,14 +108,16 @@
* on to the string if the AVT is simple.
*/
AVT::AVT(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const XalanDOMChar* type,
const XalanDOMChar* stringedValue,
const PrefixResolver& resolver,
StylesheetConstructionContext& constructionContext) :
AVTPart(),
+ m_parts(),
m_simpleString(),
- m_name(name),
+ // $$$ ToDo: Explicit XalanDOMString constructor
+ m_name(XalanDOMString(name)),
m_pcType(type)
{
StringTokenizer tokenizer(stringedValue, theTokenDelimiterCharacters, true);
@@ -210,7 +212,7 @@
case XalanUnicode::charLeftCurlyBracket:
{
// What's another curly doing here?
- error = "Error: Can not have \"{\" within expression.";
+ error = TranscodeFromLocalCodePage("Error: Can not have \"{\" within expression.");
break;
}
@@ -271,10 +273,7 @@
}
default:
{
- // @@ Just to make sure we're not getting the whole string
- // There seemed to be a problem with single character
- // strings
- const DOMString s(&theChar, 1);
+ const XalanDOMString s(&theChar, 1);
// Anything else just add to string.
append(buffer, s);
1.9 +2 -2 xml-xalan/c/src/XSLT/AVT.hpp
Index: AVT.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/AVT.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AVT.hpp 2000/10/12 17:07:45 1.8
+++ AVT.hpp 2000/11/02 01:46:17 1.9
@@ -58,7 +58,7 @@
#define XALAN_AVT_HEADER_GUARD
/**
- * $Id: AVT.hpp,v 1.8 2000/10/12 17:07:45 auriemma Exp $
+ * $Id: AVT.hpp,v 1.9 2000/11/02 01:46:17 dbertoni Exp $
*
* $State: Exp $
*
@@ -105,7 +105,7 @@
* @param constructionContext context for construction of AVT
*/
AVT(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const XalanDOMChar* type,
const XalanDOMChar* stringedValue,
const PrefixResolver& resolver,
1.4 +1 -1 xml-xalan/c/src/XSLT/ElemApplyImport.cpp
Index: ElemApplyImport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyImport.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemApplyImport.cpp 2000/04/11 15:09:22 1.3
+++ ElemApplyImport.cpp 2000/11/02 01:46:18 1.4
@@ -79,7 +79,7 @@
ElemApplyImport::ElemApplyImport(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemApplyImport.hpp
Index: ElemApplyImport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyImport.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemApplyImport.hpp 2000/04/11 15:09:22 1.4
+++ ElemApplyImport.hpp 2000/11/02 01:46:18 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMAPPLYIMPORT_HEADER_GUARD
/**
- * $Id: ElemApplyImport.hpp,v 1.4 2000/04/11 15:09:22 dbertoni Exp $
+ * $Id: ElemApplyImport.hpp,v 1.5 2000/11/02 01:46:18 dbertoni Exp $
*
* $State: Exp $
*
@@ -94,7 +94,7 @@
ElemApplyImport(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.9 +1 -1 xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp
Index: ElemApplyTemplates.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemApplyTemplates.cpp 2000/09/19 15:11:38 1.8
+++ ElemApplyTemplates.cpp 2000/11/02 01:46:18 1.9
@@ -74,7 +74,7 @@
ElemApplyTemplates::ElemApplyTemplates(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp
Index: ElemApplyTemplates.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemApplyTemplates.hpp 2000/04/11 15:09:22 1.4
+++ ElemApplyTemplates.hpp 2000/11/02 01:46:18 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMAPPLYTEMPLATES_HEADER_GUARD
/**
- * $Id: ElemApplyTemplates.hpp,v 1.4 2000/04/11 15:09:22 dbertoni Exp $
+ * $Id: ElemApplyTemplates.hpp,v 1.5 2000/11/02 01:46:18 dbertoni Exp $
*
* $State: Exp $
*
@@ -96,7 +96,7 @@
ElemApplyTemplates(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.10 +57 -23 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ElemAttribute.cpp 2000/09/05 02:24:52 1.9
+++ ElemAttribute.cpp 2000/11/02 01:46:19 1.10
@@ -81,7 +81,7 @@
ElemAttribute::ElemAttribute(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -113,7 +113,7 @@
else if(!(isAttrOK(aname, atts, i, constructionContext) ||
processSpaceAttr(aname, atts, i)))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
@@ -125,7 +125,7 @@
delete m_pNamespaceAVT;
#endif
- constructionContext.error(name + " must have a name attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a name attribute.");
}
}
@@ -164,7 +164,7 @@
if(!isEmpty(attrName))
{
- const XalanDOMString origAttrName = attrName; // save original attribute name
+ const XalanDOMString origAttrName(attrName); // save original attribute name
const unsigned int origAttrNameLength = length(origAttrName);
@@ -182,29 +182,61 @@
}
else
{
- XalanDOMString prefix = executionContext.getResultPrefixForNamespace(attrNameSpace);
+ indexOfNSSep = indexOf(origAttrName, XalanUnicode::charColon);
- if(isEmpty(prefix))
+ if(indexOfNSSep < origAttrNameLength)
{
- prefix = executionContext.getUniqueNameSpaceValue();
-
- const XalanDOMString nsDecl = XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator) + prefix;
-
- executionContext.addResultAttribute(nsDecl, attrNameSpace);
+ attrName = substring(attrName, indexOfNSSep + 1);
}
- indexOfNSSep = indexOf(origAttrName, XalanUnicode::charColon);
+ const XalanDOMString& prefix = executionContext.getResultPrefixForNamespace(attrNameSpace);
- if(indexOfNSSep < origAttrNameLength)
+ if(isEmpty(prefix) == false)
{
- attrName = substring(attrName, indexOfNSSep + 1);
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+ attrName = prefix + DOMServices::s_XMLNamespaceSeparatorString + attrName;
+#else
+ reserve(
+ attrName,
+ length(attrName) + DOMServices::s_XMLNamespaceSeparatorStringLength + length(prefix) + 1);
+
+ insert(attrName, 0, DOMServices::s_XMLNamespaceSeparatorString);
+ insert(attrName, 0, prefix);
+#endif
}
+ else
+ {
+ const XalanDOMString newPrefix(executionContext.getUniqueNameSpaceValue());
+
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+ const XalanDOMString nsDecl = DOMServices::s_XMLNamespaceWithSeparator + newPrefix;
+#else
+ XalanDOMString nsDecl;
+
+ reserve(nsDecl, DOMServices::s_XMLNamespaceWithSeparatorLength + length(newPrefix) + 1);
+
+ nsDecl = XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator);
+
+ append(nsDecl, newPrefix);
+#endif
+ executionContext.addResultAttribute(nsDecl, attrNameSpace);
+
+// $$$ ToDo: Move these blocks (and those in ElemElement.cpp) into a common set of functions...
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+ attrName = newPrefix + DOMServices::s_XMLNamespaceSeparatorString + attrName;
+#else
+ reserve(
+ attrName,
+ length(attrName) + DOMServices::s_XMLNamespaceSeparatorStringLength + length(newPrefix) + 1);
- attrName = prefix + DOMServices::s_XMLNamespaceSeparatorString + attrName;
+ insert(attrName, 0, DOMServices::s_XMLNamespaceSeparatorString);
+ insert(attrName, 0, newPrefix);
+#endif
+ }
}
}
// Note we are using original attribute name for these tests.
- else if(!isEmpty(executionContext.getPendingElementName())
+ else if(executionContext.isElementPending() == true
&& !equals(origAttrName, DOMServices::s_XMLNamespace))
{
// make sure that if a prefix is specified on the attribute name, it is valid
@@ -219,13 +251,12 @@
if (isEmpty(attrNameSpace))
{
// Could not resolve prefix
- executionContext.warn(XalanDOMString("Warning: Could not resolve prefix ") + nsprefix, sourceNode, this);
+ executionContext.warn("Warning: Could not resolve prefix " + nsprefix, sourceNode, this);
}
}
}
else
{
- //warn(templateChild, sourceNode, "Trying to add attribute after element child has been added, ignoring...");
executionContext.warn("Warning: Trying to add attribute after element child has been added, ignoring...", sourceNode, this);
}
@@ -233,11 +264,14 @@
// the result attribute.
if (indexOfNSSep == origAttrNameLength || !isEmpty(attrNameSpace))
{
- const XalanDOMString val =
- childrenToString(executionContext,
- sourceTree,
- sourceNode,
- mode);
+ XalanDOMString val;
+
+ childrenToString(
+ executionContext,
+ sourceTree,
+ sourceNode,
+ mode,
+ val);
executionContext.addResultAttribute(attrName, val);
}
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemAttribute.hpp
Index: ElemAttribute.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttribute.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemAttribute.hpp 2000/04/11 15:09:23 1.4
+++ ElemAttribute.hpp 2000/11/02 01:46:19 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMATTRIBUTE_HEADER_GUARD
/**
- * $Id: ElemAttribute.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
+ * $Id: ElemAttribute.hpp,v 1.5 2000/11/02 01:46:19 dbertoni Exp $
*
*
* $State: Exp $
@@ -97,7 +97,7 @@
ElemAttribute (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.5 +3 -3 xml-xalan/c/src/XSLT/ElemAttributeSet.cpp
Index: ElemAttributeSet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemAttributeSet.cpp 2000/06/05 01:12:24 1.4
+++ ElemAttributeSet.cpp 2000/11/02 01:46:19 1.5
@@ -73,7 +73,7 @@
ElemAttributeSet::ElemAttributeSet(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -100,13 +100,13 @@
else if(!(processUseAttributeSets(constructionContext, aname, atts, i) ||
isAttrOK(aname, atts, i, constructionContext)))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(isEmpty(m_QName.getLocalPart()))
{
- constructionContext.error(name + " must have a name attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a name attribute.");
}
}
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemAttributeSet.hpp
Index: ElemAttributeSet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemAttributeSet.hpp 2000/04/11 15:09:23 1.4
+++ ElemAttributeSet.hpp 2000/11/02 01:46:19 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMATTRIBUTESET_HEADER_GUARD
/**
- * $Id: ElemAttributeSet.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
+ * $Id: ElemAttributeSet.hpp,v 1.5 2000/11/02 01:46:19 dbertoni Exp $
*
*
* $State: Exp $
@@ -101,7 +101,7 @@
ElemAttributeSet (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.9 +3 -3 xml-xalan/c/src/XSLT/ElemCallTemplate.cpp
Index: ElemCallTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemCallTemplate.cpp 2000/08/14 20:11:46 1.8
+++ ElemCallTemplate.cpp 2000/11/02 01:46:19 1.9
@@ -79,7 +79,7 @@
ElemCallTemplate::ElemCallTemplate(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -103,13 +103,13 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if (m_templateName.isEmpty() == true)
{
- constructionContext.error(name + " requires a name attribute!");
+ constructionContext.error(XalanDOMString(name) + " requires a name attribute!");
}
}
1.7 +2 -2 xml-xalan/c/src/XSLT/ElemCallTemplate.hpp
Index: ElemCallTemplate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemCallTemplate.hpp 2000/08/01 19:45:13 1.6
+++ ElemCallTemplate.hpp 2000/11/02 01:46:20 1.7
@@ -58,7 +58,7 @@
#define XALAN_ELEMCALLTEMPLATE_HEADER_GUARD
/**
- * $Id: ElemCallTemplate.hpp,v 1.6 2000/08/01 19:45:13 dbertoni Exp $
+ * $Id: ElemCallTemplate.hpp,v 1.7 2000/11/02 01:46:20 dbertoni Exp $
*
*
* $State: Exp $
@@ -97,7 +97,7 @@
ElemCallTemplate (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.8 +3 -3 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemChoose.cpp 2000/08/22 20:21:16 1.7
+++ ElemChoose.cpp 2000/11/02 01:46:20 1.8
@@ -81,7 +81,7 @@
ElemChoose::ElemChoose(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -100,7 +100,7 @@
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -145,7 +145,7 @@
SelectionEvent(executionContext,
sourceNode,
*when,
- XalanDOMString(XALAN_STATIC_UCODE_STRING("test")),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("test")),
*theXPath,
test.get()));
}
1.5 +1 -9 xml-xalan/c/src/XSLT/ElemChoose.hpp
Index: ElemChoose.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemChoose.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemChoose.hpp 2000/04/11 15:09:23 1.4
+++ ElemChoose.hpp 2000/11/02 01:46:20 1.5
@@ -57,14 +57,6 @@
#if !defined(XALAN_ELEMCHOOSE_HEADER_GUARD)
#define XALAN_ELEMCHOOSE_HEADER_GUARD
-/**
- * $Id: ElemChoose.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
- *
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
// Base include file. Must be first.
@@ -98,7 +90,7 @@
ElemChoose(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.4 +5 -3 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemComment.cpp 2000/04/11 15:09:23 1.3
+++ ElemComment.cpp 2000/11/02 01:46:20 1.4
@@ -75,7 +75,7 @@
ElemComment::ElemComment(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -94,7 +94,7 @@
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -124,7 +124,9 @@
// | xsl:element
// | xsl:attribute
// ">
- const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ XalanDOMString data;
+
+ childrenToString(executionContext, sourceTree, sourceNode, mode, data);
executionContext.comment(toCharArray(data));
}
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemComment.hpp
Index: ElemComment.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemComment.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemComment.hpp 2000/04/11 15:09:23 1.4
+++ ElemComment.hpp 2000/11/02 01:46:21 1.5
@@ -86,7 +86,7 @@
ElemComment(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.7 +3 -3 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemCopy.cpp 2000/07/06 20:19:24 1.6
+++ ElemCopy.cpp 2000/11/02 01:46:21 1.7
@@ -74,7 +74,7 @@
ElemCopy::ElemCopy(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -95,7 +95,7 @@
processSpaceAttr(aname, atts, i) ||
isAttrOK(aname, atts, i, constructionContext)))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -139,7 +139,7 @@
sourceNode,
mode);
- const XalanDOMString s = sourceNode->getNodeName();
+ const XalanDOMString& s = sourceNode->getNodeName();
executionContext.endElement(toCharArray(s));
}
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemCopy.hpp
Index: ElemCopy.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemCopy.hpp 2000/04/11 15:09:23 1.4
+++ ElemCopy.hpp 2000/11/02 01:46:21 1.5
@@ -86,7 +86,7 @@
ElemCopy(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.9 +9 -4 xml-xalan/c/src/XSLT/ElemCopyOf.cpp
Index: ElemCopyOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemCopyOf.cpp 2000/09/19 15:11:40 1.8
+++ ElemCopyOf.cpp 2000/11/02 01:46:21 1.9
@@ -81,7 +81,7 @@
ElemCopyOf::ElemCopyOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -105,7 +105,7 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -131,8 +131,13 @@
if(0 != executionContext.getTraceListeners())
{
executionContext.fireSelectEvent(
- SelectionEvent(executionContext, sourceNode,
- *this, XalanDOMString(XALAN_STATIC_UCODE_STRING("select")), *m_pSelectPattern, value.get()));
+ SelectionEvent(
+ executionContext,
+ sourceNode,
+ *this,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
+ *m_pSelectPattern,
+ value.get()));
}
const XObject::eObjectType type = value->getType();
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemCopyOf.hpp
Index: ElemCopyOf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemCopyOf.hpp 2000/04/11 15:09:23 1.4
+++ ElemCopyOf.hpp 2000/11/02 01:46:22 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMCOPYOF_HEADER_GUARD
/**
- * $Id: ElemCopyOf.hpp,v 1.4 2000/04/11 15:09:23 dbertoni Exp $
+ * $Id: ElemCopyOf.hpp,v 1.5 2000/11/02 01:46:22 dbertoni Exp $
*
*
* $State: Exp $
@@ -97,7 +97,7 @@
ElemCopyOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.2 +1 -1 xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp
Index: ElemDecimalFormat.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemDecimalFormat.cpp 2000/04/11 15:07:55 1.1
+++ ElemDecimalFormat.cpp 2000/11/02 01:46:22 1.2
@@ -75,7 +75,7 @@
ElemDecimalFormat::ElemDecimalFormat(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
1.4 +1 -1 xml-xalan/c/src/XSLT/ElemDecimalFormat.hpp
Index: ElemDecimalFormat.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemDecimalFormat.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemDecimalFormat.hpp 2000/05/08 17:29:34 1.3
+++ ElemDecimalFormat.hpp 2000/11/02 01:46:22 1.4
@@ -94,7 +94,7 @@
ElemDecimalFormat(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.11 +50 -24 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ElemElement.cpp 2000/10/03 18:16:50 1.10
+++ ElemElement.cpp 2000/11/02 01:46:22 1.11
@@ -77,7 +77,7 @@
ElemElement::ElemElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -112,13 +112,13 @@
else if(!(processUseAttributeSets(constructionContext, aname, atts, i) || processSpaceAttr(aname, atts, i) ||
isAttrOK(aname, atts, i, constructionContext)))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(0 == m_nameAVT)
{
- constructionContext.error(name + " must have a name attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a name attribute.");
}
}
@@ -171,15 +171,15 @@
m_nameAVT->evaluate(elemName, sourceNode, *this, executionContext);
- bool isIllegalElement = false;
+ bool isIllegalElement = false;
- unsigned int len = length(elemName);
+ unsigned int len = length(elemName);
- const unsigned int indexOfNSSep = indexOf(elemName, XalanUnicode::charColon);
+ const unsigned int indexOfNSSep = indexOf(elemName, XalanUnicode::charColon);
- const bool haveNamespace = indexOfNSSep == len ? false : true;
+ const bool haveNamespace = indexOfNSSep == len ? false : true;
- XalanDOMString ns;
+ const XalanDOMString* ns = 0;
if(haveNamespace == true)
{
@@ -196,21 +196,20 @@
if (isIllegalElement == true)
{
- XalanDOMString msg("Illegal element name!");
+ executionContext.warn("Illegal element name!", sourceNode, this);
- executionContext.warn(msg, sourceNode, this);
-
clear(elemName);
+
len = 0;
}
else if (haveNamespace == true)
{
const XalanDOMString nsprefix = substring(elemName, 0, indexOfNSSep);
- ns = getNamespaceForPrefixInternal(nsprefix, false);
+ ns = &getNamespaceForPrefixInternal(nsprefix, false);
}
- const unsigned int nsLength = length(ns);
+ const unsigned int nsLength = ns == 0 ? 0 : length(*ns);
if (len != 0 && (haveNamespace == false || nsLength != 0))
{
@@ -222,24 +221,51 @@
if(!isEmpty(elemNameSpace))
{
- XalanDOMString prefix = executionContext.getResultPrefixForNamespace(elemNameSpace);
+ if(indexOfNSSep < len)
+ {
+ elemName = substring(elemName, indexOfNSSep + 1);
+ }
- if(isEmpty(prefix))
+ const XalanDOMString& prefix = executionContext.getResultPrefixForNamespace(elemNameSpace);
+
+ if(isEmpty(prefix) == false)
+ {
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+ elemName = prefix + DOMServices::s_XMLNamespaceSeparatorString + elemName;
+#else
+ reserve(
+ elemName,
+ length(elemName) + DOMServices::s_XMLNamespaceSeparatorStringLength + length(prefix) + 1);
+
+ insert(elemName, 0, DOMServices::s_XMLNamespaceSeparatorString);
+ insert(elemName, 0, prefix);
+#endif
+ }
+ else
{
- prefix = executionContext.getUniqueNameSpaceValue();
+ const XalanDOMString newPrefix(executionContext.getUniqueNameSpaceValue());
- const XalanDOMString nsDecl =
- DOMServices::s_XMLNamespaceWithSeparator + prefix;
+ XalanDOMString nsDecl;
+ reserve(nsDecl, DOMServices::s_XMLNamespaceWithSeparatorLength + length(newPrefix) + 1);
+
+ nsDecl = XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator);
+
+ append(nsDecl, newPrefix);
+
executionContext.addResultAttribute(nsDecl, elemNameSpace);
- }
- if(indexOfNSSep < len)
- {
- elemName = substring(elemName, indexOfNSSep + 1);
- }
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+ elemName = newPrefix + DOMServices::s_XMLNamespaceSeparatorString + elemName;
+#else
+ reserve(
+ elemName,
+ length(elemName) + DOMServices::s_XMLNamespaceSeparatorStringLength + length(newPrefix) + 1);
- elemName = prefix + DOMServices::s_XMLNamespaceSeparatorString + elemName;
+ insert(elemName, 0, DOMServices::s_XMLNamespaceSeparatorString);
+ insert(elemName, 0, newPrefix);
+#endif
+ }
}
}
1.6 +2 -2 xml-xalan/c/src/XSLT/ElemElement.hpp
Index: ElemElement.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemElement.hpp 2000/08/28 01:19:40 1.5
+++ ElemElement.hpp 2000/11/02 01:46:23 1.6
@@ -58,7 +58,7 @@
#define XALAN_ELEMELEMENT_HEADER_GUARD
/**
- * $Id: ElemElement.hpp,v 1.5 2000/08/28 01:19:40 dbertoni Exp $
+ * $Id: ElemElement.hpp,v 1.6 2000/11/02 01:46:23 dbertoni Exp $
*
*
* $State: Exp $
@@ -101,7 +101,7 @@
ElemElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.4 +1 -1 xml-xalan/c/src/XSLT/ElemEmpty.cpp
Index: ElemEmpty.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemEmpty.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemEmpty.cpp 2000/04/11 15:09:24 1.3
+++ ElemEmpty.cpp 2000/11/02 01:46:23 1.4
@@ -68,7 +68,7 @@
ElemEmpty::ElemEmpty(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber) :
ElemTemplateElement(constructionContext,
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemEmpty.hpp
Index: ElemEmpty.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemEmpty.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemEmpty.hpp 2000/04/11 15:09:24 1.4
+++ ElemEmpty.hpp 2000/11/02 01:46:23 1.5
@@ -89,7 +89,7 @@
ElemEmpty(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber);
1.6 +1 -1 xml-xalan/c/src/XSLT/ElemExtensionCall.cpp
Index: ElemExtensionCall.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemExtensionCall.cpp 2000/07/14 14:37:04 1.5
+++ ElemExtensionCall.cpp 2000/11/02 01:46:23 1.6
@@ -66,7 +66,7 @@
ElemExtensionCall::ElemExtensionCall(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
1.6 +1 -1 xml-xalan/c/src/XSLT/ElemExtensionCall.hpp
Index: ElemExtensionCall.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemExtensionCall.hpp 2000/05/26 19:24:43 1.5
+++ ElemExtensionCall.hpp 2000/11/02 01:46:23 1.6
@@ -92,7 +92,7 @@
ElemExtensionCall(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
1.3 +2 -2 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemFallback.cpp 2000/08/22 20:21:17 1.2
+++ ElemFallback.cpp 2000/11/02 01:46:24 1.3
@@ -76,7 +76,7 @@
ElemFallback::ElemFallback(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -105,7 +105,7 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
1.2 +1 -1 xml-xalan/c/src/XSLT/ElemFallback.hpp
Index: ElemFallback.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemFallback.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemFallback.hpp 2000/05/26 19:25:07 1.1
+++ ElemFallback.hpp 2000/11/02 01:46:24 1.2
@@ -85,7 +85,7 @@
ElemFallback(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.7 +3 -3 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemForEach.cpp 2000/09/19 15:11:42 1.6
+++ ElemForEach.cpp 2000/11/02 01:46:24 1.7
@@ -81,7 +81,7 @@
ElemForEach::ElemForEach(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
@@ -108,13 +108,13 @@
}
else if(!(isAttrOK(aname, atts, i, constructionContext) || processSpaceAttr(aname, atts, i)))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(0 == m_pSelectPattern)
{
- constructionContext.error(name + " requires attribute: " + Constants::ATTRNAME_SELECT);
+ constructionContext.error(XalanDOMString(name) + " requires attribute: " + Constants::ATTRNAME_SELECT);
}
}
}
1.6 +1 -1 xml-xalan/c/src/XSLT/ElemForEach.hpp
Index: ElemForEach.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemForEach.hpp 2000/04/11 15:09:24 1.5
+++ ElemForEach.hpp 2000/11/02 01:46:24 1.6
@@ -97,7 +97,7 @@
ElemForEach(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
1.8 +4 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemIf.cpp 2000/07/06 20:19:24 1.7
+++ ElemIf.cpp 2000/11/02 01:46:24 1.8
@@ -83,7 +83,7 @@
ElemIf::ElemIf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -117,14 +117,14 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
if(0 == m_test)
{
- constructionContext.error(name + " must have a 'test' attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a 'test' attribute.");
}
}
@@ -152,7 +152,7 @@
SelectionEvent(executionContext,
sourceNode,
*this,
- XALAN_STATIC_UCODE_STRING("test"),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("test")),
*m_test,
test.get()));
}
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemIf.hpp
Index: ElemIf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemIf.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemIf.hpp 2000/04/11 15:09:24 1.4
+++ ElemIf.hpp 2000/11/02 01:46:24 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMIF_HEADER_GUARD
/**
- * $Id: ElemIf.hpp,v 1.4 2000/04/11 15:09:24 dbertoni Exp $
+ * $Id: ElemIf.hpp,v 1.5 2000/11/02 01:46:24 dbertoni Exp $
*
* $State: Exp $
*
@@ -96,7 +96,7 @@
ElemIf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.23 +7 -7 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ElemLiteralResult.cpp 2000/10/03 15:23:35 1.22
+++ ElemLiteralResult.cpp 2000/11/02 01:46:24 1.23
@@ -88,7 +88,7 @@
ElemLiteralResult::ElemLiteralResult(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
@@ -123,11 +123,11 @@
if(!equals(prefix, DOMServices::s_XMLNamespace))
{
- const XalanDOMString ns = getNamespaceForPrefix(prefix);
+ const XalanDOMString& ns = getNamespaceForPrefix(prefix);
if(equals(ns, stylesheetTree.getXSLTNamespaceURI()))
{
- const XalanDOMString localName = substring(aname,indexOfNSSep + 1);
+ const XalanDOMString localName = substring(aname, indexOfNSSep + 1);
if(processPrefixControl(constructionContext, stylesheetTree, localName, atts.getValue(i)) == true)
{
@@ -296,7 +296,7 @@
{
const XalanDOMString prefix = substring(attrName, 0, indexOfNSSep);
- const XalanDOMString ns = getStylesheet().getNamespaceForPrefixFromStack(prefix);
+ const XalanDOMString& ns = getStylesheet().getNamespaceForPrefixFromStack(prefix);
if (equals(ns, constructionContext.getXSLTNamespaceURI()) == false)
{
@@ -321,17 +321,17 @@
StylesheetConstructionContext& constructionContext,
const Stylesheet& stylesheetTree,
const XalanDOMString& localName,
- const XalanDOMString& attrValue)
+ const XalanDOMChar* attrValue)
{
if(equals(localName, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
{
- m_namespacesHandler.processExtensionElementPrefixes(c_wstr(attrValue), stylesheetTree.getNamespaces(), constructionContext);
+ m_namespacesHandler.processExtensionElementPrefixes(attrValue, stylesheetTree.getNamespaces(), constructionContext);
return true;
}
else if (equals(localName, Constants::ATTRNAME_EXCLUDE_RESULT_PREFIXES))
{
- m_namespacesHandler.processExcludeResultPrefixes(c_wstr(attrValue), stylesheetTree.getNamespaces(), constructionContext);
+ m_namespacesHandler.processExcludeResultPrefixes(attrValue, stylesheetTree.getNamespaces(), constructionContext);
return true;
}
1.13 +3 -3 xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
Index: ElemLiteralResult.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemLiteralResult.hpp 2000/09/19 15:11:43 1.12
+++ ElemLiteralResult.hpp 2000/11/02 01:46:24 1.13
@@ -94,7 +94,7 @@
ElemLiteralResult(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
@@ -159,8 +159,8 @@
processPrefixControl(
StylesheetConstructionContext& constructionContext,
const Stylesheet& stylesheetTree,
- const XalanDOMString& localName,
- const XalanDOMString& attrValue);
+ const XalanDOMString& localName,
+ const XalanDOMChar* attrValue);
/**
* Determine if the namespace node should be excluded.
1.5 +8 -8 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemMessage.cpp 2000/05/24 19:38:48 1.4
+++ ElemMessage.cpp 2000/11/02 01:46:24 1.5
@@ -75,7 +75,7 @@
ElemMessage::ElemMessage(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -103,15 +103,13 @@
}
else if (equals(avalue, Constants::ATTRVAL_NO) == false)
{
- constructionContext.error(XalanDOMString("Attribute terminate has an illegal value: ") +
+ constructionContext.error("Attribute terminate has an illegal value: " +
XalanDOMString(avalue));
}
}
else if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(XalanDOMString(name) +
- " has an illegal attribute: " +
- XalanDOMString(aname));
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + XalanDOMString(aname));
}
}
}
@@ -127,8 +125,10 @@
{
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
- const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ XalanDOMString data;
+ childrenToString(executionContext, sourceTree, sourceNode, mode, data);
+
executionContext.message(data, sourceNode, this);
if (m_terminate == true)
@@ -139,9 +139,9 @@
-ElemMessage::ElemMessageTerminateException::ElemMessageTerminateException(const DOMString& theMessage) :
+ElemMessage::ElemMessageTerminateException::ElemMessageTerminateException(const XalanDOMString& theMessage) :
XSLTProcessorException(theMessage,
- XALAN_STATIC_UCODE_STRING("ElemMessageTerminateException"))
+ TranscodeFromLocalCodePage("ElemMessageTerminateException"))
{
}
1.6 +2 -2 xml-xalan/c/src/XSLT/ElemMessage.hpp
Index: ElemMessage.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemMessage.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemMessage.hpp 2000/05/24 19:38:48 1.5
+++ ElemMessage.hpp 2000/11/02 01:46:24 1.6
@@ -87,7 +87,7 @@
ElemMessage(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -110,7 +110,7 @@
*
* @param theMessage message to print when exception thrown
*/
- ElemMessageTerminateException(const DOMString& theMessage);
+ ElemMessageTerminateException(const XalanDOMString& theMessage);
virtual
1.28 +84 -32 xml-xalan/c/src/XSLT/ElemNumber.cpp
Index: ElemNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ElemNumber.cpp 2000/10/11 19:43:06 1.27
+++ ElemNumber.cpp 2000/11/02 01:46:24 1.28
@@ -68,12 +68,15 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/DoubleSupport.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
#include <PlatformSupport/XalanNumberFormat.hpp>
#include <PlatformSupport/XalanUnicode.hpp>
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <XPath/XPath.hpp>
#include <XPath/XObjectFactory.hpp>
@@ -95,7 +98,7 @@
ElemNumber::ElemNumber(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -133,7 +136,7 @@
else if(equals(levelValue,Constants::ATTRVAL_SINGLE))
m_level = Constants::NUMBERLEVEL_SINGLE;
else
- error(XalanDOMString("Bad value on level attribute: ") + levelValue);
+ error("Bad value on level attribute." + XalanDOMString(levelValue));
}
else if(equals(aname, Constants::ATTRNAME_COUNT))
{
@@ -177,7 +180,7 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
@@ -370,8 +373,8 @@
XalanNode* sourceNode) const
{
assert(sourceNode != 0);
+
IntArrayType numberList;
- CountersTable ctable;
if(0 != m_valueExpr)
{
@@ -393,6 +396,8 @@
}
else
{
+ CountersTable ctable;
+
if(Constants::NUMBERLEVEL_ANY == m_level)
{
numberList.push_back(ctable.countNode(
@@ -402,7 +407,7 @@
}
else
{
- MutableNodeRefList ancestors = getMatchingAncestors(executionContext, sourceNode,
+ const MutableNodeRefList ancestors = getMatchingAncestors(executionContext, sourceNode,
Constants::NUMBERLEVEL_SINGLE == m_level);
const unsigned int lastIndex = ancestors.getLength();
@@ -412,6 +417,7 @@
for(unsigned int i = 0; i < lastIndex; i++)
{
XalanNode* const target = ancestors.item(lastIndex - i - 1);
+
numberList.push_back(ctable.countNode(
executionContext,
this,
@@ -603,7 +609,7 @@
}
if(0 == countMatchPattern)
- error(XalanDOMString("Programmers error! countMatchPattern should never be 0!"));
+ error(TranscodeFromLocalCodePage("Programmer error! countMatchPattern should never be 0!"));
if(countMatchPattern->getMatchScore(node, *this, executionContext) !=
XPath::s_MatchScoreNone)
@@ -1035,24 +1041,22 @@
int numberWidth,
int listElement) const
{
- XalanDOMString formattedNumber;
-
switch(numberType)
{
case XalanUnicode::charLetter_A:
- formattedNumber += int2alphaCount(listElement, s_alphaCountTable);
+ return int2alphaCount(listElement, s_alphaCountTable);
break;
case XalanUnicode::charLetter_a:
- formattedNumber += toLowerCase(int2alphaCount(listElement, s_alphaCountTable));
+ return toLowerCase(int2alphaCount(listElement, s_alphaCountTable));
break;
case XalanUnicode::charLetter_I:
- formattedNumber += long2roman(listElement, true);
+ return long2roman(listElement, true);
break;
case XalanUnicode::charLetter_i:
- formattedNumber += toLowerCase(long2roman(listElement, true));
+ return toLowerCase(long2roman(listElement, true));
break;
case 0x3042:
@@ -1066,36 +1070,42 @@
case 0x10D0:
case 0x0430:
executionContext.error(LongToDOMString(numberType) + " format not supported yet!");
+ return XalanDOMString();
break;
// Handle the special case of Greek letters for now
case 0x03B1:
- formattedNumber += int2alphaCount(listElement, s_elalphaCountTable);
+ return int2alphaCount(listElement, s_elalphaCountTable);
break;
default: // "1"
{
StylesheetExecutionContext::XalanNumberFormatAutoPtr formatter(
getNumberFormatter(executionContext, contextNode));
-
- XalanDOMString padString = formatter->format(0);
- const XalanDOMString numString =
+ XalanDOMString numString =
formatter->format(listElement);
- const int nPadding = numberWidth - length(numString);
+ const unsigned int lengthNumString = length(numString);
- for(int i = 0; i < nPadding; i++)
+ const int nPadding = numberWidth - lengthNumString;
+
+ if (nPadding > 0)
{
- formattedNumber += padString;
+ const XalanDOMString padString = formatter->format(0);
+
+ reserve(numString, nPadding * length(padString) + lengthNumString + 1);
+
+ for(int i = 0; i < nPadding; i++)
+ {
+ insert(numString, 0, padString);
+ }
}
- formattedNumber += numString;
+ return numString;
}
break;
}
-
- return formattedNumber;
}
@@ -1116,9 +1126,10 @@
}
else
{
- return XalanDOMString(charAt(table, val - 1));
- }
+ const XalanDOMChar theChar = charAt(table, val - 1);
+ return XalanDOMString(&theChar, 1);
+ }
}
@@ -1574,13 +1585,54 @@
::s_romanConvertTable.reserve(7);
- ::s_romanConvertTable.push_back(DecimalToRoman(1000, XALAN_STATIC_UCODE_STRING("M"), 900, XALAN_STATIC_UCODE_STRING("CM")));
- ::s_romanConvertTable.push_back(DecimalToRoman(500, XALAN_STATIC_UCODE_STRING("D"), 400, XALAN_STATIC_UCODE_STRING("CD")));
- ::s_romanConvertTable.push_back(DecimalToRoman(100L, XALAN_STATIC_UCODE_STRING("C"), 90L, XALAN_STATIC_UCODE_STRING("XC")));
- ::s_romanConvertTable.push_back(DecimalToRoman(50L, XALAN_STATIC_UCODE_STRING("L"), 40L, XALAN_STATIC_UCODE_STRING("XL")));
- ::s_romanConvertTable.push_back(DecimalToRoman(10L, XALAN_STATIC_UCODE_STRING("X"), 9L, XALAN_STATIC_UCODE_STRING("IX")));
- ::s_romanConvertTable.push_back(DecimalToRoman(5L, XALAN_STATIC_UCODE_STRING("V"), 4L, XALAN_STATIC_UCODE_STRING("IV")));
- ::s_romanConvertTable.push_back(DecimalToRoman(1L, XALAN_STATIC_UCODE_STRING("I"), 1L, XALAN_STATIC_UCODE_STRING("I")));
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 1000L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("M")),
+ 900L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("CM"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 500L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("D")),
+ 400,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("CD"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 100L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("C")),
+ 90L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("XC"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 50L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("L")),
+ 40L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("XL"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 10L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("X")),
+ 9L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("IX"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 5L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("V")),
+ 4L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("IV"))));
+
+ ::s_romanConvertTable.push_back(
+ DecimalToRoman(
+ 1L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("I")),
+ 1L,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("I"))));
}
1.20 +2 -2 xml-xalan/c/src/XSLT/ElemNumber.hpp
Index: ElemNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ElemNumber.hpp 2000/09/20 18:29:38 1.19
+++ ElemNumber.hpp 2000/11/02 01:46:24 1.20
@@ -58,7 +58,7 @@
#define XALAN_ELEMNUMBER_HEADER_GUARD
/**
- * $Id: ElemNumber.hpp,v 1.19 2000/09/20 18:29:38 auriemma Exp $
+ * $Id: ElemNumber.hpp,v 1.20 2000/11/02 01:46:24 dbertoni Exp $
*
* $State: Exp $
*
@@ -145,7 +145,7 @@
ElemNumber(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.4 +2 -2 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemOtherwise.cpp 2000/04/11 15:09:25 1.3
+++ ElemOtherwise.cpp 2000/11/02 01:46:24 1.4
@@ -74,7 +74,7 @@
ElemOtherwise::ElemOtherwise(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -93,7 +93,7 @@
if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
1.5 +1 -8 xml-xalan/c/src/XSLT/ElemOtherwise.hpp
Index: ElemOtherwise.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemOtherwise.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemOtherwise.hpp 2000/04/11 15:09:25 1.4
+++ ElemOtherwise.hpp 2000/11/02 01:46:25 1.5
@@ -57,13 +57,6 @@
#if !defined(XALAN_ELEMOTHERWISE_HEADER_GUARD)
#define XALAN_ELEMOTHERWISE_HEADER_GUARD
-/**
- * $Id: ElemOtherwise.hpp,v 1.4 2000/04/11 15:09:25 dbertoni Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
// Base include file. Must be first.
@@ -93,7 +86,7 @@
ElemOtherwise(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.5 +6 -4 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemPI.cpp 2000/05/24 19:38:48 1.4
+++ ElemPI.cpp 2000/11/02 01:46:25 1.5
@@ -75,7 +75,7 @@
ElemPI::ElemPI(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -99,13 +99,13 @@
}
else if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(isEmpty(m_name_atv) == true)
{
- constructionContext.error(name + " must have a name attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a name attribute.");
}
}
@@ -140,7 +140,9 @@
error("processing-instruction name must be a valid NCName: " + piName);
}
- const XalanDOMString data = childrenToString(executionContext, sourceTree, sourceNode, mode);
+ XalanDOMString data;
+
+ childrenToString(executionContext, sourceTree, sourceNode, mode, data);
executionContext.processingInstruction(toCharArray(piName), toCharArray(data));
}
1.6 +2 -8 xml-xalan/c/src/XSLT/ElemPI.hpp
Index: ElemPI.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemPI.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemPI.hpp 2000/05/24 19:38:48 1.5
+++ ElemPI.hpp 2000/11/02 01:46:25 1.6
@@ -57,14 +57,8 @@
#if !defined(XALAN_ELEMPI_HEADER_GUARD)
#define XALAN_ELEMPI_HEADER_GUARD
-/**
- * $Id: ElemPI.hpp,v 1.5 2000/05/24 19:38:48 dbertoni Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -93,7 +87,7 @@
ElemPI(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.6 +1 -1 xml-xalan/c/src/XSLT/ElemParam.cpp
Index: ElemParam.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemParam.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemParam.cpp 2000/07/06 20:19:25 1.5
+++ ElemParam.cpp 2000/11/02 01:46:25 1.6
@@ -73,7 +73,7 @@
ElemParam::ElemParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemParam.hpp
Index: ElemParam.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemParam.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemParam.hpp 2000/04/11 15:09:26 1.4
+++ ElemParam.hpp 2000/11/02 01:46:25 1.5
@@ -86,7 +86,7 @@
ElemParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.5 +3 -3 xml-xalan/c/src/XSLT/ElemSort.cpp
Index: ElemSort.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemSort.cpp 2000/06/18 16:37:39 1.4
+++ ElemSort.cpp 2000/11/02 01:46:25 1.5
@@ -74,7 +74,7 @@
ElemSort::ElemSort(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -121,12 +121,12 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
if(0 == m_selectPattern)
{
- m_selectPattern = constructionContext.createXPath(XalanDOMString(XALAN_STATIC_UCODE_STRING(".")), *this);
+ m_selectPattern = constructionContext.createXPath(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING(".")), *this);
}
}
1.5 +2 -8 xml-xalan/c/src/XSLT/ElemSort.hpp
Index: ElemSort.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemSort.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemSort.hpp 2000/04/11 15:09:26 1.4
+++ ElemSort.hpp 2000/11/02 01:46:25 1.5
@@ -57,14 +57,8 @@
#if !defined(XALAN_ELEMSORT_HEADER_GUARD)
#define XALAN_ELEMSORT_HEADER_GUARD
-/**
- * $Id: ElemSort.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -100,7 +94,7 @@
ElemSort(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.8 +22 -10 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemTemplate.cpp 2000/08/28 01:19:40 1.7
+++ ElemTemplate.cpp 2000/11/02 01:46:25 1.8
@@ -78,12 +78,12 @@
ElemTemplate::ElemTemplate(
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const XalanDOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber) :
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMChar* name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber) :
ElemTemplateElement(constructionContext,
stylesheetTree,
name,
@@ -116,8 +116,9 @@
case Constants::TATTRNAME_PRIORITY:
{
- const XalanDOMString priorityVal = atts.getValue(i);
- m_priority = DoubleSupport::toDouble(priorityVal);
+ assert(atts.getValue(i) != 0);
+
+ m_priority = DoubleSupport::toDouble(atts.getValue(i));
}
break;
@@ -132,14 +133,14 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
if(0 == m_matchPattern && m_name.isEmpty() == true)
{
- constructionContext.error(name + " requires either a name or a match attribute.");
+ constructionContext.error(XalanDOMString(name) + " requires either a name or a match attribute.");
}
}
@@ -161,4 +162,15 @@
ElemTemplateElement::execute(executionContext, sourceTree, sourceNode, mode);
executeChildren(executionContext, sourceTree, sourceNode, mode);
+}
+
+
+
+void
+ElemTemplate::execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const
+{
+ execute(executionContext, sourceTree, sourceNode, s_emptyMode);
}
1.5 +13 -14 xml-xalan/c/src/XSLT/ElemTemplate.hpp
Index: ElemTemplate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemTemplate.hpp 2000/04/11 15:09:26 1.4
+++ ElemTemplate.hpp 2000/11/02 01:46:25 1.5
@@ -57,14 +57,8 @@
#if !defined(XALAN_ELEMTEMPLATE_HEADER_GUARD)
#define XALAN_ELEMTEMPLATE_HEADER_GUARD
-/**
- * $Id: ElemTemplate.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
- *
- * $State: Exp $
- *
- * @author Myriam Midy (Myriam_Midy @lotus.com
- */
+
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
@@ -100,12 +94,12 @@
* @param columnNumber column number in document
*/
ElemTemplate(
- StylesheetConstructionContext& constructionContext,
- Stylesheet& stylesheetTree,
- const XalanDOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber);
+ StylesheetConstructionContext& constructionContext,
+ Stylesheet& stylesheetTree,
+ const XalanDOMChar* name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber);
virtual
~ElemTemplate();
@@ -155,13 +149,18 @@
}
// These methods are inherited from ElemTemplateElement ...
-
virtual void
execute(
StylesheetExecutionContext& executionContext,
XalanNode* sourceTree,
XalanNode* sourceNode,
const QName& mode) const;
+
+ virtual void
+ execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const;
private:
1.37 +63 -55 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.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ElemTemplateElement.cpp 2000/10/12 17:07:47 1.36
+++ ElemTemplateElement.cpp 2000/11/02 01:46:25 1.37
@@ -106,19 +106,15 @@
-/**
- * @param processor The XSLT Processor.
- * @param stylesheetTree The owning stylesheet.
- * @param name The name of the element.
- * @param atts The element attributes.
- * @param lineNumber The line in the XSLT file that the element occurs on.
- * @param columnNumber The column index in the XSLT file that the element occurs on.
- * @exception SAXException Never.
- */
+const QName ElemTemplateElement::s_emptyMode;
+const XalanDOMString ElemTemplateElement::s_emptyString;
+
+
+
ElemTemplateElement::ElemTemplateElement(
StylesheetConstructionContext& /* constructionContext */,
- Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ Stylesheet& stylesheetTree,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber,
int xslToken) :
@@ -129,7 +125,7 @@
m_lineNumber(lineNumber),
m_columnNumber(columnNumber),
m_defaultSpace(true),
- m_elemName(name),
+ m_elemName(XalanDOMString(name)),
m_xslToken(xslToken),
m_parentNode(0),
m_nextSibling(0),
@@ -210,7 +206,7 @@
}
else
{
- error(XalanDOMString("xml:space has an illegal value: ") + spaceVal);
+ error(TranscodeFromLocalCodePage("xml:space has an illegal value: ") + spaceVal);
}
}
@@ -238,7 +234,7 @@
}
else
{
- error(XalanDOMString("xml:space has an illegal value: ") + spaceVal);
+ error(TranscodeFromLocalCodePage("xml:space has an illegal value: ") + spaceVal);
}
}
@@ -295,6 +291,17 @@
void
+ElemTemplateElement::execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const
+{
+ execute(executionContext, sourceTree, sourceNode, s_emptyMode);
+}
+
+
+
+void
ElemTemplateElement::executeChildren(
StylesheetExecutionContext& executionContext,
XalanNode* sourceTree,
@@ -311,28 +318,29 @@
-XalanDOMString
+void
ElemTemplateElement::childrenToString(
StylesheetExecutionContext& executionContext,
XalanNode* sourceTree,
XalanNode* sourceNode,
- const QName& mode) const
+ const QName& mode,
+ XalanDOMString& result) const
{
+ reserve(result, length(result) + 1024);
+
// Create a print writer and formatter to generate the children as
// a string.
- DOMStringPrintWriter thePrintWriter;
+ DOMStringPrintWriter thePrintWriter(result);
// Create a FormatterToText.
FormatterToText theFormatter(thePrintWriter);
// Create an object to set and restore the execution state.
- StylesheetExecutionContext::ExecutionStateSetAndRestore theStateSetAndRestore(
+ StylesheetExecutionContext::OutputContextPushPop theOutputContextPushPop(
executionContext,
&theFormatter);
executeChildren(executionContext, sourceTree, sourceNode, mode);
-
- return thePrintWriter.getString();
}
@@ -680,7 +688,7 @@
SelectionEvent(executionContext,
sourceNodeContext,
*this,
- XALAN_STATIC_UCODE_STRING("select"),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
*selectPattern,
result.get()));
}
@@ -874,7 +882,7 @@
if(XalanNode::DOCUMENT_NODE != childNode->getNodeType() && ownerDoc == 0)
{
- error(XalanDOMString("Child node does not have an owner document!"));
+ error("Child node does not have an owner document!");
}
transformChild(
@@ -1023,8 +1031,16 @@
}
+
+void
+ElemTemplateElement::error(const char* msg) const
+{
+ error(TranscodeFromLocalCodePage(msg));
+}
-XalanDOMString
+
+
+const XalanDOMString&
ElemTemplateElement::getNodeName() const
{
return m_elemName;
@@ -1032,10 +1048,10 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getNodeValue() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1260,27 +1276,27 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getNamespaceURI() const
{
// $$ ToDo: Is this the same value as PrefixResolver::getURI()?
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getPrefix() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getLocalName() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1308,16 +1324,8 @@
}
-
-XalanDOMString
-ElemTemplateElement::getXSLTData() const
-{
- return DOMString();
-}
-
-
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getTagName() const
{
return m_elemName;
@@ -1325,10 +1333,10 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getAttribute(const XalanDOMString& /* name */) const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1398,12 +1406,12 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getAttributeNS(
const XalanDOMString& /* namespaceURI */,
const XalanDOMString& /* localName */) const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1459,7 +1467,7 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
return getNamespaceForPrefixInternal(prefix, true);
@@ -1467,12 +1475,12 @@
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getNamespaceForPrefixInternal(
const XalanDOMString& prefix,
bool fReportError) const
{
- XalanDOMString nameSpace;
+ const XalanDOMString* nameSpace = &DOMServices::s_emptyString;
if (isEmpty(prefix) == false)
{
@@ -1482,7 +1490,7 @@
{
if (equals(prefix, DOMServices::s_XMLString) == true)
{
- nameSpace = DOMServices::s_XMLNamespaceURI;
+ nameSpace = &DOMServices::s_XMLNamespaceURI;
}
else if (equals(prefix, DOMServices::s_XMLNamespace) == true)
{
@@ -1490,34 +1498,34 @@
}
else
{
- nameSpace = getNamespacesHandler().getNamespace(prefix);
+ nameSpace = &getNamespacesHandler().getNamespace(prefix);
- if(isEmpty(nameSpace) == true)
+ if(isEmpty(*nameSpace) == true)
{
if (m_parentNode != 0)
{
- nameSpace = m_parentNode->getNamespaceForPrefixInternal(prefix, false);
+ nameSpace = &m_parentNode->getNamespaceForPrefixInternal(prefix, false);
}
}
}
}
else
{
- nameSpace = getStylesheet().getNamespaceForPrefixFromStack(prefix);
+ nameSpace = &getStylesheet().getNamespaceForPrefixFromStack(prefix);
}
- if(fReportError == true && fEmptyIsError == true && isEmpty(nameSpace) == true)
+ if(fReportError == true && fEmptyIsError == true && isEmpty(*nameSpace) == true)
{
error("Cannot resolve namespace prefix: " + prefix);
}
}
- return nameSpace;
+ return *nameSpace;
}
-XalanDOMString
+const XalanDOMString&
ElemTemplateElement::getURI() const
{
return m_baseIndentifier;
1.19 +46 -28 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ElemTemplateElement.hpp 2000/10/11 19:43:06 1.18
+++ ElemTemplateElement.hpp 2000/11/02 01:46:25 1.19
@@ -98,14 +98,6 @@
class XPath;
-/**
- * An instance of this class represents an element inside
- * an xsl:template class. It has a single "execute" method
- * which is expected to perform the given action on the
- * result tree.
- *
- * @see class Stylesheet
- */
class ElemTemplateElement : public XalanElement, public PrefixResolver
{
@@ -113,7 +105,7 @@
/**
* Construct a template element instance.
*
- * @param constructionContext context when object consructed
+ * @param constructionContext context when object constructed
* @param stylesheetTree owning stylesheet
* @param name name of the element
* @param lineNumber line in the XSLT file where the element occurs
@@ -124,7 +116,7 @@
ElemTemplateElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber,
int xslToken);
@@ -218,6 +210,20 @@
const QName& mode) const;
/**
+ * Execute the element's primary function. Subclasses of this function may
+ * recursively execute down the element tree.
+ *
+ * @param executionContext The current execution context
+ * @param sourceTree input source tree
+ * @param sourceNode current context node
+ */
+ virtual void
+ execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const;
+
+ /**
* Process the children of a template.
*
* @param processor XSLT processor instance
@@ -240,14 +246,15 @@
* @param sourceTree primary source tree
* @param sourceNode current source node context
* @param mode current mode
- * @return stringized result of executing the elements children
+ * @param result result of executing the elements children
*/
- XalanDOMString
+ void
childrenToString(
StylesheetExecutionContext& executionContext,
XalanNode* sourceTree,
XalanNode* sourceNode,
- const QName& mode) const;
+ const QName& mode,
+ XalanDOMString& result) const;
/**
@@ -282,6 +289,15 @@
error(const XalanDOMString& msg) const;
/**
+ * Throw a template element runtime error.
+ * (Note: should we throw a SAXException instead?)
+ *
+ * @param msg Description of the error that occurred
+ */
+ virtual void
+ error(const char* msg) const;
+
+ /**
* Get the line number where the element occurs in the xsl file.
*
* @return line number
@@ -303,7 +319,7 @@
return m_columnNumber;
}
- const XalanDOMString
+ const XalanDOMString&
getElementName() const
{
return m_elemName;
@@ -474,10 +490,10 @@
// These interfaces are inherited from XalanElement ...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
virtual NodeType
@@ -550,13 +566,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
virtual void
@@ -567,14 +583,11 @@
virtual unsigned long
getIndex() const;
-
- virtual XalanDOMString
- getXSLTData() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getTagName() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttribute(const XalanDOMString& name) const;
virtual XalanAttr*
@@ -597,7 +610,7 @@
virtual void
removeAttribute(const XalanDOMString& name);
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
@@ -629,10 +642,10 @@
// These interfaces are inherited from PrefixResolver...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getURI() const;
protected:
@@ -644,7 +657,7 @@
* @param fReportError If true, and exception will be thrown to report the error.
* @return The namespace string.
*/
- XalanDOMString
+ const XalanDOMString&
getNamespaceForPrefixInternal(
const XalanDOMString& prefix,
bool fReportError) const;
@@ -804,6 +817,9 @@
bool m_finishedConstruction;
+
+ static const QName s_emptyMode;
+
private:
Stylesheet& m_stylesheet;
@@ -826,6 +842,8 @@
XalanEmptyNamedNodeMap m_fakeAttributes;
const XalanDOMString m_baseIndentifier;
+
+ static const XalanDOMString s_emptyString;
};
1.4 +2 -2 xml-xalan/c/src/XSLT/ElemText.cpp
Index: ElemText.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemText.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemText.cpp 2000/04/11 15:09:26 1.3
+++ ElemText.cpp 2000/11/02 01:46:26 1.4
@@ -79,7 +79,7 @@
ElemText::ElemText(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -106,7 +106,7 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
1.5 +2 -2 xml-xalan/c/src/XSLT/ElemText.hpp
Index: ElemText.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemText.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemText.hpp 2000/04/11 15:09:26 1.4
+++ ElemText.hpp 2000/11/02 01:46:26 1.5
@@ -58,7 +58,7 @@
#define XALAN_ELEMTEXT_HEADER_GUARD
/**
- * $Id: ElemText.hpp,v 1.4 2000/04/11 15:09:26 dbertoni Exp $
+ * $Id: ElemText.hpp,v 1.5 2000/11/02 01:46:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -98,7 +98,7 @@
ElemText(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.7 +1 -1 xml-xalan/c/src/XSLT/ElemTextLiteral.cpp
Index: ElemTextLiteral.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemTextLiteral.cpp 2000/10/12 17:07:48 1.6
+++ ElemTextLiteral.cpp 2000/11/02 01:46:26 1.7
@@ -84,7 +84,7 @@
bool disableOutputEscaping) :
ElemTemplateElement(constructionContext,
stylesheetTree,
- Constants::PSEUDONAME_TEXT,
+ c_wstr(Constants::PSEUDONAME_TEXT),
lineNumber,
columnNumber,
Constants::ELEMNAME_TEXTLITERALRESULT),
1.6 +3 -3 xml-xalan/c/src/XSLT/ElemUse.cpp
Index: ElemUse.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemUse.cpp 2000/08/27 04:09:11 1.5
+++ ElemUse.cpp 2000/11/02 01:46:26 1.6
@@ -83,7 +83,7 @@
ElemUse::ElemUse(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber,
int xslToken) :
@@ -124,7 +124,7 @@
bool
ElemUse::processUseAttributeSets(
StylesheetConstructionContext& constructionContext,
- const XalanDOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
int which)
{
@@ -148,7 +148,7 @@
const XalanDOMChar* const qnames = atts.getValue(which);
StringTokenizer tokenizer(qnames,
- XALAN_STATIC_UCODE_STRING(" \t\n\r"),
+ c_wstr(XALAN_STATIC_UCODE_STRING(" \t\n\r")),
false);
const unsigned int numTokens = tokenizer.countTokens();
1.6 +2 -2 xml-xalan/c/src/XSLT/ElemUse.hpp
Index: ElemUse.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemUse.hpp 2000/04/11 15:09:26 1.5
+++ ElemUse.hpp 2000/11/02 01:46:26 1.6
@@ -96,7 +96,7 @@
ElemUse(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
int lineNumber,
int columnNumber,
int xslToken = Constants::ELEMNAME_USE);
@@ -116,7 +116,7 @@
bool
processUseAttributeSets(
StylesheetConstructionContext& constructionContext,
- const XalanDOMString& attrName,
+ const XalanDOMChar* attrName,
const AttributeList& atts,
int which);
1.13 +59 -31 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ElemValueOf.cpp 2000/09/19 15:11:49 1.12
+++ ElemValueOf.cpp 2000/11/02 01:46:26 1.13
@@ -66,6 +66,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
@@ -83,7 +87,7 @@
ElemValueOf::ElemValueOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -135,14 +139,14 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
if(0 == m_selectPattern)
{
- constructionContext.error(name + " requires a select attribute.");
+ constructionContext.error(XalanDOMString(name) + " requires a select attribute.");
}
}
@@ -165,32 +169,29 @@
if (m_isDot == true)
{
- XalanDOMString theValue;
+// const XalanNode::NodeType type = sourceNode->getNodeType();
- const XalanNode::NodeType type = sourceNode->getNodeType();
+// if(type == XalanNode::COMMENT_NODE ||
+// type == XalanNode::PROCESSING_INSTRUCTION_NODE)
+// {
+// outputValue(executionContext, sourceNode->getNodeValue());
- if(type == XalanNode::COMMENT_NODE ||
- type == XalanNode::PROCESSING_INSTRUCTION_NODE)
- {
- theValue = sourceNode->getNodeValue();
- }
- else
+// if(0 != executionContext.getTraceListeners())
+// {
+// fireSelectionEvent(executionContext, sourceNode, theValue);
+// }
+// }
+// else
{
- theValue = sourceNode->getXSLTData();
- }
+ const XalanDOMString theValue = DOMServices::getNodeData(*sourceNode);
- if(0 != executionContext.getTraceListeners())
- {
- executionContext.fireSelectEvent(
- SelectionEvent(executionContext,
- sourceNode,
- *this,
- XalanDOMString(XALAN_STATIC_UCODE_STRING("select")),
- *m_selectPattern,
- executionContext.getXObjectFactory().createString(theValue)));
- }
+ outputValue(executionContext, theValue);
- outputValue(executionContext, theValue);
+ if(0 != executionContext.getTraceListeners())
+ {
+ fireSelectionEvent(executionContext, sourceNode, theValue);
+ }
+ }
}
else
{
@@ -200,13 +201,7 @@
if(0 != executionContext.getTraceListeners())
{
- executionContext.fireSelectEvent(
- SelectionEvent(executionContext,
- sourceNode,
- *this,
- XalanDOMString(XALAN_STATIC_UCODE_STRING("select")),
- *m_selectPattern,
- value.get()));
+ fireSelectionEvent(executionContext, sourceNode, value.get());
}
if(0 != value.get())
@@ -241,4 +236,37 @@
executionContext.charactersRaw(toCharArray(theValue), 0, len);
}
}
+}
+
+
+
+void
+ElemValueOf:: fireSelectionEvent(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceNode,
+ const XalanDOMString& theValue) const
+{
+ const XObjectGuard value(
+ executionContext.getXObjectFactory(),
+ executionContext.getXObjectFactory().createString(theValue));
+
+ fireSelectionEvent(executionContext, sourceNode, value.get());
+}
+
+
+
+void
+ElemValueOf::fireSelectionEvent(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceNode,
+ const XObject* theValue) const
+{
+ executionContext.fireSelectEvent(
+ SelectionEvent(
+ executionContext,
+ sourceNode,
+ *this,
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
+ *m_selectPattern,
+ theValue));
}
1.7 +14 -1 xml-xalan/c/src/XSLT/ElemValueOf.hpp
Index: ElemValueOf.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemValueOf.hpp 2000/09/19 15:11:50 1.6
+++ ElemValueOf.hpp 2000/11/02 01:46:26 1.7
@@ -69,6 +69,7 @@
+class XObject;
class XPath;
@@ -90,7 +91,7 @@
ElemValueOf(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
@@ -119,6 +120,18 @@
outputValue(
StylesheetExecutionContext& executionContext,
const XalanDOMString& theValue) const;
+
+ void
+ fireSelectionEvent(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceNode,
+ const XalanDOMString& theValue) const;
+
+ void
+ fireSelectionEvent(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceNode,
+ const XObject* theValue) const;
/**
* The select pattern used to locate the value.
1.8 +15 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemVariable.cpp 2000/07/21 19:52:55 1.7
+++ ElemVariable.cpp 2000/11/02 01:46:26 1.8
@@ -83,7 +83,7 @@
ElemVariable::ElemVariable(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
@@ -127,14 +127,14 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
if(m_qname.isEmpty())
{
- constructionContext.error(name + " must have a 'name' attribute.");
+ constructionContext.error(XalanDOMString(name) + " must have a 'name' attribute.");
}
}
@@ -171,7 +171,7 @@
executionContext,
sourceNode,
*this,
- XalanDOMString(XALAN_STATIC_UCODE_STRING("select")),
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
*m_selectPattern,
executionContext.getVariable(m_qname)));
}
@@ -185,4 +185,15 @@
sourceTree,
sourceNode);
}
+}
+
+
+
+void
+ElemVariable::execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const
+{
+ execute(executionContext, sourceTree, sourceNode, s_emptyMode);
}
1.6 +8 -15 xml-xalan/c/src/XSLT/ElemVariable.hpp
Index: ElemVariable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemVariable.hpp 2000/07/21 19:52:55 1.5
+++ ElemVariable.hpp 2000/11/02 01:46:26 1.6
@@ -58,7 +58,7 @@
#define XALAN_ELEMVARIABLE_HEADER_GUARD
/**
- * $Id: ElemVariable.hpp,v 1.5 2000/07/21 19:52:55 dbertoni Exp $
+ * $Id: ElemVariable.hpp,v 1.6 2000/11/02 01:46:26 dbertoni Exp $
*
* $State: Exp $
*
@@ -103,7 +103,7 @@
ElemVariable(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const DOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber,
@@ -113,19 +113,6 @@
~ElemVariable();
/**
- * Get the XObject representation of the variable.
- *
- * @param executionContext current execution context
- * @param sourceTree input source tree
- * @param sourceNode current context node
- */
-// XObject*
-// getValue(
-// StylesheetExecutionContext& executionContext,
-// XalanNode* sourceTree,
-// XalanNode* sourceNode) const;
-
- /**
* Determines if this is a top level variable.
*
* @return true if it is a top level variable
@@ -166,6 +153,12 @@
XalanNode* sourceTree,
XalanNode* sourceNode,
const QName& mode) const;
+
+ void
+ execute(
+ StylesheetExecutionContext& executionContext,
+ XalanNode* sourceTree,
+ XalanNode* sourceNode) const;
protected:
1.5 +2 -2 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemWhen.cpp 2000/04/12 19:41:00 1.4
+++ ElemWhen.cpp 2000/11/02 01:46:26 1.5
@@ -74,7 +74,7 @@
ElemWhen::ElemWhen(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -108,7 +108,7 @@
default:
if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
}
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemWhen.hpp
Index: ElemWhen.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWhen.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemWhen.hpp 2000/04/11 15:09:27 1.4
+++ ElemWhen.hpp 2000/11/02 01:46:26 1.5
@@ -90,7 +90,7 @@
ElemWhen (
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.5 +3 -3 xml-xalan/c/src/XSLT/ElemWithParam.cpp
Index: ElemWithParam.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemWithParam.cpp 2000/04/14 18:14:19 1.4
+++ ElemWithParam.cpp 2000/11/02 01:46:26 1.5
@@ -75,7 +75,7 @@
ElemWithParam::ElemWithParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber) :
@@ -86,7 +86,7 @@
columnNumber,
Constants::ELEMNAME_WITHPARAM),
m_selectPattern(0),
- m_qname(0)
+ m_qname()
{
const unsigned int nAttrs = atts.getLength();
@@ -104,7 +104,7 @@
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
1.5 +1 -1 xml-xalan/c/src/XSLT/ElemWithParam.hpp
Index: ElemWithParam.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemWithParam.hpp 2000/04/11 15:09:27 1.4
+++ ElemWithParam.hpp 2000/11/02 01:46:26 1.5
@@ -90,7 +90,7 @@
ElemWithParam(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
int lineNumber,
int columnNumber);
1.6 +12 -8 xml-xalan/c/src/XSLT/ExtensionFunctionHandler.cpp
Index: ExtensionFunctionHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ExtensionFunctionHandler.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ExtensionFunctionHandler.cpp 2000/08/15 19:43:43 1.5
+++ ExtensionFunctionHandler.cpp 2000/11/02 01:46:26 1.6
@@ -71,14 +71,18 @@
-/**
- * Class handling an extension namespace for XPath. Provides functions
- * to test a function's existence and call a function
- *
- * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
- */
+const XalanDOMChar ExtensionFunctionHandler::s_tokenDelimiterCharacters[] =
+{
+ XalanUnicode::charSpace,
+ XalanUnicode::charHTab,
+ XalanUnicode::charLF,
+ XalanUnicode::charCR,
+ 0
+};
+
+
-ExtensionFunctionHandler::ExtensionFunctionHandler(const XalanDOMString& namespaceUri) :
+ExtensionFunctionHandler::ExtensionFunctionHandler(const XalanDOMString& namespaceUri) :
m_namespaceUri(namespaceUri),
m_scriptLang(),
m_scriptSrc(),
@@ -124,7 +128,7 @@
return;
}
- StringTokenizer st(funcNames, " \t\n\r", false);
+ StringTokenizer st(funcNames, s_tokenDelimiterCharacters, false);
while (st.hasMoreTokens() == true)
{
1.8 +2 -0 xml-xalan/c/src/XSLT/ExtensionFunctionHandler.hpp
Index: ExtensionFunctionHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ExtensionFunctionHandler.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExtensionFunctionHandler.hpp 2000/09/19 15:11:51 1.7
+++ ExtensionFunctionHandler.hpp 2000/11/02 01:46:26 1.8
@@ -216,6 +216,8 @@
*/
virtual void
startupComponent();
+
+ static const XalanDOMChar s_tokenDelimiterCharacters[];
};
1.8 +2 -2 xml-xalan/c/src/XSLT/ExtensionNSHandler.cpp
Index: ExtensionNSHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ExtensionNSHandler.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExtensionNSHandler.cpp 2000/08/15 19:43:43 1.7
+++ ExtensionNSHandler.cpp 2000/11/02 01:46:26 1.8
@@ -181,11 +181,11 @@
{
if (length(elemNames) != 0)
{
- StringTokenizer st(elemNames, " \t\n\r", false);
+ StringTokenizer st(elemNames, s_tokenDelimiterCharacters, false);
while (st.hasMoreTokens() == true)
{
- m_elements.insert(st.nextToken()); // just stick it in there basically
+ m_elements.insert(st.nextToken()); // just stick it in there basically
}
m_componentDescLoaded = true;
1.16 +8 -4 xml-xalan/c/src/XSLT/FunctionDocument.cpp
Index: FunctionDocument.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionDocument.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FunctionDocument.cpp 2000/09/19 15:11:52 1.15
+++ FunctionDocument.cpp 2000/11/02 01:46:27 1.16
@@ -67,6 +67,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/PrefixResolver.hpp>
#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
@@ -117,15 +121,15 @@
if(newDoc == 0)
{
- XalanDOMString theMessage("Cannot load requested doc: ");
+ XalanDOMString theMessage(TranscodeFromLocalCodePage("Cannot load requested doc: "));
theMessage += localURI;
if (length(base) > 0)
{
- theMessage += " (Base URI: ";
+ theMessage += TranscodeFromLocalCodePage(" (Base URI: ");
theMessage += base;
- theMessage += ")";
+ theMessage += TranscodeFromLocalCodePage(")");
}
executionContext.warn(theMessage);
@@ -237,7 +241,7 @@
arg->nodeset().item(i) != 0);
XalanDOMString ref = XObject::eTypeNodeSet == theType ?
- arg->nodeset().item(i)->getXSLTData() :
+ DOMServices::getNodeData(*arg->nodeset().item(i)) :
arg->str();
// This is the case where the function was called with
1.5 +3 -2 xml-xalan/c/src/XSLT/FunctionFormatNumber.cpp
Index: FunctionFormatNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFormatNumber.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionFormatNumber.cpp 2000/09/19 15:11:55 1.4
+++ FunctionFormatNumber.cpp 2000/11/02 01:46:27 1.5
@@ -175,8 +175,9 @@
}
else
{
- executionContext.warn(XALAN_STATIC_UCODE_STRING("format-number() is not fully implemented!"),
- context);
+ executionContext.warn(
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("format-number() is not fully implemented!")),
+ context);
XalanDecimalFormat theFormatter;
1.13 +5 -1 xml-xalan/c/src/XSLT/FunctionKey.cpp
Index: FunctionKey.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionKey.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FunctionKey.cpp 2000/09/19 15:11:57 1.12
+++ FunctionKey.cpp 2000/11/02 01:46:27 1.13
@@ -72,6 +72,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/NodeRefListBase.hpp>
#include <XPath/XObject.hpp>
@@ -171,7 +175,7 @@
{
assert(theNodeSet.item(i) != 0);
- const XalanDOMString ref = theNodeSet.item(i)->getXSLTData();
+ const XalanDOMString ref = DOMServices::getNodeData(*theNodeSet.item(i));
if(0 != length(ref))
{
1.11 +3 -3 xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp
Index: FunctionSystemProperty.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FunctionSystemProperty.cpp 2000/09/27 17:15:13 1.10
+++ FunctionSystemProperty.cpp 2000/11/02 01:46:27 1.11
@@ -116,7 +116,7 @@
{
const XalanDOMString prefix = substring(fullName, 0, indexOfNSSep);
- const XalanDOMString nspace = executionContext.getNamespaceForPrefix(prefix);
+ const XalanDOMString& nspace = executionContext.getNamespaceForPrefix(prefix);
const XalanDOMString propName = substring(fullName, indexOfNSSep + 1);
@@ -145,12 +145,12 @@
{
executionContext.warn("Don't currently do anything with namespace " + nspace + " in property: " + fullName);
- result = ::getenv(c_str(TranscodeToLocalCodePage(propName)));
+ result = TranscodeFromLocalCodePage(::getenv(c_str(TranscodeToLocalCodePage(propName))));
}
}
else
{
- result = ::getenv(c_str(TranscodeToLocalCodePage(fullName)));
+ result = TranscodeFromLocalCodePage(::getenv(c_str(TranscodeToLocalCodePage(fullName))));
}
if (fNumberResult == true)
1.4 +23 -8 xml-xalan/c/src/XSLT/GenerateEvent.cpp
Index: GenerateEvent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/GenerateEvent.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GenerateEvent.cpp 2000/09/27 16:39:50 1.3
+++ GenerateEvent.cpp 2000/11/02 01:46:27 1.4
@@ -73,13 +73,13 @@
GenerateEvent::GenerateEvent(
EventType eventType,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
AttributeList* atts) :
m_eventType(eventType),
m_characters(),
m_start(0),
m_length(0),
- m_name(name),
+ m_name(XalanDOMString(name)),
m_data(),
m_pAtts(atts)
{
@@ -89,6 +89,21 @@
GenerateEvent::GenerateEvent(
EventType eventType,
+ const XalanDOMString& name,
+ const AttributeList* atts) :
+ m_eventType(eventType),
+ m_characters(),
+ m_start(0),
+ m_length(0),
+ m_name(name),
+ m_data(),
+ m_pAtts(atts)
+{
+}
+
+
+GenerateEvent::GenerateEvent(
+ EventType eventType,
const XalanDOMChar* ch,
unsigned int start,
unsigned int length) :
@@ -106,14 +121,14 @@
GenerateEvent::GenerateEvent(
EventType eventType,
- const XalanDOMString& name,
- const XalanDOMString& data) :
+ const XalanDOMChar* name,
+ const XalanDOMChar* data) :
m_eventType(eventType),
m_characters(),
m_start(0),
m_length(0),
- m_name(name),
- m_data(data),
+ m_name(XalanDOMString(name)),
+ m_data(XalanDOMString(data)),
m_pAtts(0)
{
}
@@ -122,13 +137,13 @@
GenerateEvent::GenerateEvent(
EventType eventType,
- const XalanDOMString& data) :
+ const XalanDOMChar* data) :
m_eventType(eventType),
m_characters(),
m_start(0),
m_length(0),
m_name(),
- m_data(data),
+ m_data(XalanDOMString(data)),
m_pAtts(0)
{
}
1.5 +24 -13 xml-xalan/c/src/XSLT/GenerateEvent.hpp
Index: GenerateEvent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/GenerateEvent.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GenerateEvent.hpp 2000/09/27 16:39:51 1.4
+++ GenerateEvent.hpp 2000/11/02 01:46:27 1.5
@@ -155,10 +155,22 @@
*/
GenerateEvent(
EventType eventType,
- const XalanDOMString& name,
+ const XalanDOMChar* name,
AttributeList* atts);
-
+
/**
+ * Constructor for startElement, endElement events.
+ *
+ * @param eventType one of the EVENTTYPE_XXX constants
+ * @param name name of the element
+ * @param atts SAX attribute list
+ */
+ GenerateEvent(
+ EventType eventType,
+ const XalanDOMString& name,
+ const AttributeList* atts = 0);
+
+ /**
* Constructor for characters, cdate events.
*
* @param eventType one of the EVENTTYPE_XXX constants
@@ -181,8 +193,8 @@
*/
GenerateEvent(
EventType eventType,
- const XalanDOMString& name,
- const XalanDOMString& data);
+ const XalanDOMChar* name,
+ const XalanDOMChar* data);
/**
* Constructor for comment and entity ref events.
@@ -193,44 +205,43 @@
*/
GenerateEvent(
EventType eventType,
- const XalanDOMString& data);
+ const XalanDOMChar* data);
/**
* The type of SAX event that was generated, as enumerated in the
* EVENTTYPE_XXX constants above.
*/
- EventType m_eventType;
-
+ EventType m_eventType;
/**
* Character data from a character or cdata event.
*/
- XalanDOMString m_characters;
+ XalanDOMString m_characters;
/**
* The start position of the current data in m_characters.
*/
- unsigned int m_start;
+ unsigned int m_start;
/**
* The length of the current data in m_characters.
*/
- unsigned int m_length;
+ unsigned int m_length;
/**
* The name of the element or PI.
*/
- XalanDOMString m_name;
+ XalanDOMString m_name;
/**
* The string data in the element (comments and PIs).
*/
- XalanDOMString m_data;
+ XalanDOMString m_data;
/**
* The current attribute list.
*/
- AttributeList* m_pAtts;
+ const AttributeList* m_pAtts;
};
1.12 +7 -3 xml-xalan/c/src/XSLT/KeyTable.cpp
Index: KeyTable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KeyTable.cpp 2000/09/19 15:12:00 1.11
+++ KeyTable.cpp 2000/11/02 01:46:27 1.12
@@ -70,6 +70,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include <XPath/XPath.hpp>
@@ -139,8 +143,8 @@
if (executionContext.getInConstruction(kd) == true)
{
throw XSLTProcessorException(
- "The use of the key() function in the \"match\" or \"use\" attribute of xsl:key is illegal!",
- "XSLTKeyIllegalKeyFunctionException");
+ TranscodeFromLocalCodePage("The use of the key() function in the \"match\" or \"use\" attribute of xsl:key is illegal!"),
+ TranscodeFromLocalCodePage("XSLTKeyIllegalKeyFunctionException"));
}
else
{
@@ -195,7 +199,7 @@
XalanNode* const useNode = nl->item(k);
assert(useNode != 0);
- exprResult = useNode->getXSLTData();
+ exprResult = DOMServices::getNodeData(*useNode);
}
MutableNodeRefList& keyNodes =
1.4 +2 -6 xml-xalan/c/src/XSLT/NamespacesHandler.cpp
Index: NamespacesHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NamespacesHandler.cpp 2000/09/05 02:24:53 1.3
+++ NamespacesHandler.cpp 2000/11/02 01:46:27 1.4
@@ -72,10 +72,6 @@
-#include <XPath/QName.hpp>
-
-
-
#include "Constants.hpp"
#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
@@ -250,7 +246,7 @@
if(length(theNamespace) == 0)
{
- XalanDOMString theMessage("Invalid prefix in exclude-result-prefixes: ");
+ XalanDOMString theMessage(TranscodeFromLocalCodePage("Invalid prefix in exclude-result-prefixes: "));
theMessage += thePrefix;
@@ -287,7 +283,7 @@
if(length(theNamespace) == 0)
{
- XalanDOMString theMessage("Invalid prefix in extension-element-prefixes: ");
+ XalanDOMString theMessage(TranscodeFromLocalCodePage("Invalid prefix in extension-element-prefixes: "));
theMessage += thePrefix;
1.4 +4 -6 xml-xalan/c/src/XSLT/NamespacesHandler.hpp
Index: NamespacesHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NamespacesHandler.hpp 2000/09/05 02:24:53 1.3
+++ NamespacesHandler.hpp 2000/11/02 01:46:27 1.4
@@ -79,6 +79,7 @@
#include <XPath/NameSpace.hpp>
+#include <XPath/QName.hpp>
@@ -159,6 +160,9 @@
XalanDOMString m_resultAttributeName;
};
+ typedef QName::NamespaceVectorType NamespaceVectorType;
+ typedef QName::NamespacesStackType NamespacesStackType;
+
#if defined(XALAN_NO_NAMESPACES)
typedef map<XalanDOMString,
XalanDOMString,
@@ -172,9 +176,6 @@
XalanDOMString,
less<XalanDOMString> > NamespaceAliasesMapType;
- typedef vector<NameSpace> NamespaceVectorType;
- typedef vector<NamespaceVectorType> NamespacesStackType;
-
typedef set<XalanDOMString,
less<XalanDOMString> > ExtensionNamespaceURISetType;
#else
@@ -184,9 +185,6 @@
NameSpaceExtended> NamespacesMapType;
typedef std::map<XalanDOMString, XalanDOMString> NamespaceAliasesMapType;
-
- typedef std::vector<NameSpace> NamespaceVectorType;
- typedef std::vector<NamespaceVectorType> NamespacesStackType;
typedef std::set<XalanDOMString> ExtensionNamespaceURISetType;
#endif
1.4 +1 -1 xml-xalan/c/src/XSLT/SelectionEvent.cpp
Index: SelectionEvent.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/SelectionEvent.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SelectionEvent.cpp 2000/04/11 15:09:28 1.3
+++ SelectionEvent.cpp 2000/11/02 01:46:27 1.4
@@ -71,7 +71,7 @@
StylesheetExecutionContext& executionContext,
const XalanNode* sourceNode,
const ElemTemplateElement& styleNode,
- const DOMString& attributeName,
+ const XalanDOMString& attributeName,
const XPath& xpath,
const XObject* selection) :
m_executionContext(executionContext),
1.40 +103 -93 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.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Stylesheet.cpp 2000/10/12 17:07:48 1.39
+++ Stylesheet.cpp 2000/11/02 01:46:27 1.40
@@ -79,7 +79,6 @@
#include <PlatformSupport/STLHelper.hpp>
-#include <PlatformSupport/StringTokenizer.hpp>
@@ -111,6 +110,10 @@
+const XalanDOMString Stylesheet::s_emptyString;
+
+
+
Stylesheet::Stylesheet(
StylesheetRoot& root,
const XalanDOMString& baseIdentifier,
@@ -246,22 +249,22 @@
else if (isAttrOK(aname, atts, i, constructionContext) == false)
{
constructionContext.error(
- XalanDOMString("xsl:key, unrecognized keyword '") +
- aname +
- XalanDOMString("'!"));
+ TranscodeFromLocalCodePage("xsl:key, unrecognized keyword '") +
+ aname +
+ TranscodeFromLocalCodePage("'!"));
}
}
if(0 == nameAttr)
- constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_NAME+" attribute!");
+ constructionContext.error(TranscodeFromLocalCodePage("xsl:key requires a ") + Constants::ATTRNAME_NAME + " attribute!");
if(0 == matchAttr)
- constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_MATCH+XalanDOMString(" attribute!"));
+ constructionContext.error(TranscodeFromLocalCodePage("xsl:key requires a ") + Constants::ATTRNAME_MATCH + " attribute!");
if(0 == useAttr)
- constructionContext.error(XalanDOMString("xsl:key requires a ") + Constants::ATTRNAME_USE+XalanDOMString(" attribute!"));
+ constructionContext.error(TranscodeFromLocalCodePage("xsl:key requires a ") + Constants::ATTRNAME_USE + " attribute!");
- m_keyDeclarations.push_back(KeyDeclaration(nameAttr, *matchAttr, *useAttr));
+ m_keyDeclarations.push_back(KeyDeclaration(XalanDOMString(nameAttr), *matchAttr, *useAttr));
m_needToBuildKeysTable = true;
}
@@ -269,17 +272,12 @@
void
-Stylesheet::pushNamespaces(const AttributeList& atts)
+Stylesheet::pushNamespaces(const AttributeList& atts)
{
const unsigned int nAttrs = atts.getLength();
NamespaceVectorType namespaces;
- // Reserve the maximum space. Any extra will not
- // be copied to m_namespaces, since we're pushing
- // a copy.
- namespaces.reserve(nAttrs);
-
for(unsigned int i = 0; i < nAttrs; i++)
{
const XalanDOMChar* const aname = atts.getName(i);
@@ -289,9 +287,9 @@
if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
{
- XalanDOMString p = isPrefix ? substring(aname, 6) : XalanDOMString();
+ const XalanDOMString p = isPrefix ? substring(aname, 6) : XalanDOMString();
- namespaces.push_back(NameSpace(p, value));
+ namespaces.push_back(NameSpace(p, XalanDOMString(value)));
}
}
@@ -379,7 +377,7 @@
if(indexOfNSSep < length(attrName))
{
const XalanDOMString prefix = substring(attrName, 0, indexOfNSSep);
- const XalanDOMString ns = getNamespaceForPrefixFromStack(prefix);
+ const XalanDOMString& ns = getNamespaceForPrefixFromStack(prefix);
attrOK = ! ::isEmpty(ns) && !equals(ns,constructionContext.getXSLTNamespaceURI());
}
@@ -394,9 +392,19 @@
-XalanDOMString
-Stylesheet::getNamespaceFromStack(const XalanDOMString& nodeName) const
+const XalanDOMString&
+Stylesheet::getNamespaceFromStack(const XalanDOMString& nodeName) const
+{
+ return getNamespaceFromStack(c_wstr(nodeName));
+}
+
+
+
+const XalanDOMString&
+Stylesheet::getNamespaceFromStack(const XalanDOMChar* nodeName) const
{
+ assert(nodeName != 0);
+
const unsigned int indexOfNSSep = indexOf(nodeName, XalanUnicode::charColon);
const XalanDOMString prefix =
@@ -408,8 +416,8 @@
}
-
-XalanDOMString
+
+const XalanDOMString&
Stylesheet::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
return QName::getNamespaceForPrefix(m_namespaceDecls, prefix);
@@ -417,7 +425,7 @@
-XalanDOMString
+const XalanDOMString&
Stylesheet::getNamespaceForPrefixFromStack(const XalanDOMString& prefix) const
{
return QName::getNamespaceForPrefix(m_namespaces, prefix);
@@ -425,6 +433,16 @@
+const XalanDOMString&
+Stylesheet::getNamespaceForPrefixFromStack(const XalanDOMChar* prefix) const
+{
+ assert(prefix != 0);
+
+ return QName::getNamespaceForPrefix(m_namespaces, XalanDOMString(prefix));
+}
+
+
+
bool
Stylesheet::getYesOrNo(
const XalanDOMChar* aname,
@@ -441,9 +459,7 @@
}
else
{
- constructionContext.error(XalanDOMString(val) +
- XalanDOMString(" is unknown value for ") +
- aname);
+ constructionContext.error(XalanDOMString(val) + " is unknown value for " + aname);
return false;
}
@@ -496,7 +512,7 @@
else
{
// This is an error...
- XalanDOMString theMessage("The stylesheet already has a template with the name ");
+ XalanDOMString theMessage(TranscodeFromLocalCodePage("The stylesheet already has a template with the name "));
const XalanDOMString& theNamespace = theName.getNamespace();
@@ -595,8 +611,7 @@
if(0 == namedTemplate)
{
- executionContext.warn(XalanDOMString("Could not find xsl:template named: ") +
- qname.getLocalPart());
+ executionContext.warn("Could not find xsl:template named: " + qname.getLocalPart());
}
return namedTemplate;
@@ -656,7 +671,7 @@
{
case XalanNode::ELEMENT_NODE:
{
- const XalanDOMString targetName = DOMServices::getLocalNameOfNode(*targetNode);
+ const XalanDOMString& targetName = DOMServices::getLocalNameOfNode(*targetNode);
matchPatternList = locateMatchPatternList2(targetName, true);
}
@@ -692,7 +707,7 @@
if (matchPatternList != 0)
{
- XalanDOMString prevPat;
+ const XalanDOMString* prevPat = 0;
const MatchPattern2* prevMatchPat = 0;
double prevMatchPatPriority = XPath::s_MatchScoreNone;
@@ -729,14 +744,14 @@
if ( (!haveMode && !haveRuleMode) || (haveMode && haveRuleMode && ruleMode.equals(mode)))
{
- const XalanDOMString patterns = matchPat->getPattern();
+ const XalanDOMString& patterns = matchPat->getPattern();
if(!isEmpty(patterns) &&
!(prevMatchPat != 0 &&
- equals(prevPat, patterns) &&
+ (prevPat != 0 && equals(*prevPat, patterns)) &&
prevMatchPat->getTemplate()->getPriority() == matchPat->getTemplate()->getPriority()))
{
- prevPat = patterns;
+ prevPat = &patterns;
prevMatchPat = matchPat;
prevMatchPatPriority = matchPatPriority;
matchPatPriority = XPath::s_MatchScoreNone;
@@ -904,19 +919,18 @@
const MatchPattern2* thePattern,
PatternTableVectorType& theVector)
{
- const PatternTableVectorType::size_type n =
- theVector.size();
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
- for(PatternTableVectorType::size_type i = 0; i < n; i++)
- {
- if(theVector[i] == thePattern)
- {
- break;
- }
- }
+ const PatternTableVectorType::const_iterator theResult =
+ find(
+ theVector.begin(),
+ theVector.end(),
+ thePattern);
// Did we find it?
- if(i == n)
+ if(theResult == theVector.end())
{
theVector.push_back(thePattern);
}
@@ -935,9 +949,9 @@
{
case XalanNode::ELEMENT_NODE:
{
- // String targetName = m_parserLiaison.getExpandedElementName((Element)targetNode);
- const XalanDOMString targetName =
+ const XalanDOMString& targetName =
DOMServices::getLocalNameOfNode(*sourceNode);
+
matchPatternList = locateMatchPatternList2(targetName, true);
}
break;
@@ -975,7 +989,7 @@
const Stylesheet::PatternTableListType*
Stylesheet::locateMatchPatternList2(
const XalanDOMString& sourceElementType,
- bool tryWildCard) const
+ bool tryWildCard) const
{
const PatternTableListType* theMatchList = 0;
@@ -1003,20 +1017,13 @@
-/**
- * Construct a match pattern from a pattern and template.
- * @param pat For now a Nodelist that contains old-style element patterns.
- * @param template The node that contains the template for this pattern.
- * @param isMatchPatternsOnly tells if pat param contains only match
- * patterns (for compatibility with old syntax).
- */
Stylesheet::MatchPattern2::MatchPattern2(
const XalanDOMString& pat,
const XPath* exp,
const ElemTemplate* theTemplate,
int posInStylesheet,
const XalanDOMString& targetString,
- const Stylesheet* stylesheet) :
+ const Stylesheet* stylesheet) :
m_stylesheet(stylesheet),
m_targetString(targetString),
m_expression(exp),
@@ -1104,8 +1111,7 @@
var->execute(executionContext,
doc,
- doc,
- QName());
+ doc);
}
}
@@ -1122,7 +1128,7 @@
-const XalanDOMString
+const XalanDOMString&
Stylesheet::getCurrentIncludeBaseIdentifier() const
{
if (m_includeStack.size() == 0)
@@ -1139,15 +1145,15 @@
void
Stylesheet::processNSAliasElement(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
StylesheetConstructionContext& constructionContext)
{
- const unsigned int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- XalanDOMString stylesheetNamespace;
- XalanDOMString resultNamespace;
- XalanDOMString dummy;
+ const XalanDOMString* stylesheetNamespace = &DOMServices::s_emptyString;
+ const XalanDOMString* resultNamespace = &DOMServices::s_emptyString;
+ const XalanDOMString dummy;
for(unsigned int i = 0; i < nAttrs; i++)
{
@@ -1159,11 +1165,11 @@
if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
{
- stylesheetNamespace = getNamespaceForPrefix(dummy);
+ stylesheetNamespace = &getNamespaceForPrefix(dummy);
}
else
{
- stylesheetNamespace = getNamespaceForPrefix(value);
+ stylesheetNamespace = &getNamespaceForPrefix(XalanDOMString(value));
}
}
else if(equals(aname, Constants::ATTRNAME_RESULT_PREFIX))
@@ -1172,41 +1178,41 @@
if (equals(value, Constants::ATTRVAL_DEFAULT_PREFIX) == true)
{
- resultNamespace = getNamespaceForPrefix(dummy);
+ resultNamespace = &getNamespaceForPrefix(dummy);
}
else
{
- resultNamespace = getNamespaceForPrefix(value);
+ resultNamespace = &getNamespaceForPrefix(XalanDOMString(value));
}
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error(name + " has an illegal attribute: " + aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
// Build a table of aliases, the key is the stylesheet uri and the
// value is the result uri
- if (length(stylesheetNamespace) != 0 &&
- length(resultNamespace) != 0)
+ if (length(*stylesheetNamespace) != 0 &&
+ length(*resultNamespace) != 0)
{
#if 1
// $$$ ToDo: Enable other code. Perhaps an error?
- m_prefixAliases[stylesheetNamespace] = resultNamespace;
+ m_prefixAliases[*stylesheetNamespace] = *resultNamespace;
- m_namespacesHandler.setNamespaceAlias(stylesheetNamespace, resultNamespace);
+ m_namespacesHandler.setNamespaceAlias(*stylesheetNamespace, *resultNamespace);
#else
const PrefixAliasesMapType::iterator i =
- m_prefixAliases.find(stylesheetNamespace);
+ m_prefixAliases.find(*stylesheetNamespace);
if (i != m_prefixAliases.end())
{
// $$$ ToDo: This could also be an error?
- (*i).second = resultNamespace;
+ (*i).second = *resultNamespace;
}
else
{
- m_prefixAliases.insert(PrefixAliasesMapType::value_type(stylesheetNamespace, resultNamespace));
+ m_prefixAliases.insert(PrefixAliasesMapType::value_type(*stylesheetNamespace, *resultNamespace));
}
#endif
}
@@ -1219,6 +1225,16 @@
XalanDOMString
+Stylesheet::getAliasNamespaceURI(const XalanDOMChar* uri) const
+{
+ assert(uri != 0);
+
+ return getAliasNamespaceURI(XalanDOMString(uri));
+}
+
+
+
+XalanDOMString
Stylesheet::getAliasNamespaceURI(const XalanDOMString& uri) const
{
XalanDOMString result;
@@ -1407,7 +1423,9 @@
assert(attrSet != 0);
if(qname.equals(attrSet->getQName()))
+ {
attrSet->execute(executionContext, sourceTree, sourceNode, mode);
+ }
}
}
}
@@ -1430,18 +1448,18 @@
-XalanDOMString
+const XalanDOMString&
Stylesheet::getNodeName() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
Stylesheet::getNodeValue() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1615,27 +1633,27 @@
-XalanDOMString
+const XalanDOMString&
Stylesheet::getNamespaceURI() const
{
// $$ ToDo: Is this the same value as PrefixResolver::getURI()?
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
Stylesheet::getPrefix() const
{
- return XalanDOMString();
+ return s_emptyString;
}
-XalanDOMString
+const XalanDOMString&
Stylesheet::getLocalName() const
{
- return XalanDOMString();
+ return s_emptyString;
}
@@ -1656,14 +1674,6 @@
-XalanDOMString
-Stylesheet::getXSLTData() const
-{
- return DOMString();
-}
-
-
-
XalanElement*
Stylesheet::createElement(const XalanDOMString& /* tagName */)
{
@@ -1865,7 +1875,7 @@
-XalanDOMString
+const XalanDOMString&
Stylesheet::getURI() const
{
return m_baseIdent;
1.27 +43 -20 xml-xalan/c/src/XSLT/Stylesheet.hpp
Index: Stylesheet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Stylesheet.hpp 2000/09/19 15:12:05 1.26
+++ Stylesheet.hpp 2000/11/02 01:46:27 1.27
@@ -138,9 +138,6 @@
typedef vector<ElemAttributeSet*> AttributeSetMapType;
typedef vector<ElemVariable*> ElemVariableVectorType;
typedef vector<KeyDeclaration> KeyDeclarationVectorType;
-// typedef map<XalanDOMString,
-// KeyTable*,
-// less<XalanDOMString> > KeysMapType;
typedef map<const XalanNode*,
KeyTable*,
less<const XalanNode*> > KeyTablesTableType;
@@ -156,7 +153,6 @@
typedef std::vector<ElemAttributeSet*> AttributeSetMapType;
typedef std::vector<ElemVariable*> ElemVariableVectorType;
typedef std::vector<KeyDeclaration> KeyDeclarationVectorType;
-// typedef std::map<XalanDOMString, KeyTable*> KeysMapType;
typedef std::map<const XalanNode*, KeyTable*> KeyTablesTableType;
typedef std::vector<QName> QNameVectorType;
typedef std::vector<Stylesheet*> StylesheetVectorType;
@@ -339,26 +335,54 @@
* @param nodeName name of node
* @return namespace string for node
*/
- XalanDOMString
+ const XalanDOMString&
getNamespaceFromStack(const XalanDOMString& nodeName) const;
/**
+ * Get the namespace from a qualified name.
+ *
+ * @param nodeName name of node
+ * @return namespace string for node
+ */
+ const XalanDOMString&
+ getNamespaceFromStack(const XalanDOMChar* nodeName) const;
+
+ /**
* Get the namespace from a prefix by searching the stack of namespace
* lists.
*
* @param prefix prefix to search
* @return namespace corresponding to prefix
*/
- XalanDOMString
+ const XalanDOMString&
getNamespaceForPrefixFromStack(const XalanDOMString& prefix) const;
/**
+ * Get the namespace from a prefix by searching the stack of namespace
+ * lists.
+ *
+ * @param prefix prefix to search
+ * @return namespace corresponding to prefix
+ */
+ const XalanDOMString&
+ getNamespaceForPrefixFromStack(const XalanDOMChar* prefix) const;
+
+ /**
* See if there is a namespace alias.
*
* @param uri the URI of the namespace.
* @return the alias URI, if found.
*/
XalanDOMString
+ getAliasNamespaceURI(const XalanDOMChar* uri) const;
+
+ /**
+ * See if there is a namespace alias.
+ *
+ * @param uri the URI of the namespace.
+ * @return the alias URI, if found.
+ */
+ XalanDOMString
getAliasNamespaceURI(const XalanDOMString& uri) const;
/**
@@ -426,7 +450,7 @@
*
* @return string for base identifier
*/
- const XalanDOMString
+ const XalanDOMString&
getBaseIdentifier() const
{
return m_baseIdent;
@@ -438,7 +462,7 @@
* @param str string for base identifier
*/
void
- setBaseIdentifier(const XalanDOMString& str)
+ setBaseIdentifier(const XalanDOMString& str)
{
m_baseIdent = str;
}
@@ -451,7 +475,7 @@
*
* @return string for base identifier
*/
- const XalanDOMString
+ const XalanDOMString&
getCurrentIncludeBaseIdentifier() const;
/**
@@ -463,7 +487,7 @@
*/
void
processNSAliasElement(
- const XalanDOMString& name,
+ const XalanDOMChar* name,
const AttributeList& atts,
StylesheetConstructionContext& constructionContext);
@@ -930,10 +954,10 @@
// These interfaces are inherited from XalanDocument...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
virtual NodeType
@@ -1000,13 +1024,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
virtual void
@@ -1015,9 +1039,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
virtual XalanElement*
createElement(const XalanDOMString& tagName);
@@ -1084,10 +1105,10 @@
// These interfaces are inherited from PrefixResolver...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getURI() const;
const XalanDOMString&
@@ -1255,6 +1276,8 @@
StringToStringMapType m_prefixAliases;
NamespacesHandler m_namespacesHandler;
+
+ static const XalanDOMString s_emptyString;
};
1.10 +59 -3 xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
Index: StylesheetConstructionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StylesheetConstructionContext.hpp 2000/08/11 21:15:45 1.9
+++ StylesheetConstructionContext.hpp 2000/11/02 01:46:27 1.10
@@ -135,7 +135,7 @@
* @return A pointer to a new StylesheetRoot instance.
*/
virtual StylesheetRoot*
- create(XSLTInputSource& theInputSource) = 0;
+ create(const XSLTInputSource& theInputSource) = 0;
/**
* Create a new Stylesheet instance. The StylesheetConstructionContext
@@ -172,6 +172,17 @@
getAttrTok(const XalanDOMString& name) const = 0;
/**
+ * Given an XSL tag name, return an integer token that corresponds to
+ * ELEMNAME_XXX constants defined in Constants.hpp.
+ *
+ * @param name a probable xsl:xxx element name
+ * @return Constants.ELEMNAME_XXX token, or -1 if in xsl or Xalan namespace,
+ * -2 if not in known namespace
+ */
+ virtual int
+ getAttrTok(const XalanDOMChar* name) const = 0;
+
+ /**
* Determine the fully qualified URI for a string.
*
* @param urlString string to qualify
@@ -237,6 +248,20 @@
const PrefixResolver& resolver) = 0;
/**
+ * Create and initialize an xpath for a match pattern and return it. This
+ * is to be used by stylesheet elements that need an XPath that is
+ * guaranteed to persist while it lives.
+ *
+ * @param str string to match
+ * @param resolver resolver for namespace resolution
+ * @return XPath for match pattern
+ */
+ virtual XPath*
+ createMatchPattern(
+ const XalanDOMChar* str,
+ const PrefixResolver& resolver) = 0;
+
+ /**
* Create and initialize an xpath and return it. This is to be used by
* stylesheet elements that need an XPath that is guaranteed to persist
* while it lives.
@@ -251,6 +276,20 @@
const PrefixResolver& resolver) = 0;
/**
+ * Create and initialize an xpath and return it. This is to be used by
+ * stylesheet elements that need an XPath that is guaranteed to persist
+ * while it lives.
+ *
+ * @param str string to match
+ * @param resolver resolver for namespace resolution
+ * @return XPath for string matched
+ */
+ virtual XPath*
+ createXPath(
+ const XalanDOMChar* str,
+ const PrefixResolver& resolver) = 0;
+
+ /**
* 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.
@@ -326,17 +365,34 @@
const XalanNode* styleNode = 0) const = 0;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.11 +76 -5 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
Index: StylesheetConstructionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- StylesheetConstructionContextDefault.cpp 2000/08/11 21:15:45 1.10
+++ StylesheetConstructionContextDefault.cpp 2000/11/02 01:46:27 1.11
@@ -117,6 +117,17 @@
void
+StylesheetConstructionContextDefault::error(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ error(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
StylesheetConstructionContextDefault::warn(
const XalanDOMString& msg,
const XalanNode* sourceNode,
@@ -128,6 +139,17 @@
void
+StylesheetConstructionContextDefault::warn(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ warn(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
StylesheetConstructionContextDefault::message(
const XalanDOMString& msg,
const XalanNode* sourceNode,
@@ -139,6 +161,17 @@
void
+StylesheetConstructionContextDefault::message(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ message(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
StylesheetConstructionContextDefault::reset()
{
#if !defined(XALAN_NO_NAMESPACES)
@@ -170,14 +203,14 @@
StylesheetRoot*
-StylesheetConstructionContextDefault::create(XSLTInputSource& theInputSource)
+StylesheetConstructionContextDefault::create(const XSLTInputSource& theInputSource)
{
const XMLCh* const theSystemID =
theInputSource.getSystemId();
const XalanDOMString theBaseIdentifier =
- theSystemID == 0 ? XALAN_STATIC_UCODE_STRING("") :
- theSystemID;
+ theSystemID == 0 ? XalanDOMString() :
+ XalanDOMString(theSystemID);
return create(theBaseIdentifier);
}
@@ -218,8 +251,19 @@
int
StylesheetConstructionContextDefault::getAttrTok(const XalanDOMString& name) const
+{
+ return m_processor.getAttrTok(XalanDOMString(name));
+}
+
+
+
+int
+StylesheetConstructionContextDefault::getAttrTok(const XalanDOMChar* name) const
{
- return m_processor.getAttrTok(name);
+ assert(name != 0);
+
+ // $$$ ToDo: Explicit XalanDOMString constructor
+ return m_processor.getAttrTok(XalanDOMString(name));
}
@@ -286,18 +330,45 @@
XPath*
+StylesheetConstructionContextDefault::createMatchPattern(
+ const XalanDOMChar* str,
+ const PrefixResolver& resolver)
+{
+ assert(str != 0);
+
+ // $$$ ToDo: Explicit XalanDOMString constructor
+ return createMatchPattern(XalanDOMString(str), resolver);
+}
+
+
+
+XPath*
StylesheetConstructionContextDefault::createXPath(
- const XalanDOMString& str,
+ const XalanDOMString& str,
const PrefixResolver& resolver)
{
XPath* const xpath = m_xpathFactory.create();
+ // $$$ ToDo: Explicit XalanDOMString constructor
m_xpathProcessor->initXPath(*xpath,
str,
resolver,
m_xpathEnvSupport);
return xpath;
+}
+
+
+
+XPath*
+StylesheetConstructionContextDefault::createXPath(
+ const XalanDOMChar* str,
+ const PrefixResolver& resolver)
+{
+ assert(str != 0);
+
+ // $$$ ToDo: Explicit XalanDOMString constructor
+ return createXPath(XalanDOMString(str), resolver);
}
1.15 +36 -5 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
Index: StylesheetConstructionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- StylesheetConstructionContextDefault.hpp 2000/09/19 15:12:06 1.14
+++ StylesheetConstructionContextDefault.hpp 2000/11/02 01:46:27 1.15
@@ -72,7 +72,7 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
@@ -132,16 +132,34 @@
const XalanNode* styleNode = 0) const;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
-
+ const XalanNode* styleNode = 0) const;
+
virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
// These interfaces are inherited from StylesheetConstructionContext...
@@ -152,7 +170,7 @@
create(const XalanDOMString& theBaseIdentifier);
virtual StylesheetRoot*
- create(XSLTInputSource& theInputSource);
+ create(const XSLTInputSource& theInputSource);
virtual Stylesheet*
create(
@@ -165,6 +183,9 @@
virtual int
getAttrTok(const XalanDOMString& name) const;
+ virtual int
+ getAttrTok(const XalanDOMChar* name) const;
+
virtual URLAutoPtrType
getURLFromString(const XalanDOMString& urlString);
@@ -190,8 +211,18 @@
const PrefixResolver& resolver);
virtual XPath*
+ createMatchPattern(
+ const XalanDOMChar* str,
+ const PrefixResolver& resolver);
+
+ virtual XPath*
createXPath(
const XalanDOMString& str,
+ const PrefixResolver& resolver);
+
+ virtual XPath*
+ createXPath(
+ const XalanDOMChar* str,
const PrefixResolver& resolver);
virtual const Locator*
1.34 +47 -259 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- StylesheetExecutionContext.hpp 2000/10/07 15:26:09 1.33
+++ StylesheetExecutionContext.hpp 2000/11/02 01:46:27 1.34
@@ -96,8 +96,11 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <PlatformSupport/AttributeListImpl.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
@@ -243,42 +246,15 @@
const XalanDOMString& theMessage,
const void* theKey) = 0;
- /**
- * Retrieve name of the pending element currently being processed.
- *
- * @return element name
- */
- virtual XalanDOMString
- getPendingElementName() const = 0;
-
- /**
- * Changes the currently pending element name.
- *
- * @param elementName new name of element
- */
- virtual void
- setPendingElementName(const XalanDOMString& elementName) = 0;
-
- /**
- * Retrieve list of attributes yet to be processed
- *
- * @return attribute list
- */
- virtual const AttributeList&
- getPendingAttributes() const = 0;
-
/**
- * Sets a list of attributes yet to be processed.
- *
- * @param pendingAttributes attribute list
+ * See if there is an element pending.
*/
- virtual void
- setPendingAttributes(const AttributeList& pendingAttributes) = 0;
+ virtual bool
+ isElementPending() const = 0;
/**
* Replace the contents of a pending attribute.
*
- * @param pendingAttributes attribute list
* @param theName name of attribute
* @param theNewType type of attribute
* @param theNewValue new value of attribute
@@ -305,242 +281,40 @@
virtual void
setFormatterListener(FormatterListener* flistener) = 0;
- /*
- * See if there is a pending start document event waiting.
- * @return true if there is a start document event waiting.
- */
- virtual bool
- getHasPendingStartDocument() const = 0;
-
- /**
- * Set the pending start document event state.
- * @param the new value
- */
virtual void
- setHasPendingStartDocument(bool b) = 0;
-
- /**
- * See if a pending start document event must be flushed.
- * @return true if the event must be flushed.
- */
- virtual bool
- getMustFlushPendingStartDocument() const = 0;
+ pushOutputContext(FormatterListener* flistener = 0) = 0;
- /**
- * Set the pending start document event flush state.
- * @param the new value
- */
virtual void
- setMustFlushPendingStartDocument(bool b) = 0;
-
- // This next group of classes are used to save and restore
- // the execution state in an automated, and exception-safe
- // manner.
-
- class HasPendingStartDocumentSetAndRestore
- {
- public:
-
- /**
- * Construct an object to set and restore the current pending start.
- * document state.
- * @param theExecutionContext a reference to the current execution context
- * @param theNewState the new state to set.
- */
- HasPendingStartDocumentSetAndRestore(
- StylesheetExecutionContext& theExecutionContext,
- bool theNewState) :
- m_executionContext(theExecutionContext),
- m_savedState(theExecutionContext.getHasPendingStartDocument())
- {
- theExecutionContext.setHasPendingStartDocument(theNewState);
- }
-
- ~HasPendingStartDocumentSetAndRestore()
- {
- m_executionContext.setHasPendingStartDocument(m_savedState);
- }
-
- private:
-
- StylesheetExecutionContext& m_executionContext;
-
- const bool m_savedState;
- };
-
- class MustFlushPendingStartDocumentSetAndRestore
- {
- public:
-
- /**
- * Construct an object to set and restore the current flush pending start.
- * document state.
- * @param theExecutionContext a reference to the current execution context
- * @param theNewState the new state to set.
- */
- MustFlushPendingStartDocumentSetAndRestore(
- StylesheetExecutionContext& theExecutionContext,
- bool theNewState) :
- m_executionContext(theExecutionContext),
- m_savedState(theExecutionContext.getMustFlushPendingStartDocument())
- {
- theExecutionContext.setMustFlushPendingStartDocument(theNewState);
- }
-
- ~MustFlushPendingStartDocumentSetAndRestore()
- {
- m_executionContext.setMustFlushPendingStartDocument(m_savedState);
- }
-
- private:
-
- StylesheetExecutionContext& m_executionContext;
-
- const bool m_savedState;
- };
+ popOutputContext() = 0;
- class FormatterListenerSetAndRestore
+ class OutputContextPushPop
{
public:
/**
- * Construct an object to set and restore the current formatter listener.
+ * Construct an object to push and pop the current output context.
*
* @param theExecutionContext a reference to the current execution context
- * @param theNewListener the new listener to set.
+ * @param theNewListener the new FormatterListener to set.
*/
- FormatterListenerSetAndRestore(
+ OutputContextPushPop(
StylesheetExecutionContext& theExecutionContext,
FormatterListener* theNewListener = 0) :
- m_executionContext(theExecutionContext),
- m_savedListener(theExecutionContext.getFormatterListener())
+ m_executionContext(theExecutionContext)
{
- theExecutionContext.setFormatterListener(theNewListener);
+ m_executionContext.pushOutputContext(theNewListener);
}
- ~FormatterListenerSetAndRestore()
+ ~OutputContextPushPop()
{
- m_executionContext.setFormatterListener(m_savedListener);
+ m_executionContext.popOutputContext();
}
private:
StylesheetExecutionContext& m_executionContext;
-
- FormatterListener* const m_savedListener;
};
- class PendingElementNameSetAndRestore
- {
- public:
-
- /**
- * Construct an object to set and restore the current pending element name.
- *
- * @param theExecutionContext a reference to the current execution context
- * @param theNewPendingElementName the new pending element name to set.
- */
- PendingElementNameSetAndRestore(
- StylesheetExecutionContext& theExecutionContext,
- const XalanDOMString& theNewPendingElementName = XalanDOMString()) :
- m_executionContext(theExecutionContext),
- m_savedPendingElementName(theExecutionContext.getPendingElementName())
- {
- theExecutionContext.setPendingElementName(theNewPendingElementName);
- }
-
- ~PendingElementNameSetAndRestore()
- {
- m_executionContext.setPendingElementName(m_savedPendingElementName);
- }
-
- private:
-
- StylesheetExecutionContext& m_executionContext;
-
- const DOMString m_savedPendingElementName;
- };
-
- class PendingAttributesSetAndRestore
- {
- public:
-
- /**
- * Construct an object to set and restore the current pending attributes.
- *
- * @param theExecutionContext a reference to the current execution context
- * @param theNewPendingAttributes the new pending attributes to set.
- */
- PendingAttributesSetAndRestore(
- StylesheetExecutionContext& theExecutionContext,
- const AttributeListImpl& theNewPendingAttributes = AttributeListImpl()) :
- m_executionContext(theExecutionContext),
- m_savedPendingAttributes(theExecutionContext.getPendingAttributes())
- {
- theExecutionContext.setPendingAttributes(theNewPendingAttributes);
- }
-
- ~PendingAttributesSetAndRestore()
- {
- m_executionContext.setPendingAttributes(m_savedPendingAttributes);
- }
-
- private:
-
- StylesheetExecutionContext& m_executionContext;
-
- const AttributeListImpl m_savedPendingAttributes;
- };
-
- class ExecutionStateSetAndRestore
- {
- public:
-
- /**
- * Construct an object to set and restore the current execution state.
- *
- * @param theExecutionContext a reference to the current execution context
- * @param theNewListener the new listener to set.
- * @param theNewPendingElementName the new pending element name to set.
- * @param theNewPendingAttributes the new pending attributes to set.
- */
- ExecutionStateSetAndRestore(
- StylesheetExecutionContext& theExecutionContext,
- FormatterListener* theNewListener = 0,
- bool hasPendingStartDocument = false,
- bool mustFlushPendingStartDocument = false,
- const XalanDOMString& theNewPendingElementName = XalanDOMString(),
- const AttributeListImpl& theNewPendingAttributes = AttributeListImpl()) :
- m_hasPendingSetAndRestore(theExecutionContext,
- hasPendingStartDocument),
- m_flushPendingSetAndRestore(theExecutionContext,
- mustFlushPendingStartDocument),
- m_formatterListenerSetAndRestore(theExecutionContext,
- theNewListener),
- m_pendingElementNameSetAndRestore(theExecutionContext,
- theNewPendingElementName),
- m_pendingAttributesSetAndRestore(theExecutionContext,
- theNewPendingAttributes)
- {
- }
-
- ~ExecutionStateSetAndRestore()
- {
- }
-
- private:
-
- const HasPendingStartDocumentSetAndRestore m_hasPendingSetAndRestore;
-
- const MustFlushPendingStartDocumentSetAndRestore m_flushPendingSetAndRestore;
-
- const FormatterListenerSetAndRestore m_formatterListenerSetAndRestore;
-
- const PendingElementNameSetAndRestore m_pendingElementNameSetAndRestore;
-
- const PendingAttributesSetAndRestore m_pendingAttributesSetAndRestore;
- };
-
/**
* Add a result attribute to the list of pending attributes.
*
@@ -1572,13 +1346,13 @@
virtual bool
isIgnorableWhitespace(const XalanText& node) const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const = 0;
virtual XalanNode*
@@ -1589,13 +1363,15 @@
const XalanNode& node1,
const XalanNode& node2) const = 0;
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const = 0;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const = 0;
virtual XalanElement*
getElementByID(
- const XalanDOMString& id,
- const XalanDocument& doc) const = 0;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const = 0;
virtual const NodeRefListBase&
getContextNodeList() const = 0;
@@ -1674,7 +1450,7 @@
virtual void
setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const = 0;
virtual XalanDOMString
@@ -1697,12 +1473,6 @@
virtual void
setThrowFoundIndex(bool fThrow) = 0;
- virtual void
- setCurrentPattern(const XalanDOMString& thePattern) = 0;
-
- virtual XalanDOMString
- getCurrentPattern() const = 0;
-
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const = 0;
@@ -1725,16 +1495,34 @@
const XalanNode* styleNode = 0) const = 0;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const = 0;
+ const XalanNode* styleNode = 0) const = 0;
+
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const = 0;
};
1.38 +71 -85 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- StylesheetExecutionContextDefault.cpp 2000/10/07 15:26:10 1.37
+++ StylesheetExecutionContextDefault.cpp 2000/11/02 01:46:27 1.38
@@ -249,26 +249,10 @@
-const AttributeList&
-StylesheetExecutionContextDefault::getPendingAttributes() const
-{
- return m_xsltProcessor.getPendingAttributes();
-}
-
-
-
-XalanDOMString
-StylesheetExecutionContextDefault::getPendingElementName() const
-{
- return m_xsltProcessor.getPendingElementName();
-}
-
-
-
-void
-StylesheetExecutionContextDefault::setPendingAttributes(const AttributeList& pendingAttributes)
+bool
+StylesheetExecutionContextDefault::isElementPending() const
{
- m_xsltProcessor.setPendingAttributes(pendingAttributes);
+ return m_xsltProcessor.isElementPending();
}
@@ -281,20 +265,28 @@
{
// Remove the old attribute, then add the new one. AttributeListImpl::addAttribute()
// does this for us.
- m_xsltProcessor.getPendingAttributes().addAttribute(theName, theNewType, theNewValue);
+ m_xsltProcessor.replacePendingAttribute(theName, theNewType, theNewValue);
}
void
-StylesheetExecutionContextDefault::setPendingElementName(const XalanDOMString& elementName)
+StylesheetExecutionContextDefault::pushOutputContext(FormatterListener* flistener)
{
- m_xsltProcessor.setPendingElementName(elementName);
+ m_xsltProcessor.pushOutputContext(flistener);
}
void
+StylesheetExecutionContextDefault::popOutputContext()
+{
+ m_xsltProcessor.popOutputContext();
+}
+
+
+
+void
StylesheetExecutionContextDefault::addResultAttribute(
const XalanDOMString& aname,
const XalanDOMString& value)
@@ -355,38 +347,6 @@
-bool
-StylesheetExecutionContextDefault::getHasPendingStartDocument() const
-{
- return m_xsltProcessor.getHasPendingStartDocument();
-}
-
-
-
-void
-StylesheetExecutionContextDefault::setHasPendingStartDocument(bool b)
-{
- m_xsltProcessor.setHasPendingStartDocument(b);
-}
-
-
-
-bool
-StylesheetExecutionContextDefault::getMustFlushPendingStartDocument() const
-{
- return m_xsltProcessor.getMustFlushPendingStartDocument();
-}
-
-
-
-void
-StylesheetExecutionContextDefault::setMustFlushPendingStartDocument(bool b)
-{
- m_xsltProcessor.setMustFlushPendingStartDocument(b);
-}
-
-
-
int
StylesheetExecutionContextDefault::getIndent() const
{
@@ -619,7 +579,7 @@
{
m_variablesStack.pushContextMarker();
- m_liveVariablesStack.push_back(LiveVariablesStackType::value_type());
+ m_liveVariablesStack.resize(m_liveVariablesStack.size() + 1); //LiveVariablesStackType::value_type());
m_liveVariablesStack.back().reserve(eDefaultVariablesCollectionSize);
}
@@ -761,7 +721,7 @@
{
m_variablesStack.pushElementFrame(elem);
- m_liveVariablesStack.push_back(LiveVariablesStackType::value_type());
+ m_liveVariablesStack.resize(m_liveVariablesStack.size() + 1); //(LiveVariablesStackType::value_type());
}
@@ -1206,9 +1166,9 @@
{
assert(m_collationCompareFunctor != 0);
- if (theLHS == 0)
+ if (length(theLHS) == 0)
{
- if (theRHS == 0)
+ if (length(theRHS) == 0)
{
return 0;
}
@@ -1217,9 +1177,9 @@
return -1;
}
}
- else if (theRHS == 0)
+ else if (length(theRHS) == 0)
{
- if (theLHS == 0)
+ if (length(theLHS) == 0)
{
return 0;
}
@@ -1408,7 +1368,7 @@
-XalanDOMString
+const XalanDOMString&
StylesheetExecutionContextDefault::getNamespaceOfNode(const XalanNode& n) const
{
return m_xpathExecutionContextDefault.getNamespaceOfNode(n);
@@ -1416,7 +1376,7 @@
-XalanDOMString
+const XalanDOMString&
StylesheetExecutionContextDefault::getNameOfNode(const XalanNode& n) const
{
return m_xpathExecutionContextDefault.getNameOfNode(n);
@@ -1424,7 +1384,7 @@
-XalanDOMString
+const XalanDOMString&
StylesheetExecutionContextDefault::getLocalNameOfNode(const XalanNode& n) const
{
return m_xpathExecutionContextDefault.getLocalNameOfNode(n);
@@ -1450,10 +1410,12 @@
-XalanDOMString
-StylesheetExecutionContextDefault::getNodeData(const XalanNode& n) const
+void
+StylesheetExecutionContextDefault::getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const
{
- return m_xpathExecutionContextDefault.getNodeData(n);
+ m_xpathExecutionContextDefault.getNodeData(n, s);
}
@@ -1638,7 +1600,14 @@
const XObject* const theVariable =
m_variablesStack.getVariable(name);
- return m_xpathExecutionContextDefault.getXObjectFactory().clone(*theVariable);
+ if (theVariable != 0)
+ {
+ return m_xpathExecutionContextDefault.getXObjectFactory().clone(*theVariable);
+ }
+ else
+ {
+ return 0;
+ }
}
@@ -1652,14 +1621,14 @@
void
-StylesheetExecutionContextDefault::setPrefixResolver(const PrefixResolver* thePrefixResolver)
+StylesheetExecutionContextDefault::setPrefixResolver(const PrefixResolver* thePrefixResolver)
{
m_xpathExecutionContextDefault.setPrefixResolver(thePrefixResolver);
}
-XalanDOMString
+const XalanDOMString&
StylesheetExecutionContextDefault::getNamespaceForPrefix(const XalanDOMString& prefix) const
{
return m_xpathExecutionContextDefault.getNamespaceForPrefix(prefix);
@@ -1717,22 +1686,6 @@
-void
-StylesheetExecutionContextDefault::setCurrentPattern(const XalanDOMString& thePattern)
-{
- m_xpathExecutionContextDefault.setCurrentPattern(thePattern);
-}
-
-
-
-XalanDOMString
-StylesheetExecutionContextDefault::getCurrentPattern() const
-{
- return m_xpathExecutionContextDefault.getCurrentPattern();
-}
-
-
-
XalanDocument*
StylesheetExecutionContextDefault::getSourceDocument(const XalanDOMString& theURI) const
{
@@ -1860,6 +1813,17 @@
void
+StylesheetExecutionContextDefault::error(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ error(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
StylesheetExecutionContextDefault::warn(
const XalanDOMString& msg,
const XalanNode* sourceNode,
@@ -1871,12 +1835,34 @@
void
+StylesheetExecutionContextDefault::warn(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ warn(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
StylesheetExecutionContextDefault::message(
const XalanDOMString& msg,
const XalanNode* sourceNode,
const XalanNode* styleNode) const
{
m_xsltProcessor.message(msg, sourceNode, styleNode);
+}
+
+
+
+void
+StylesheetExecutionContextDefault::message(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ message(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
}
1.35 +36 -37 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- StylesheetExecutionContextDefault.hpp 2000/10/07 15:26:10 1.34
+++ StylesheetExecutionContextDefault.hpp 2000/11/02 01:46:28 1.35
@@ -176,14 +176,8 @@
const XalanDOMString& theMessage,
const void* theKey);
- virtual const AttributeList&
- getPendingAttributes() const;
-
- virtual XalanDOMString
- getPendingElementName() const;
-
- virtual void
- setPendingAttributes(const AttributeList& pendingAttributes);
+ virtual bool
+ isElementPending() const;
virtual void
replacePendingAttribute(
@@ -192,9 +186,12 @@
const XalanDOMChar* theNewValue);
virtual void
- setPendingElementName(const XalanDOMString& elementName);
+ pushOutputContext(FormatterListener* flistener = 0);
virtual void
+ popOutputContext();
+
+ virtual void
addResultAttribute(
const XalanDOMString& aname,
const XalanDOMString& value);
@@ -219,18 +216,6 @@
virtual void
setFormatterListener(FormatterListener* flistener);
- virtual bool
- getHasPendingStartDocument() const;
-
- virtual void
- setHasPendingStartDocument(bool b);
-
- virtual bool
- getMustFlushPendingStartDocument() const;
-
- virtual void
- setMustFlushPendingStartDocument(bool b);
-
virtual int
getIndent() const;
@@ -604,13 +589,13 @@
virtual bool
isIgnorableWhitespace(const XalanText& node) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNameOfNode(const XalanNode& n) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalNameOfNode(const XalanNode& n) const;
virtual XalanNode*
@@ -621,13 +606,15 @@
const XalanNode& node1,
const XalanNode& node2) const;
- virtual XalanDOMString
- getNodeData(const XalanNode& n) const;
+ virtual void
+ getNodeData(
+ const XalanNode& n,
+ XalanDOMString& s) const;
virtual XalanElement*
getElementByID(
- const XalanDOMString& id,
- const XalanDocument& doc) const;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const;
virtual const NodeRefListBase&
getContextNodeList() const;
@@ -706,7 +693,7 @@
virtual void
setPrefixResolver(const PrefixResolver* thePrefixResolver);
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceForPrefix(const XalanDOMString& prefix) const;
virtual XalanDOMString
@@ -729,12 +716,6 @@
virtual void
setThrowFoundIndex(bool fThrow);
- virtual void
- setCurrentPattern(const XalanDOMString& thePattern);
-
- virtual XalanDOMString
- getCurrentPattern() const;
-
virtual XalanDocument*
getSourceDocument(const XalanDOMString& theURI) const;
@@ -753,16 +734,34 @@
const XalanNode* styleNode = 0) const;
virtual void
+ error(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
warn(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
+ warn(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
message(
const XalanDOMString& msg,
const XalanNode* sourceNode = 0,
- const XalanNode* styleNode = 0) const;
+ const XalanNode* styleNode = 0) const;
+
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
class XPathCacheReturnFunctor
1.46 +29 -22 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.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- StylesheetHandler.cpp 2000/10/11 19:43:07 1.45
+++ StylesheetHandler.cpp 2000/11/02 01:46:28 1.46
@@ -77,10 +77,10 @@
#include <PlatformSupport/DoubleSupport.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
#include <PlatformSupport/STLHelper.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
+
#include "Constants.hpp"
#include "ElemApplyImport.hpp"
#include "ElemApplyTemplates.hpp"
@@ -119,6 +119,10 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
StylesheetHandler::StylesheetHandler(
Stylesheet& stylesheetTree,
StylesheetConstructionContext& constructionContext) :
@@ -290,7 +294,7 @@
// First push namespaces
m_stylesheet.pushNamespaces(atts);
- const XalanDOMString ns = m_stylesheet.getNamespaceFromStack(name);
+ const XalanDOMString& ns = m_stylesheet.getNamespaceFromStack(name);
const unsigned int nameLength = length(name);
const unsigned int index = indexOf(name, XalanUnicode::charColon);
@@ -300,7 +304,7 @@
if(length(ns) == 0 && nameLength != length(localName))
{
// Warn that there is a prefix that was not resolved...
- m_constructionContext.warn(XalanDOMString("Could not resolve prefix ") + name);
+ m_constructionContext.warn("Could not resolve prefix " + XalanDOMString(name));
}
ElemTemplateElement* elem = 0;
@@ -368,7 +372,7 @@
break;
case Constants::ELEMNAME_LOCALE:
- m_constructionContext.warn(XALAN_STATIC_UCODE_STRING("xsl:locale not yet supported!"));
+ m_constructionContext.warn(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("xsl:locale not yet supported!")));
break;
case Constants::ELEMNAME_PRESERVESPACE:
@@ -603,9 +607,7 @@
if (fVersionFound == false)
{
- const XalanDOMString msg("The stylesheet element did not specify a version attribute!");
-
- throw SAXException(toCharArray(msg));
+ throw SAXException(c_wstr(TranscodeFromLocalCodePage("The stylesheet element did not specify a version attribute!")));
}
}
break;
@@ -614,7 +616,7 @@
{
XalanDOMString msg("Unknown XSL element: " + localName);
- throw SAXException(toCharArray(msg));
+ throw SAXException(c_wstr(TranscodeFromLocalCodePage("Unknown XSL element: ") + localName));
}
break;
@@ -1071,12 +1073,16 @@
}
-ElemTemplateElement* StylesheetHandler::initWrapperless (const XalanDOMString& name,
- const AttributeList& atts, int lineNumber, int columnNumber)
+ElemTemplateElement*
+StylesheetHandler::initWrapperless (
+ const XalanDOMChar* name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber)
{
m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
- AttributeListImpl templateAttrs;
+ AttributeListImpl templateAttrs;
templateAttrs.addAttribute(c_wstr(Constants::ATTRNAME_NAME),
c_wstr(Constants::ATTRTYPE_CDATA),
@@ -1084,7 +1090,7 @@
m_pTemplate = new ElemTemplate(m_constructionContext,
m_stylesheet,
- Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING),
templateAttrs,
lineNumber,
columnNumber);
@@ -1161,7 +1167,7 @@
const XalanDOMString saved_XSLNameSpaceURL = m_stylesheet.getXSLTNamespaceURI();
- const XalanDOMString href = atts.getValue(i);
+ const XalanDOMString href(atts.getValue(i));
Stylesheet::URLStackType& includeStack = m_stylesheet.getIncludeStack();
assert(includeStack.size() > 0);
@@ -1232,9 +1238,9 @@
PushPopIncludeState theStateHandler(*this);
- const XalanDOMString href = atts.getValue(i);
+ const XalanDOMString href(atts.getValue(i));
- assert(m_stylesheet.getIncludeStack().back() != 0);
+ assert(c_wstr(m_stylesheet.getIncludeStack().back()) != 0);
const XalanDOMString hrefUrl = m_constructionContext.getURLStringFromString(href, m_stylesheet.getIncludeStack().back());
if(stackContains(m_stylesheet.getIncludeStack(), hrefUrl))
@@ -1336,9 +1342,9 @@
// reset state
m_inLXSLTScript = false;
- m_LXSLTScriptLang = 0;
- m_LXSLTScriptSrcURL = 0;
- m_LXSLTScriptBody = 0;
+ clear(m_LXSLTScriptLang);
+ clear(m_LXSLTScriptSrcURL);
+ clear(m_LXSLTScriptBody);
m_pLXSLTExtensionNSH = 0;
}
// END SANJIVA CODE
@@ -1385,7 +1391,7 @@
false, preserveSpace,
disableOutputEscaping);
- const bool isWhite = isWhitespace(chars, 0, length);
+ const bool isWhite = isXMLWhitespace(chars, 0, length);
if(preserveSpace || (!preserveSpace && !isWhite))
{
@@ -1477,7 +1483,7 @@
true, preserveSpace,
disableOutputEscaping);
- bool isWhite = isWhitespace(chars, 0, length);
+ const bool isWhite = isXMLWhitespace(chars, 0, length);
if(preserveSpace || (!preserveSpace && !isWhite))
{
@@ -1499,9 +1505,10 @@
if(0 != last)
{
// If it was surrounded by xsl:text, it will count as an element.
- bool isPrevCharData =
+ const bool isPrevCharData =
Constants::ELEMNAME_TEXTLITERALRESULT == last->getXSLToken();
- bool isLastPoppedXSLText = (m_lastPopped != 0) &&
+
+ const bool isLastPoppedXSLText = (m_lastPopped != 0) &&
(Constants::ELEMNAME_TEXT == m_lastPopped->getXSLToken());
if(isPrevCharData && ! isLastPoppedXSLText)
1.19 +5 -5 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StylesheetHandler.hpp 2000/08/28 01:19:41 1.18
+++ StylesheetHandler.hpp 2000/11/02 01:46:28 1.19
@@ -478,16 +478,16 @@
XalanDOMString m_LXSLTScriptSrcURL;
ExtensionNSHandler* m_pLXSLTExtensionNSH;
// END SANJIVA CODE
-
+
/**
* Init the wrapperless template
*/
ElemTemplateElement*
initWrapperless(
- const XalanDOMString& name,
- const AttributeList& atts,
- int lineNumber,
- int columnNumber);
+ const XalanDOMChar* name,
+ const AttributeList& atts,
+ int lineNumber,
+ int columnNumber);
class PushPopIncludeState
1.28 +24 -39 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- StylesheetRoot.cpp 2000/10/12 17:07:49 1.27
+++ StylesheetRoot.cpp 2000/11/02 01:46:28 1.28
@@ -170,7 +170,7 @@
StylesheetExecutionContext& executionContext) const
{
// Find the root pattern in the XSL.
- const ElemTemplate* rootRule =
+ const ElemTemplate* rootRule =
findTemplate(executionContext, sourceTree, sourceTree);
if(0 == rootRule)
@@ -189,8 +189,8 @@
if(executionContext.doDiagnosticsOutput())
{
- executionContext.diag(XALAN_STATIC_UCODE_STRING("============================="));
- executionContext.diag(XALAN_STATIC_UCODE_STRING("Transforming..."));
+ executionContext.diag(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("=============================")));
+ executionContext.diag(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Transforming...")));
executionContext.pushTime(&sourceTree);
}
@@ -206,9 +206,9 @@
executionContext.startDocument();
- // Output the action of the found root rule. All processing
- // occurs from here. buildResultFromTemplate is highly recursive.
- rootRule->execute(executionContext, sourceTree, sourceTree, QName());
+ // Output the action of the found root rule. All processing
+ // occurs from here.
+ rootRule->execute(executionContext, sourceTree, sourceTree);
executionContext.endDocument();
@@ -217,9 +217,9 @@
if(executionContext.doDiagnosticsOutput())
{
- executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
- executionContext.displayDuration(XALAN_STATIC_UCODE_STRING("transform"), &sourceTree);
- executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
+ executionContext.diag(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("")));
+ executionContext.displayDuration(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("transform")), &sourceTree);
+ executionContext.diag(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("")));
}
}
@@ -230,12 +230,8 @@
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext) const
{
- FormatterListener* flistener = 0;
+ FormatterListener* flistener = outputTarget.getFormatterListener();;
- Writer* pw = 0;
-
- flistener = outputTarget.getFormatterListener();
-
if(flistener == 0)
{
// $$$ ToDo: For right now, XSLTResultTarget::getDocumentHandler()
@@ -256,26 +252,14 @@
(0 != outputTarget.getByteStream()) ||
(0 != outputTarget.getFileName().length()))
{
+ Writer* pw = 0;
+
if(0 != outputTarget.getCharacterStream())
{
pw = outputTarget.getCharacterStream();
}
else
{
-/*
- java:
- XalanDOMString mimeEncoding;
- XalanDOMString encoding;
- mimeEncoding = getOutputEncoding();
- encoding = getJavaOutputEncoding();
- if(0 == encoding)
- {
- m_processor->m_diagnosticsPrintWriter.println("Encoding not supported: "+mimeEncoding);
- mimeEncoding = "UTF-8";
- encoding = FormatterToXML.convertMime2JavaEncoding(mimeEncoding);
- }
-*/
-
if(0 != outputTarget.getByteStream())
{
pw = executionContext.createPrintWriter(*outputTarget.getByteStream());
@@ -297,8 +281,9 @@
}
int indentAmount = executionContext.getIndent();
+
const bool doIndent = (indentAmount > -1) ? true : m_indentResult;
-
+
switch(m_outputMethod)
{
case FormatterListener::OUTPUT_METHOD_HTML:
@@ -393,11 +378,11 @@
if(isEmpty(m_encoding))
{
- encoding = XALAN_STATIC_UCODE_STRING("UTF8");
+ encoding = StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("UTF8"));
}
- else if(equalsIgnoreCase(m_encoding, XALAN_STATIC_UCODE_STRING("UTF-16")))
+ else if(equalsIgnoreCase(m_encoding, StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("UTF-16"))))
{
- encoding = XALAN_STATIC_UCODE_STRING("Unicode");
+ encoding = StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Unicode"));
}
// @@ JMD: do we need this ??
@@ -481,7 +466,7 @@
}
else if (isAttrOK(aname, atts, i, constructionContext) == false)
{
- constructionContext.error(name + XalanDOMString(" has an illegal attribute: ")+aname);
+ constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
}
}
@@ -513,7 +498,7 @@
m_defaultRule = new ElemTemplate(constructionContext,
*this,
- Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
@@ -523,7 +508,7 @@
ElemApplyTemplates* childrenElement
= new ElemApplyTemplates(constructionContext,
*this,
- Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
@@ -540,7 +525,7 @@
m_defaultTextRule = new ElemTemplate(constructionContext,
*this,
- Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
@@ -553,7 +538,7 @@
ElemValueOf* elemValueOf =
new ElemValueOf(constructionContext,
*this,
- Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
@@ -570,7 +555,7 @@
m_defaultRootRule =
new ElemTemplate(constructionContext,
*this,
- Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
@@ -580,7 +565,7 @@
childrenElement =
new ElemApplyTemplates(constructionContext,
*this,
- Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING,
+ c_wstr(Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING),
attrs,
lineNumber,
columnNumber);
1.6 +3 -1 xml-xalan/c/src/XSLT/TraceListenerDefault.cpp
Index: TraceListenerDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/TraceListenerDefault.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TraceListenerDefault.cpp 2000/09/05 02:24:53 1.5
+++ TraceListenerDefault.cpp 2000/11/02 01:46:28 1.6
@@ -259,8 +259,10 @@
{
for(unsigned int i = 0; i < n; i++)
{
+ assert(nl.item(i) != 0);
+
m_printWriter.print(XALAN_STATIC_UCODE_STRING(" "));
- m_printWriter.println(nl.item(i)->getXSLTData());
+ m_printWriter.println(DOMServices::getNodeData(*nl.item(i)));
}
}
}
1.6 +2 -2 xml-xalan/c/src/XSLT/VariablesStack.cpp
Index: VariablesStack.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- VariablesStack.cpp 2000/09/19 15:12:17 1.5
+++ VariablesStack.cpp 2000/11/02 01:46:28 1.6
@@ -568,8 +568,8 @@
VariablesStack::InvalidStackContextException::InvalidStackContextException() :
- XSLTProcessorException(XALAN_STATIC_UCODE_STRING("Invalid stack context"),
- XALAN_STATIC_UCODE_STRING("InvalidStackContextException"))
+ XSLTProcessorException(TranscodeFromLocalCodePage("Invalid stack context"),
+ TranscodeFromLocalCodePage("InvalidStackContextException"))
{
}
1.66 +241 -458 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.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- XSLTEngineImpl.cpp 2000/10/11 19:43:07 1.65
+++ XSLTEngineImpl.cpp 2000/11/02 01:46:28 1.66
@@ -85,7 +85,6 @@
-#include <PlatformSupport/DOMStringPrintWriter.hpp>
#include <PlatformSupport/PrintWriter.hpp>
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
@@ -168,10 +167,10 @@
m_resultNameSpacePrefix(),
m_resultNameSpaceURL(),
m_currentNode(),
- m_pendingElementName(),
- m_pendingAttributes(),
- m_hasPendingStartDocument(false),
- m_mustFlushStartDocument(false),
+// m_pendingElementName(),
+// m_pendingAttributes(),
+// m_hasPendingStartDocument(false),
+// m_mustFlushPendingStartDocument(false),
m_resultNameSpaces(),
m_emptyNamespace(),
m_xpathFactory(xpathFactory),
@@ -188,14 +187,15 @@
m_durationsTable(),
m_traceListeners(),
m_uniqueNSValue(0),
- m_stripWhiteSpace(false),
m_topLevelParams(),
m_parserLiaison(parserLiaison),
m_xpathSupport(xpathSupport),
m_xpathEnvSupport(xpathEnvSupport),
m_domSupport(domSupport),
- m_flistener(0),
- m_executionContext(0)
+// m_flistener(0),
+ m_executionContext(0),
+ m_outputContextStack(1),
+ m_outputContextStackPosition(m_outputContextStack.begin())
{
}
@@ -207,15 +207,20 @@
m_topLevelParams.clear();
m_durationsTable.clear();
m_stylesheetLocatorStack.clear();
- clear(m_pendingElementName);
- m_pendingAttributes.clear();
+// clear(m_pendingElementName);
+// m_pendingAttributes.clear();
m_cdataStack.clear();
m_resultTreeFactory = 0;
m_currentNode = 0;
- m_hasPendingStartDocument = false;
- m_mustFlushStartDocument = false;
+// setHasPendingStartDocument(false);
+// setMustFlushPendingStartDocument(false);
+ m_outputContextStack.clear();
+
+ m_outputContextStack.push_back(OutputContextStackType::value_type());
+ m_outputContextStackPosition = m_outputContextStack.begin();
+
m_xpathSupport.reset();
m_xpathEnvSupport.reset();
m_xpathFactory.reset();
@@ -237,39 +242,7 @@
-AttributeListImpl&
-XSLTEngineImpl::getPendingAttributes()
-{
- return m_pendingAttributes;
-}
-
-
-
-const XalanDOMString
-XSLTEngineImpl::getPendingElementName() const
-{
- return m_pendingElementName;
-}
-
-
-
void
-XSLTEngineImpl::setPendingAttributes(const AttributeList& pendingAttributes)
-{
- m_pendingAttributes = pendingAttributes;
-}
-
-
-
-void
-XSLTEngineImpl::setPendingElementName(const XalanDOMString& elementName)
-{
- m_pendingElementName = elementName;
-}
-
-
-
-void
XSLTEngineImpl::process(
XSLTInputSource& inputSource,
XSLTInputSource& stylesheetSource,
@@ -314,7 +287,7 @@
{
// Didn't get a stylesheet from the input source, so look for a
// stylesheet processing instruction...
- XalanDOMString stylesheetURI = 0;
+ XalanDOMString stylesheetURI;
// The PI must be a child of the document...
XalanNode* child = sourceTree->getFirstChild();
@@ -419,7 +392,7 @@
if(0 != m_diagnosticsPrintWriter)
{
- displayDuration(XALAN_STATIC_UCODE_STRING("Total time"), &totalTimeID);
+ displayDuration(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Total time")), &totalTimeID);
}
}
}
@@ -466,7 +439,7 @@
if(0 != m_diagnosticsPrintWriter)
{
- displayDuration(XALAN_STATIC_UCODE_STRING("Total time"), &totalTimeID);
+ displayDuration(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Total time")), &totalTimeID);
}
}
@@ -572,8 +545,8 @@
XalanNode* sourceTree = 0;
XalanDOMString xmlIdentifier = 0 != inputSource.getSystemId() ?
- inputSource.getSystemId() :
- XALAN_STATIC_UCODE_STRING("Input XML");
+ XalanDOMString(inputSource.getSystemId()) :
+ StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Input XML"));
if(0 != inputSource.getNode())
{
@@ -919,7 +892,7 @@
if(equals(ns, s_XSLNameSpaceURL))
{
- const XalanDOMString localName =
+ const XalanDOMString& localName =
m_xpathSupport.getLocalNameOfNode(node);
const ElementKeysMapType::const_iterator j =
@@ -932,7 +905,7 @@
}
else if(equals(ns, s_XSLT4JNameSpaceURL))
{
- const XalanDOMString localName =
+ const XalanDOMString& localName =
m_xpathSupport.getLocalNameOfNode(node);
const ElementKeysMapType::const_iterator j =
@@ -1185,7 +1158,7 @@
m_problemListener->problem(ProblemListener::eXSLPROCESSOR,
ProblemListener::eMESSAGE,
styleNode, sourceNode,
- c_wstr(msg), 0, 0, 0);
+ msg, 0, 0, 0);
if(shouldThrow == true)
{
@@ -1197,6 +1170,17 @@
void
+XSLTEngineImpl::message(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ message(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
XSLTEngineImpl::problem(
const XalanDOMString& msg,
ProblemListener::eClassification classification,
@@ -1240,6 +1224,18 @@
}
+
+void
+XSLTEngineImpl::warn(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ warn(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
void
XSLTEngineImpl::error(
const XalanDOMString& msg,
@@ -1252,6 +1248,17 @@
void
+XSLTEngineImpl::error(
+ const char* msg,
+ const XalanNode* sourceNode,
+ const XalanNode* styleNode) const
+{
+ error(TranscodeFromLocalCodePage(msg), sourceNode, styleNode);
+}
+
+
+
+void
XSLTEngineImpl::pushTime(const void* key) const
{
if(0 != key)
@@ -1345,6 +1352,14 @@
void
+XSLTEngineImpl::diag(const char* s) const
+{
+ diag(TranscodeFromLocalCodePage(s));
+}
+
+
+
+void
XSLTEngineImpl::setQuietConflictWarnings(bool b)
{
m_quietConflictWarnings = b;
@@ -1401,17 +1416,18 @@
void
XSLTEngineImpl::startDocument()
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(m_executionContext != 0);
- if (m_hasPendingStartDocument == false)
+ if (getHasPendingStartDocument() == false)
{
- m_hasPendingStartDocument = true;
- m_mustFlushStartDocument = false;
+ setHasPendingStartDocument(true);
+
+ setMustFlushPendingStartDocument(false);
}
- else if (m_mustFlushStartDocument == true)
+ else if (getMustFlushPendingStartDocument() == true)
{
- m_flistener->startDocument();
+ getFormatterListener()->startDocument();
if(getTraceListeners() > 0)
{
@@ -1420,9 +1436,9 @@
fireGenerateEvent(ge);
}
- // Reset this, but leave m_mustFlushStartDocument alone,
+ // Reset this, but leave getMustFlushPendingStartDocument() alone,
// since it will still be needed.
- m_hasPendingStartDocument = false;
+ setHasPendingStartDocument(false);
}
}
@@ -1431,12 +1447,14 @@
void
XSLTEngineImpl::endDocument()
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(m_executionContext != 0);
+ setMustFlushPendingStartDocument(true);
+
flushPending();
- m_flistener->endDocument();
+ getFormatterListener()->endDocument();
if(getTraceListeners() > 0)
{
@@ -1522,11 +1540,14 @@
bool
XSLTEngineImpl::pendingAttributesHasDefaultNS() const
{
- const unsigned int n = m_pendingAttributes.getLength();
+ const AttributeListImpl& thePendingAttributes =
+ getPendingAttributes();
+ const unsigned int n = thePendingAttributes.getLength();
+
for(unsigned int i = 0; i < n; i++)
{
- if(equals(m_pendingAttributes.getName(i),
+ if(equals(thePendingAttributes.getName(i),
DOMServices::s_XMLNamespace) == true)
{
return true;
@@ -1541,28 +1562,28 @@
void
XSLTEngineImpl::flushPending()
{
- if(m_hasPendingStartDocument == true && 0 != length(m_pendingElementName))
+ if(getHasPendingStartDocument() == true && 0 != length(getPendingElementName()))
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(m_executionContext != 0);
if (m_stylesheetRoot->isOutputMethodSet() == false)
{
- if (equalsIgnoreCase(m_pendingElementName,
+ if (equalsIgnoreCase(getPendingElementName(),
Constants::ELEMNAME_HTML_STRING) == true &&
pendingAttributesHasDefaultNS() == false)
{
- if (m_flistener->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
+ if (getFormatterListener()->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
{
// Yuck!!! Ugly hack to switch to HTML on-the-fly.
FormatterToXML* const theFormatter =
#if defined(XALAN_OLD_STYLE_CASTS)
- (FormatterToXML*)m_flistener;
+ (FormatterToXML*)getFormatterListener();
#else
- static_cast<FormatterToXML*>(m_flistener);
+ static_cast<FormatterToXML*>(getFormatterListener());
#endif
- m_flistener =
+ setFormatterListenerImpl(
m_executionContext->createFormatterToHTML(
theFormatter->getWriter(),
theFormatter->getEncoding(),
@@ -1571,36 +1592,42 @@
theFormatter->getDoctypePublic(),
true, // indent
theFormatter->getIndent() > 0 ? theFormatter->getIndent() :
- StylesheetExecutionContext::eDefaultHTMLIndentAmount);
+ StylesheetExecutionContext::eDefaultHTMLIndentAmount));
}
}
}
}
+
+ XalanDOMString& thePendingElementName = getPendingElementNameImpl();
- if(m_hasPendingStartDocument == true && m_mustFlushStartDocument == true)
+ if(getHasPendingStartDocument() == true && getMustFlushPendingStartDocument() == true)
{
startDocument();
}
- if(0 != length(m_pendingElementName) && m_mustFlushStartDocument == true)
+ if(0 != length(thePendingElementName) && getMustFlushPendingStartDocument() == true)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(m_executionContext != 0);
+
+ m_cdataStack.push_back(isCDataResultElem(thePendingElementName)? true : false);
+
+ AttributeListImpl& thePendingAttributes =
+ getPendingAttributesImpl();
- m_cdataStack.push_back(isCDataResultElem(m_pendingElementName)? true : false);
- m_flistener->startElement(c_wstr(m_pendingElementName), m_pendingAttributes);
+ getFormatterListener()->startElement(c_wstr(thePendingElementName), thePendingAttributes);
if(getTraceListeners() > 0)
{
const GenerateEvent ge(GenerateEvent::EVENTTYPE_STARTELEMENT,
- m_pendingElementName, &m_pendingAttributes);
+ thePendingElementName, &thePendingAttributes);
fireGenerateEvent(ge);
}
- m_pendingAttributes.clear();
+ thePendingAttributes.clear();
- clear(m_pendingElementName);
+ clear(thePendingElementName);
}
}
@@ -1609,18 +1636,19 @@
void
XSLTEngineImpl::startElement(const XMLCh* const name)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(name != 0);
+
flushPending();
+
+ // Push a new container on the stack.
+ m_resultNameSpaces.resize(m_resultNameSpaces.size() + 1);
+
+ m_resultNameSpaces.back().resize(1);
- // Push a new container on the stack, then push an empty
- // result namespace on to that container.
- NamespaceVectorType nsVector;
- nsVector.push_back(m_emptyNamespace);
- m_resultNameSpaces.push_back(nsVector);
- m_pendingElementName = name;
+ setPendingElementName(name);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
}
@@ -1630,31 +1658,35 @@
const XMLCh* const name,
AttributeList& atts)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(name != 0);
flushPending();
const unsigned int nAtts = atts.getLength();
- m_pendingAttributes.clear();
+ assert(m_outputContextStack.size() > 0);
+ AttributeListImpl& thePendingAttributes =
+ getPendingAttributesImpl();
+
+ thePendingAttributes.clear();
+
for(unsigned int i = 0; i < nAtts; i++)
{
- m_pendingAttributes.addAttribute(atts.getName(i),
- atts.getType(i),
- atts.getValue(i));
+ thePendingAttributes.addAttribute(
+ atts.getName(i),
+ atts.getType(i),
+ atts.getValue(i));
}
- // Push a new container on the stack, then push an empty
- // result namespace on to that container.
- NamespaceVectorType nsVector;
+ // Push a new container on the stack, then resize it
+ // to contain one empty namespaces vector.
+ m_resultNameSpaces.resize(m_resultNameSpaces.size() + 1);
- nsVector.push_back(m_emptyNamespace);
+ m_resultNameSpaces.back().resize(1);
- m_resultNameSpaces.push_back(nsVector);
-
- m_pendingElementName = name;
+ setPendingElementName(name);
}
@@ -1662,16 +1694,17 @@
void
XSLTEngineImpl::endElement(const XMLCh* const name)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(name != 0);
flushPending();
- m_flistener->endElement(name);
+ getFormatterListener()->endElement(name);
if(getTraceListeners() > 0)
{
- GenerateEvent ge(GenerateEvent::EVENTTYPE_ENDELEMENT, name, 0);
+ GenerateEvent ge(GenerateEvent::EVENTTYPE_ENDELEMENT, name);
+
fireGenerateEvent(ge);
}
@@ -1705,10 +1738,10 @@
const unsigned int start,
const unsigned int length)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(ch != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
@@ -1717,7 +1750,7 @@
if(0 != cdataElems.size() && 0 != m_cdataStack.size())
{
- m_flistener->cdata(ch + start, length);
+ getFormatterListener()->cdata(ch + start, length);
if(getTraceListeners() > 0)
{
@@ -1727,7 +1760,7 @@
}
else
{
- m_flistener->characters(ch + start, length);
+ getFormatterListener()->characters(ch + start, length);
if(getTraceListeners() > 0)
{
@@ -1747,11 +1780,11 @@
const unsigned int /* start */,
const unsigned int length)
{
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- m_flistener->charactersRaw(ch, length);
+ getFormatterListener()->charactersRaw(ch, length);
if(getTraceListeners() > 0)
{
@@ -1767,11 +1800,11 @@
void
XSLTEngineImpl::resetDocument()
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
flushPending();
- m_flistener->resetDocument();
+ getFormatterListener()->resetDocument();
}
@@ -1781,14 +1814,14 @@
const XMLCh* const ch,
const unsigned int length)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(ch != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- m_flistener->ignorableWhitespace(ch, length);
+ getFormatterListener()->ignorableWhitespace(ch, length);
if(getTraceListeners() > 0)
{
@@ -1806,20 +1839,22 @@
const XMLCh* const target,
const XMLCh* const data)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(target != 0);
assert(data != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- m_flistener->processingInstruction(target, data);
+ getFormatterListener()->processingInstruction(target, data);
if(getTraceListeners() > 0)
{
- GenerateEvent ge(GenerateEvent::EVENTTYPE_PI,
- target, data);
+ GenerateEvent ge(
+ GenerateEvent::EVENTTYPE_PI,
+ target,
+ data);
fireGenerateEvent(ge);
}
@@ -1830,14 +1865,14 @@
void
XSLTEngineImpl::comment(const XMLCh* const data)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(data != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- m_flistener->comment(data);
+ getFormatterListener()->comment(data);
if(getTraceListeners() > 0)
{
@@ -1851,14 +1886,14 @@
void
XSLTEngineImpl::entityReference(const XMLCh* const name)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(name != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- m_flistener->entityReference(name);
+ getFormatterListener()->entityReference(name);
if(getTraceListeners() > 0)
{
@@ -1877,10 +1912,10 @@
const unsigned int start,
const unsigned int length)
{
- assert(m_flistener != 0);
+ assert(getFormatterListener() != 0);
assert(ch != 0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
@@ -1889,7 +1924,7 @@
if(0 != cdataElems.size() && 0 != m_cdataStack.size())
{
- m_flistener->cdata(ch, length);
+ getFormatterListener()->cdata(ch, length);
if(getTraceListeners() > 0)
{
@@ -1901,7 +1936,7 @@
}
else
{
- m_flistener->characters(ch, length);
+ getFormatterListener()->characters(ch, length);
if(getTraceListeners() > 0)
{
@@ -1945,53 +1980,35 @@
static_cast<const XalanText&>(node);
#endif
- XalanDOMString data;
-
- if(stripWhiteSpace == true)
+ if(stripWhiteSpace == false || tx.isIgnorableWhitespace() == false)
{
- if(tx.isIgnorableWhitespace())
- {
- data = getNormalizedText(tx);
+ assert(tx.getParentNode() == 0 ||
+ tx.getParentNode()->getNodeType() != XalanNode::DOCUMENT_NODE);
- if((0 != length(data)) && (0 == length(trim(data))))
- {
- clear(data);
- }
- }
- }
- else
- {
- XalanNode* parent = node.getParentNode();
+ const XalanDOMString& data = tx.getData();
- if(parent == 0 || XalanNode::DOCUMENT_NODE != parent->getNodeType())
+ if(0 != length(data))
{
- data = getNormalizedText(tx);
- }
- }
-
-
- if(0 != length(data))
- {
- // TODO: Hack around the issue of comments next to literals.
- // This would be, when a comment is present, the whitespace
- // after the comment must be added to the literal. The
- // parser should do this, but XML4J doesn't seem to.
- // <foo>some lit text
- // <!-- comment -->
- // </foo>
- // Loop through next siblings while they are comments, then,
- // if the node after that is a ignorable text node, append
- // it to the text node just added.
-
- if(tx.isIgnorableWhitespace())
- {
- ignorableWhitespace(toCharArray(data), length(data));
- }
- else
- {
- characters(toCharArray(data), 0, length(data));
+ // TODO: Hack around the issue of comments next to literals.
+ // This would be, when a comment is present, the whitespace
+ // after the comment must be added to the literal. The
+ // parser should do this, but XML4J doesn't seem to.
+ // <foo>some lit text
+ // <!-- comment -->
+ // </foo>
+ // Loop through next siblings while they are comments, then,
+ // if the node after that is a ignorable text node, append
+ // it to the text node just added.
+ if(tx.isIgnorableWhitespace())
+ {
+ ignorableWhitespace(toCharArray(data), length(data));
+ }
+ else
+ {
+ characters(toCharArray(data), 0, length(data));
+ }
}
- }
+ }
}
break;
@@ -2006,7 +2023,7 @@
#else
static_cast<const XalanElement&>(node),
#endif
- m_pendingAttributes);
+ getPendingAttributesImpl());
copyNamespaceAttributes(node,
false);
@@ -2025,7 +2042,7 @@
static_cast<const XalanCDATASection&>(node);
#endif
- const XalanDOMString data = theCDATA.getData();
+ const XalanDOMString& data = theCDATA.getData();
cdata(toCharArray(data), 0, length(data));
}
@@ -2039,7 +2056,7 @@
#else
static_cast<const XalanAttr&>(node);
#endif
- addResultAttribute(m_pendingAttributes,
+ addResultAttribute(getPendingAttributesImpl(),
m_executionContext->getNameOfNode(attr),
attr.getValue());
}
@@ -2054,7 +2071,7 @@
static_cast<const XalanComment&>(node);
#endif
- const XalanDOMString theData = theComment.getData();
+ const XalanDOMString& theData = theComment.getData();
comment(toCharArray(theData));
}
@@ -2068,7 +2085,7 @@
case XalanNode::ENTITY_REFERENCE_NODE:
{
- const XalanDOMString theName = node.getNodeName();
+ const XalanDOMString & theName = node.getNodeName();
entityReference(toCharArray(theName));
}
break;
@@ -2082,8 +2099,8 @@
static_cast<const XalanProcessingInstruction&>(node);
#endif
- const XalanDOMString theTarget = pi.getTarget();
- const XalanDOMString theData = pi.getData();
+ const XalanDOMString& theTarget = pi.getTarget();
+ const XalanDOMString& theData = pi.getData();
processingInstruction(toCharArray(theTarget),
toCharArray(theData));
@@ -2119,11 +2136,11 @@
pfrag.get(),
0);
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
- StylesheetExecutionContext::ExecutionStateSetAndRestore theStateSaveAndRestore(
+ StylesheetExecutionContext::OutputContextPushPop theOutputContextPushPop(
executionContext,
&tempFormatter);
@@ -2233,7 +2250,7 @@
if(0 == length(elemNS))
{
- error(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
+ error("Prefix must resolve to a namespace: " + prefix);
}
elemLocalName = substring(elementName, indexOfNSSep + 1);
@@ -2278,7 +2295,7 @@
if(0 == elemNS.length())
{
- error(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
+ error("Prefix must resolve to a namespace: " + prefix);
}
elemLocalName = substring(elementName, indexOfNSSep+1);
@@ -2311,60 +2328,6 @@
-XalanDOMString
-XSLTEngineImpl::getPrefixForNamespace(
- const XalanDOMString& theNamespace,
- const XalanElement& namespaceContext) const
-{
- XalanNode::NodeType type;
- const XalanNode* parent = &namespaceContext;
- XalanDOMString prefix;
-
- while (0 != parent && 0 == length(prefix)
- && ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
- || type == XalanNode::ENTITY_REFERENCE_NODE))
- {
- if (type == XalanNode::ELEMENT_NODE)
- {
- const XalanNamedNodeMap* const nnm =
- parent->getAttributes();
- assert(nnm != 0);
-
- const unsigned int theLength = nnm->getLength();
-
- for (unsigned int i = 0; i < theLength; i ++)
- {
- const XalanNode* const attr = nnm->item(i);
- assert(attr != 0);
-
- const XalanDOMString aname = attr->getNodeName();
-
- const bool isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
-
- if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
- {
- const unsigned int index = indexOf(aname, XalanUnicode::charColon);
- assert(index < length(aname));
-
- const XalanDOMString namespaceOfPrefix = attr->getNodeValue();
-
- if((0 != length(namespaceOfPrefix)) &&
- equals(namespaceOfPrefix, theNamespace))
- {
- prefix = isPrefix ? substring(aname, index + 1) : XalanDOMString();
- }
- }
- }
- }
-
- parent = m_xpathSupport.getParentOfNode(*parent);
- }
-
- return prefix;
-}
-
-
-
void
XSLTEngineImpl::copyNamespaceAttributes(
const XalanNode& src,
@@ -2386,19 +2349,24 @@
const unsigned int nAttrs = nnm->getLength();
+ assert(m_outputContextStack.size() > 0);
+
+ AttributeListImpl& thePendingAttributes =
+ getPendingAttributesImpl();
+
for (unsigned int i = 0; i < nAttrs; i++)
{
const XalanNode* const attr = nnm->item(i);
- const XalanDOMString aname = attr->getNodeName();
+ const XalanDOMString& aname = attr->getNodeName();
const bool isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
{
const XalanDOMString prefix = isPrefix ? substring(aname, 6) : XalanDOMString();
- const XalanDOMString desturi = getResultNamespaceForPrefix(prefix);
- XalanDOMString srcURI = attr->getNodeValue();
+ const XalanDOMString& desturi = getResultNamespaceForPrefix(prefix);
+ const XalanDOMString& srcURI = attr->getNodeValue();
/*
@@ JMD: Not used anymore in java ...
const bool isXSLNS =
@@ -2415,7 +2383,7 @@
*/
if(!equalsIgnoreCase(srcURI, desturi))
{
- addResultAttribute(m_pendingAttributes, aname, srcURI);
+ addResultAttribute(thePendingAttributes, aname, srcURI);
}
}
}
@@ -2513,29 +2481,6 @@
-XalanDOMString
-XSLTEngineImpl::getAttrVal(
- const XalanElement& el,
- const XalanDOMString& key,
- const XalanNode& /* contextNode */ )
-{
- return getAttrVal(el, key);
-}
-
-
-
-XalanDOMString
-XSLTEngineImpl::getAttrVal(
- const XalanElement& el,
- const XalanDOMString& key)
-{
- const XalanAttr* const a = el.getAttributeNode(key);
-
- return 0 == a ? XalanDOMString() : a->getValue();
-}
-
-
-
static const XalanDOMChar theTokenDelimiterCharacters[] =
{
XalanUnicode::charLeftCurlyBracket,
@@ -2659,7 +2604,7 @@
case XalanUnicode::charLeftCurlyBracket:
{
// What's another curly doing here?
- error = "Error: Can not have \"{\" within expression.";
+ error = TranscodeFromLocalCodePage("Error: Can not have \"{\" within expression.");
break;
}
case XalanUnicode::charRightCurlyBracket:
@@ -2730,10 +2675,8 @@
if(0 != length(error))
{
- // $$$ ToDo: Fix this when XalanDOMString::operator+() is const.
- XalanDOMString message("Attr Template, ");
+ warn("Attr Template, " + error);
- warn(message + error);
break;
}
} // end while(tokenizer.hasMoreTokens())
@@ -2807,7 +2750,7 @@
const XalanDOMString theTemp(s_XSLNameSpaceURL + ":use");
- if(equalsIgnoreCase(m_parserLiaison.getExpandedAttributeName(*attr), theTemp))
+ if(equals(m_parserLiaison.getExpandedAttributeName(*attr), theTemp))
{
attrSetUseVal = attr->getValue();
}
@@ -2847,7 +2790,8 @@
m_stylesheetRoot->getWhitespaceStrippingElements().size() > 0))
{
const XalanNode::NodeType type = textNode.getNodeType();
- if((XalanNode::TEXT_NODE == type) || (XalanNode::CDATA_SECTION_NODE == type))
+
+ if(XalanNode::TEXT_NODE == type || XalanNode::CDATA_SECTION_NODE == type)
{
const XalanText& theTextNode =
#if defined(XALAN_OLD_STYLE_CASTS)
@@ -2858,13 +2802,13 @@
if(!theTextNode.isIgnorableWhitespace())
{
- const XalanDOMString data = theTextNode.getData();
+ const XalanDOMString& data = theTextNode.getData();
if(0 == length(data))
{
return true;
}
- else if(!isWhitespace(data))
+ else if(!isXMLWhitespace(data))
{
return false;
}
@@ -2962,167 +2906,6 @@
-XalanDOMString
-XSLTEngineImpl::fixWhitespace(
- const XalanDOMString& string,
- bool trimHead,
- bool trimTail,
- bool doublePunctuationSpaces)
-{
- const XalanDOMChar* const theStringData = c_wstr(string);
-
-
- XalanDOMCharVectorType buf(
- theStringData,
- theStringData + length(string));
-
- const unsigned int len = buf.size();
-
- bool edit = false;
-
- unsigned int s;
-
- for(s = 0; s < len; ++s)
- {
- if(isXMLWhitespace(buf[s]) == true)
- {
- break;
- }
- }
-
- /* replace S to ' '. and ' '+ -> single ' '. */
- unsigned int d = s;
-
- bool pres = false;
-
- for ( ; s < len; ++s)
- {
- const XalanDOMChar c = buf[s];
-
- if (isXMLWhitespace(c) == true)
- {
- if (!pres)
- {
- if (XalanUnicode::charSpace != c)
- {
- edit = true;
- }
-
- buf[d++] = XalanUnicode::charSpace;
-
- if(doublePunctuationSpaces == true && (s != 0))
- {
- const XalanDOMChar prevChar = buf[s - 1];
-
- if(!(prevChar == XalanUnicode::charFullStop ||
- prevChar == XalanUnicode::charExclamationMark ||
- prevChar == XalanUnicode::charQuestionMark))
- {
- pres = true;
- }
- }
- else
- {
- pres = true;
- }
- }
- else
- {
- edit = true;
- pres = true;
- }
- }
- else
- {
- buf[d++] = c;
- pres = false;
- }
- }
-
- if (trimTail == true && 1 <= d && XalanUnicode::charSpace == buf[d - 1])
- {
- edit = true;
- d --;
- }
-
- XalanDOMCharVectorType::const_iterator start = buf.begin();
-
- if (trimHead == true && 0 < d && XalanUnicode::charSpace == buf[0])
- {
- edit = true;
- start++;
- }
-
- if (edit == false)
- {
- // If we haven't changed the string, just return a copy of the
- // input string.
- return string;
- }
- else
- {
- // OK, we have to calculate the length of the string,
- // taking into account that we may have moved up the
- // start because we're trimming the from of the string.
- const unsigned int theLength = d - (start - buf.begin());
-
- return XalanDOMString(start, theLength);
- }
-}
-
-
-
-const XalanDOMString
-XSLTEngineImpl::getNormalizedText(const XalanText& tx) const
-{
- if(m_outputCarriageReturns == false && m_outputLinefeeds == false)
- {
- return tx.getData();
- }
-
- const XalanDOMString src = tx.getData();
-
- const int nSrcChars = src.length();
-
- XalanDOMCharVectorType sb;
-
- XalanDOMChar prevChar = 0;
-
- for(int i = 0; i < nSrcChars; i++)
- {
- const XalanDOMChar c = charAt(src, i);
-
- if(0x0A == c)
- {
- if(0x0D != prevChar)
- {
- if(m_outputCarriageReturns == true)
- sb.push_back(0x0D);
- if(m_outputLinefeeds == true)
- sb.push_back(0x0A);
- }
- }
- else if(0x0D == c)
- {
- if(m_outputCarriageReturns == true)
- sb.push_back(0x0D);
- if(m_outputLinefeeds == true)
- sb.push_back(0x0A);
- }
- else
- {
- sb.push_back(c);
- }
- prevChar = c;
- }
-
- sb.push_back(0); // Null terminate
-
- return XalanDOMString(sb.begin(), sb.size());
-}
-
-
-
XMLParserLiaison&
XSLTEngineImpl::getXMLParserLiaison() const
{
@@ -3270,18 +3053,18 @@
for(unsigned int i = 0; i < nAttributes; i++)
{
- const XalanAttr* attr =
+ const XalanAttr* const attr =
#if defined(XALAN_OLD_STYLE_CASTS)
(const XalanAttr*)attributes->item(i);
#else
static_cast<const XalanAttr*>(attributes->item(i));
#endif
- const XalanDOMString attrName = attr->getName();
+ const XalanDOMString& attrName = attr->getName();
if(equals(attrName, targetAttributeName))
{
- const XalanDOMString attrVal = attr->getValue();
+ const XalanDOMString& attrVal = attr->getValue();
if(equals(attrVal, targetAttributeValue))
{
@@ -3311,7 +3094,7 @@
static_cast<XalanElement*>(childNode);
#endif
- const XalanDOMString childName = child->getTagName();
+ const XalanDOMString& childName = child->getTagName();
if(0 != length(childName))
{
@@ -3340,7 +3123,7 @@
FormatterListener*
XSLTEngineImpl::getFormatterListener() const
{
- return m_flistener;
+ return getFormatterListenerImpl();
}
@@ -3348,14 +3131,14 @@
void
XSLTEngineImpl::setFormatterListener(FormatterListener* flistener)
{
- if (m_hasPendingStartDocument == true && m_flistener != 0)
+ if (getHasPendingStartDocument() == true && getFormatterListener() != 0)
{
- m_mustFlushStartDocument = true;
+ setMustFlushPendingStartDocument(true);
flushPending();
}
- m_flistener = flistener;
+ setFormatterListenerImpl(flistener);
}
@@ -3363,15 +3146,15 @@
void
XSLTEngineImpl::installFunctions()
{
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("current"), FunctionCurrent());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("document"), FunctionDocument());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("element-available"), FunctionElementAvailable());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("function-available"), FunctionFunctionAvailable());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("format-number"), FunctionFormatNumber());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("generate-id"), FunctionGenerateID());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("key"), FunctionKey());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("system-property"), FunctionSystemProperty());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri"), FunctionUnparsedEntityURI());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("current")), FunctionCurrent());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("document")), FunctionDocument());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("element-available")), FunctionElementAvailable());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("function-available")), FunctionFunctionAvailable());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("format-number")), FunctionFormatNumber());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("generate-id")), FunctionGenerateID());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("key")), FunctionKey());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("system-property")), FunctionSystemProperty());
+ XPath::installFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri")), FunctionUnparsedEntityURI());
}
@@ -3379,15 +3162,15 @@
void
XSLTEngineImpl::uninstallFunctions()
{
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("current"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("document"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("element-available"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("function-available"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("format-number"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("generate-id"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("key"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("system-property"));
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri"));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("current")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("document")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("element-available")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("function-available")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("format-number")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("generate-id")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("key")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("system-property")));
+ XPath::uninstallFunction(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri")));
}
1.50 +315 -163 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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- XSLTEngineImpl.hpp 2000/10/11 19:43:07 1.49
+++ XSLTEngineImpl.hpp 2000/11/02 01:46:28 1.50
@@ -73,6 +73,7 @@
// Standard library headers
#include <cassert>
#include <ctime>
+#include <deque>
#include <map>
#include <set>
@@ -93,9 +94,12 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <PlatformSupport/AttributeListImpl.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
@@ -149,6 +153,35 @@
{
public:
+ typedef QName::NamespaceVectorType NamespaceVectorType;
+ typedef QName::NamespacesStackType NamespacesStackType;
+
+ struct OutputContext
+ {
+ OutputContext(FormatterListener* theListener = 0) :
+ m_flistener(theListener),
+ m_pendingAttributes(),
+ m_pendingElementName(),
+ m_hasPendingStartDocument(false),
+ m_mustFlushPendingStartDocument(false)
+ {
+ }
+
+ ~OutputContext()
+ {
+ }
+
+ FormatterListener* m_flistener;
+
+ AttributeListImpl m_pendingAttributes;
+
+ XalanDOMString m_pendingElementName;
+
+ bool m_hasPendingStartDocument;
+
+ bool m_mustFlushPendingStartDocument;
+ };
+
#if defined(XALAN_NO_NAMESPACES)
typedef map<XalanDOMString,
int,
@@ -160,19 +193,17 @@
clock_t,
less<const void*> > DurationsTableMapType;
typedef vector<const Locator*> LocatorStack;
- typedef vector<NameSpace> NamespaceVectorType;
- typedef vector<NamespaceVectorType> NamespacesStackType;
typedef vector<TraceListener*> TraceListenerVectorType;
typedef vector<bool> BoolVectorType;
+ typedef deque<OutputContext> OutputContextStackType;
#else
typedef std::map<XalanDOMString, int> AttributeKeysMapType;
typedef std::map<XalanDOMString, int> ElementKeysMapType;
typedef std::map<const void*, clock_t> DurationsTableMapType;
typedef std::vector<const Locator*> LocatorStack;
- typedef std::vector<NameSpace> NamespaceVectorType;
- typedef std::vector<NamespaceVectorType> NamespacesStackType;
typedef std::vector<TraceListener*> TraceListenerVectorType;
typedef std::vector<bool> BoolVectorType;
+ typedef std::deque<OutputContext> OutputContextStackType;
#endif
typedef XalanAutoPtr<XPathProcessor> XPathProcessorPtrType;
@@ -422,7 +453,9 @@
const XalanDOMString& aname,
const XalanDOMString& value)
{
- addResultAttribute(m_pendingAttributes,
+ assert(m_outputContextStack.size() > 0);
+
+ addResultAttribute(getPendingAttributesImpl(),
aname,
value);
}
@@ -710,6 +743,12 @@
const XalanNode* styleNode = 0,
const XalanNode* sourceNode = 0) const;
+ virtual void
+ message(
+ const char* msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
+
/**
* Tell the user of an warning, and probably throw an exception.
*
@@ -725,6 +764,20 @@
const XalanNode* sourceNode = 0) const;
/**
+ * Tell the user of an warning, and probably 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
+ * @exception XSLProcessorException
+ */
+ virtual void
+ warn(
+ const char* msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
+
+ /**
* Tell the user of an error, and probably throw an exception.
*
* @param msg text of message to output
@@ -739,6 +792,20 @@
const XalanNode* sourceNode = 0) const;
/**
+ * Tell the user of an error, and probably 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
+ * @exception XSLProcessorException
+ */
+ virtual void
+ error(
+ const char* msg,
+ const XalanNode* styleNode = 0,
+ const XalanNode* sourceNode = 0) const;
+
+ /**
* Mark the time, so that displayDuration can later display the elapsed
* clock ticks.
*
@@ -766,7 +833,7 @@
void
displayDuration(
const XalanDOMString& info,
- const void* key) const;
+ const void* key) const;
/**
@@ -784,8 +851,16 @@
*/
void
diag(const XalanDOMString& s) const;
-
+
/**
+ * Print a diagnostics string to the output device
+ *
+ * @param s string to print
+ */
+ void
+ diag(const char* s) const;
+
+ /**
* Tell if a given element name should output it's text
* as cdata.
*
@@ -928,32 +1003,6 @@
const XalanDocument& doc) const;
/**
- * Given an element, return an attribute value in the form of a string.
- *
- * @param el element from where to get the attribute
- * @param key name of the attribute
- * @param contextNode context to evaluate the attribute value template
- * @return string for attribute value
- */
- XalanDOMString
- getAttrVal(
- const XalanElement& el,
- const XalanDOMString& key,
- const XalanNode& contextNode);
-
- /**
- * Given an element, return an attribute value in the form of a string.
- *
- * @param el element from where to get the attribute
- * @param key name of the attribute
- * @return string for attribute value
- */
- static XalanDOMString
- getAttrVal(
- const XalanElement& el,
- const XalanDOMString& key);
-
- /**
* Copy an attribute to the created output element, executing attribute
* templates as need be, and processing the 'xsl:use' attribute.
*
@@ -973,87 +1022,6 @@
const XalanElement& namespaceContext);
/**
- * Determine the value of the default-space attribute.
- *
- * @return true if the default-space attribute is "strip," false if
- * the attribute is "preserve"
- */
- bool
- getStripWhiteSpace() const
- {
- return m_stripWhiteSpace;
- }
-
- /**
- * Change the value of the default-space attribute.
- *
- * @param b sets the default of the default-space attribute to "strip" if
- * true, or "preserve" if false.
- */
- void
- setStripWhiteSpace(bool fStrip)
- {
- m_stripWhiteSpace = fStrip;
- }
-
- /**
- * Conditionally trim all leading and trailing whitespace in the specified
- * String. All strings of white space are replaced by a single space
- * character (#x20), except spaces after punctuation which receive double
- * spaces if doublePunctuationSpaces is true. This function may be useful to
- * a formatter, but to get first class results, the formatter should
- * probably do its own white space handling based on the semantics of the
- * formatting object.
- *
- * @param string string to be trimmed
- * @param trimHead whether to trim leading whitespace
- * @param trimTail whether to trim trailing whitespace
- * @param doublePunctuationSpaces true to use double spaces for punctuation
- * @return trimmed string
- */
- XalanDOMString fixWhitespace(
- const XalanDOMString& string,
- bool trimHead,
- bool trimTail,
- bool doublePunctuationSpaces);
-
- /**
- * Control if carriage returns are put in the result tree. Default is to
- * output carriage returns.
- *
- * @param b true to output carriage returns
- */
- void setOutputCarriageReturns(bool b)
- {
- m_outputCarriageReturns = b;
- }
-
- /**
- * Control if linefeeds are put in the result tree. Default is to output
- * linefeeds.
- *
- * @param b true to output linefeeds
- */
- void
- setOutputLinefeeds(bool b)
- {
- m_outputLinefeeds = b;
- }
-
- /**
- * Normalize the linefeeds and/or carriage returns to be consistently 0x0D
- * 0x0A.
- *
- * @param tx DOM text node to normalize
- * @return normalized string
- */
- /* $$$ ToDo: This should almost certainly be done somewhere else... like in the XML
- * parser.
- */
- const XalanDOMString
- getNormalizedText(const XalanText& tx) const;
-
- /**
* Get the factory for making xpaths.
*
* @return XPath factory object
@@ -1133,13 +1101,41 @@
}
/*
+ * Push a new output context using the provided FormatterListener.
+ *
+ * @param A pointer to the FormatterListener instance for the new context.
+ */
+ void
+ pushOutputContext(FormatterListener* theListener)
+ {
+ m_outputContextStack.resize(m_outputContextStack.size() + 1);
+
+ ++m_outputContextStackPosition;
+
+ (*m_outputContextStackPosition).m_flistener = theListener;
+ }
+
+ /*
+ * Pop the current output context.
+ */
+ void
+ popOutputContext()
+ {
+ assert(m_outputContextStack.empty() == false);
+
+ m_outputContextStack.pop_back();
+
+ m_outputContextStackPosition--;
+ }
+
+ /*
* See if there is a pending start document event waiting.
* @return true if there is a start document event waiting.
*/
bool
getHasPendingStartDocument() const
{
- return m_hasPendingStartDocument;
+ return getHasPendingStartDocumentImpl();
}
/*
@@ -1149,7 +1145,7 @@
void
setHasPendingStartDocument(bool b)
{
- m_hasPendingStartDocument = b;
+ setHasPendingStartDocumentImpl(b);
}
/*
@@ -1159,7 +1155,7 @@
bool
getMustFlushPendingStartDocument() const
{
- return m_mustFlushStartDocument;
+ return getMustFlushPendingStartDocumentImpl();
}
/*
@@ -1169,7 +1165,7 @@
void
setMustFlushPendingStartDocument(bool b)
{
- m_hasPendingStartDocument = b;
+ setMustFlushPendingStartDocumentImpl(b);
}
/**
@@ -1181,36 +1177,78 @@
createDocFrag() const;
/**
- * Retrieve list of attributes yet to be processed
+ * Get the list of attributes yet to be processed
*
* @return attribute list
*/
- AttributeListImpl&
- getPendingAttributes();
+ const AttributeList&
+ getPendingAttributes() const
+ {
+ return getPendingAttributesImpl();
+ }
/**
- * Retrieve name of the pending element currently being processed.
+ * Set the list of attributes yet to be processed
*
- * @return element name
+ * @param pendingAttributes The attribute list
*/
- const XalanDOMString
- getPendingElementName() const;
+ void
+ setPendingAttributes(const AttributeList& pendingAttributes)
+ {
+ getPendingAttributesImpl() = pendingAttributes;
+ }
/**
- * Sets a list of attributes yet to be processed.
+ * Replace the contents of a pending attribute.
*
- * @param pendingAttributes attribute list
+ * @param theName name of attribute
+ * @param theNewType type of attribute
+ * @param theNewValue new value of attribute
*/
void
- setPendingAttributes(const AttributeList& pendingAttributes);
+ replacePendingAttribute(
+ const XalanDOMChar* theName,
+ const XalanDOMChar* theNewType,
+ const XalanDOMChar* theNewValue)
+ {
+ // Remove the old attribute, then add the new one. AttributeListImpl::addAttribute()
+ // does this for us.
+ getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
+ }
+
+ bool
+ isElementPending() const
+ {
+ return length(getPendingElementNameImpl()) != 0 ? true : false;
+ }
+
+ /**
+ * Retrieve name of the pending element currently being processed.
+ *
+ * @return element name
+ */
+ const XalanDOMString&
+ getPendingElementName() const
+ {
+ return getPendingElementNameImpl();
+ }
/**
* Changes the currently pending element name.
*
* @param elementName new name of element
*/
+ void
+ setPendingElementName(const XalanDOMString& elementName)
+ {
+ setPendingElementNameImpl(elementName);
+ }
+
void
- setPendingElementName(const XalanDOMString& elementName);
+ setPendingElementName(const XalanDOMChar* elementName)
+ {
+ setPendingElementNameImpl(elementName);
+ }
/**
* Get the locator from the top of the locator stack.
@@ -1286,6 +1324,137 @@
protected:
/**
+ * Get the list of attributes yet to be processed
+ *
+ * @return attribute list
+ */
+ const AttributeListImpl&
+ getPendingAttributesImpl() const
+ {
+ return (*m_outputContextStackPosition).m_pendingAttributes;
+ }
+
+ /**
+ * Get the list of attributes yet to be processed
+ *
+ * @return attribute list
+ */
+ AttributeListImpl&
+ getPendingAttributesImpl()
+ {
+ return (*m_outputContextStackPosition).m_pendingAttributes;
+ }
+
+ /**
+ * Set the list of attributes yet to be processed
+ *
+ * @param pendingAttributes The attribute list
+ */
+ void
+ setPendingAttributesImpl(const AttributeList& pendingAttributes)
+ {
+ getPendingAttributesImpl() = pendingAttributes;
+ }
+
+ /**
+ * Retrieve name of the pending element currently being processed.
+ *
+ * @return element name
+ */
+ const XalanDOMString&
+ getPendingElementNameImpl() const
+ {
+ return (*m_outputContextStackPosition).m_pendingElementName;
+ }
+
+ /**
+ * Retrieve name of the pending element currently being processed.
+ *
+ * @return element name
+ */
+ XalanDOMString&
+ getPendingElementNameImpl()
+ {
+ return (*m_outputContextStackPosition).m_pendingElementName;
+ }
+
+ /**
+ * Changes the currently pending element name.
+ *
+ * @param elementName new name of element
+ */
+ void
+ setPendingElementNameImpl(const XalanDOMString& elementName)
+ {
+ (*m_outputContextStackPosition).m_pendingElementName = elementName;
+ }
+
+ /**
+ * Changes the currently pending element name.
+ *
+ * @param elementName new name of element
+ */
+ void
+ setPendingElementNameImpl(const XalanDOMChar* elementName)
+ {
+ assert(elementName != 0);
+
+ (*m_outputContextStackPosition).m_pendingElementName = elementName;
+ }
+
+ /*
+ * See if there is a pending start document event waiting.
+ * @return true if there is a start document event waiting.
+ */
+ bool
+ getHasPendingStartDocumentImpl() const
+ {
+ return (*m_outputContextStackPosition).m_hasPendingStartDocument;
+ }
+
+ /*
+ * Set the pending start document event state.
+ * @param the new value
+ */
+ void
+ setHasPendingStartDocumentImpl(bool b)
+ {
+ (*m_outputContextStackPosition).m_hasPendingStartDocument = b;
+ }
+
+ /*
+ * See if a pending start document event must be flushed.
+ * @return true if the event must be flushed.
+ */
+ bool
+ getMustFlushPendingStartDocumentImpl() const
+ {
+ return (*m_outputContextStackPosition).m_mustFlushPendingStartDocument;
+ }
+
+ /*
+ * Set the pending start document event flush state.
+ * @param the new value
+ */
+ void
+ setMustFlushPendingStartDocumentImpl(bool b)
+ {
+ (*m_outputContextStackPosition).m_mustFlushPendingStartDocument = b;
+ }
+
+ FormatterListener*
+ getFormatterListenerImpl() const
+ {
+ return (*m_outputContextStackPosition).m_flistener;
+ }
+
+ void
+ setFormatterListenerImpl(FormatterListener* flistener)
+ {
+ (*m_outputContextStackPosition).m_flistener = flistener;
+ }
+
+ /**
* If true, output carriage returns.
*/
bool m_outputCarriageReturns;
@@ -1353,27 +1522,27 @@
* can call startElement.
*/
- XalanDOMString m_pendingElementName;
+// XalanDOMString m_pendingElementName;
/**
- * The pending attributes. We have to delay the call to
- * m_flistener.startElement(name, atts) because of the
+ * The stack of pending attribute lists. We have to
+ * delay the output of the current element because of the
* xsl:attribute and xsl:copy calls. In other words,
* the attributes have to be fully collected before you
* can call startElement.
*/
- AttributeListImpl m_pendingAttributes;
+// AttributeListImpl m_pendingAttributes;
/*
* true if a startDocument() event has been fired, but we
* haven't yet calld startDocument() on our formatter.
*/
- bool m_hasPendingStartDocument;
+// bool m_hasPendingStartDocument;
/*
* true if a pending startDocument() must be flushed.
*/
- bool m_mustFlushStartDocument;
+// bool m_mustFlushPendingStartDocument;
/**
* NOTE: This replaces the ResultNameSpace class in java, since it is the
@@ -1518,14 +1687,6 @@
mutable unsigned long m_uniqueNSValue; // 0
/**
- * This should probably be in the XMLParserLiaison interface.
- */
- XalanDOMString
- getPrefixForNamespace(
- const XalanDOMString& theNamespace,
- const XalanElement& namespaceContext) const;
-
- /**
* Translate CSS attributes and put them in a style tag.
* @deprecated
*/
@@ -1555,13 +1716,6 @@
XLocator* xlocator);
/**
- * If this is true, the processor will do the best it can to strip
- * unwanted white space. This is set in the stylesheet via the default-space
- * attribute on xsl:stylesheet.
- */
- bool m_stripWhiteSpace; // default default-space="preserve"
-
- /**
* Control if the xsl:variable is resolved early or
* late. Resolving the xsl:variable
* early is a drag because it means that the fragment
@@ -1612,11 +1766,8 @@
return m_currentNode;
}
- /**
- * The liason to the XML parser, so the XSL processor
- * can handle included files, and the like, and do the
- * initial parse of the XSL document.
- */
+private:
+
XMLParserLiaison& m_parserLiaison;
XPathSupport& m_xpathSupport;
@@ -1629,19 +1780,20 @@
* The listener for formatting events. This should be
* supplied by the Formatter object.
*/
- FormatterListener* m_flistener;
+// FormatterListener* m_flistener;
/**
- * This holds the current context node list. This should arguably be
- * passed by parameter.
- */
- MutableNodeRefList m_contextNodeList;
-
- /**
* Current execution context...
*/
StylesheetExecutionContext* m_executionContext;
+
+ /*
+ * Stack of current output contexts...
+ */
+ OutputContextStackType m_outputContextStack;
+
+ OutputContextStackType::iterator m_outputContextStackPosition;
static void
installFunctions();
1.17 +4 -3 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp
Index: XSLTProcessorEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XSLTProcessorEnvSupportDefault.cpp 2000/08/14 22:08:09 1.16
+++ XSLTProcessorEnvSupportDefault.cpp 2000/11/02 01:46:28 1.17
@@ -178,10 +178,11 @@
// $$$ ToDo: we should re-work this code to only use
// XMLRUL when necessary.
- URLAutoPtrType xslURL =
+ const URLAutoPtrType xslURL =
URISupport::getURLFromString(urlString, base);
- const XMLCh* const urlText = xslURL->getURLText();
+ // $$$ ToDo: Explicit XalanDOMString constructor
+ const XalanDOMString urlText(XalanDOMString(xslURL->getURLText()));
// First see if it's already been parsed...
XalanDocument* theDocument =
@@ -192,7 +193,7 @@
XMLParserLiaison& parserLiaison =
m_processor->getXMLParserLiaison();
- XSLTInputSource inputSource(urlText);
+ XSLTInputSource inputSource(c_wstr(urlText));
theDocument = parserLiaison.parseXMLStream(inputSource);
1.3 +2 -2 xml-xalan/c/src/XSLT/XSLTProcessorException.cpp
Index: XSLTProcessorException.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorException.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTProcessorException.cpp 2000/05/24 19:38:50 1.2
+++ XSLTProcessorException.cpp 2000/11/02 01:46:28 1.3
@@ -64,8 +64,8 @@
XSLTProcessorException::XSLTProcessorException(
- const DOMString& theMessage,
- const DOMString& theType) :
+ const XalanDOMString& theMessage,
+ const XalanDOMString& theType) :
XSLException(theMessage, theType)
{
}
1.4 +2 -2 xml-xalan/c/src/XSLT/XSLTProcessorException.hpp
Index: XSLTProcessorException.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorException.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSLTProcessorException.hpp 2000/04/11 15:09:31 1.3
+++ XSLTProcessorException.hpp 2000/11/02 01:46:28 1.4
@@ -81,8 +81,8 @@
* "XSLTProcessorException"
*/
XSLTProcessorException(
- const DOMString& theMessage,
- const DOMString& theType = XalanDOMString(XALAN_STATIC_UCODE_STRING("XSLTProcessorException")));
+ const XalanDOMString& theMessage,
+ const XalanDOMString& theType = XalanDOMString(XALAN_STATIC_UCODE_STRING("XSLTProcessorException")));
virtual
~XSLTProcessorException();
1.8 +1 -1 xml-xalan/c/src/XSLT/XalanTemplate.cpp
Index: XalanTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanTemplate.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XalanTemplate.cpp 2000/10/17 13:28:54 1.7
+++ XalanTemplate.cpp 2000/11/02 01:46:28 1.8
@@ -168,7 +168,7 @@
static numeric_limits<double> theDoubleLimits;
static string theString;
-static vector<DOMString> theDOMStringVector;
+static vector<XalanDOMString> theDOMStringVector;
static vector<char> theCharVector;
static vector<unsigned char> theUnsignedCharVector;
static AttributeListImpl::AttributeVectorType theAttributeVectorEntryVector;
1.4 +7 -16 xml-xalan/c/src/XalanDOM/XalanAttr.hpp
Index: XalanAttr.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanAttr.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanAttr.hpp 2000/08/10 18:27:03 1.3
+++ XalanAttr.hpp 2000/11/02 01:46:40 1.4
@@ -87,13 +87,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -367,14 +367,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -384,7 +384,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -436,15 +436,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanAttr...
@@ -455,7 +446,7 @@
* Returns the name of this attribute.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getName() const = 0;
/**
@@ -474,7 +465,7 @@
* The value of the attribute is returned as a string.
* Character and general entity references are replaced with their values.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getValue() const = 0;
//@}
1.3 +6 -15 xml-xalan/c/src/XalanDOM/XalanCDATASection.hpp
Index: XalanCDATASection.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanCDATASection.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanCDATASection.hpp 2000/08/10 18:27:04 1.2
+++ XalanCDATASection.hpp 2000/11/02 01:46:40 1.3
@@ -82,13 +82,13 @@
~XalanCDATASection();
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -362,14 +362,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -379,7 +379,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -431,15 +431,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are inherited from XalanCharacterData...
@@ -462,7 +453,7 @@
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const = 0;
/**
1.4 +6 -15 xml-xalan/c/src/XalanDOM/XalanCharacterData.hpp
Index: XalanCharacterData.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanCharacterData.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanCharacterData.hpp 2000/08/10 18:27:04 1.3
+++ XalanCharacterData.hpp 2000/11/02 01:46:40 1.4
@@ -82,13 +82,13 @@
~XalanCharacterData();
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -361,14 +361,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -378,7 +378,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -430,15 +430,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanCharacterData...
@@ -461,7 +452,7 @@
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const = 0;
/**
1.4 +6 -15 xml-xalan/c/src/XalanDOM/XalanComment.hpp
Index: XalanComment.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanComment.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanComment.hpp 2000/08/10 18:27:04 1.3
+++ XalanComment.hpp 2000/11/02 01:46:40 1.4
@@ -82,13 +82,13 @@
~XalanComment();
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -362,14 +362,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -379,7 +379,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -431,15 +431,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are inherited from XalanCharacterData...
@@ -462,7 +453,7 @@
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const = 0;
/**
1.3 +754 -13 xml-xalan/c/src/XalanDOM/XalanDOMString.hpp
Index: XalanDOMString.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDOMString.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanDOMString.hpp 2000/04/20 16:43:03 1.2
+++ XalanDOMString.hpp 2000/11/02 01:46:40 1.3
@@ -63,38 +63,779 @@
-#if defined(XALAN_USE_STD_STRING)
+#include <vector>
+
+
+
+#if defined(XALAN_USE_XERCES_DOMSTRING)
+
+#include <dom/DOMString.hpp>
+typedef XMLCh XalanDOMChar;
+typedef DOMString XalanDOMString;
+
+#elif defined(XALAN_USE_STD_STRING)
+
#include <string>
+
+#include <util/XercesDefs.hpp>
+
+typedef XMLCh XalanDOMChar;
+typedef std::basic_string<XalanDOMChar> XalanDOMString;
+
+#else
+
+
+
+#define XALAN_USE_CUSTOM_STRING
+
+
+
+#include <cassert>
+
+
+
+#include <util/XercesDefs.hpp>
-typedef unsigned short XalanDOMChar;
+
+typedef XMLCh XalanDOMChar;
+
+
+
+class XALAN_DOM_EXPORT XalanDOMString
+{
+public:
+
#if defined(XALAN_NO_NAMESPACES)
-typedef basic_string<XalanDOMChar> XalanDOMString;
+ typedef vector<XalanDOMChar> XalanDOMCharVectorType;
+ typedef vector<char> CharVectorType;
+ typedef vector<wchar_t> WideCharVectorType;
#else
-typedef std::basic_string<XalanDOMChar> XalanDOMString;
+ typedef std::vector<XalanDOMChar> XalanDOMCharVectorType;
+ typedef std::vector<char> CharVectorType;
+ typedef std::vector<wchar_t> WideCharVectorType;
#endif
-#elif defined(XALAN_USE_VECTOR_FOR_STRING)
+ typedef XalanDOMChar& reference;
+ typedef const XalanDOMChar& const_reference;
-#include <vector>
+ typedef XalanDOMCharVectorType::size_type size_type;
+
+ typedef XalanDOMCharVectorType::iterator iterator;
+ typedef XalanDOMCharVectorType::const_iterator const_iterator;
+ typedef XalanDOMCharVectorType::reverse_iterator reverse_iterator;
+ typedef XalanDOMCharVectorType::const_reverse_iterator const_reverse_iterator;
+
+ enum { npos = -1 };
+
+ explicit
+ XalanDOMString();
+
+ explicit
+ XalanDOMString(
+ const char* theString,
+ size_type theCount = size_type(npos));
+
+ XalanDOMString(
+ const XalanDOMString& theSource,
+ size_type theStartPosition = 0,
+ size_type theCount = size_type(npos));
+
+ explicit
+ XalanDOMString(
+ const XalanDOMChar* theString,
+ size_type theCount = size_type(npos));
+
+ XalanDOMString(
+ size_type theCount,
+ XalanDOMChar theChar);
+
+ ~XalanDOMString()
+ {
+ }
+
+ XalanDOMString&
+ operator=(const XalanDOMString& theRHS)
+ {
+ if (&theRHS != this)
+ {
+ m_data = theRHS.m_data;
+ }
+
+ return *this;
+ }
+
+ XalanDOMString&
+ operator=(const XalanDOMChar* theRHS);
+
+ XalanDOMString&
+ operator=(XalanDOMChar theRHS)
+ {
+ m_data.resize(2);
+
+ m_data[0] = theRHS;
+ m_data[1] = XalanDOMChar(0);
+
+ return *this;
+ }
+
+ iterator
+ begin()
+ {
+ return m_data.begin();
+ }
+
+ const_iterator
+ begin() const
+ {
+ return m_data.begin();
+ }
+
+ reverse_iterator
+ rbegin()
+ {
+ return m_data.rbegin();
+ }
+
+ const_reverse_iterator
+ rbegin() const
+ {
+ return m_data.rbegin();
+ }
+
+ size_type
+ size() const
+ {
+ return m_data.empty() == true ? 0 : m_data.size() - 1;
+ }
+
+ size_type
+ length() const
+ {
+ return size();
+ }
+
+ size_type
+ max_size() const
+ {
+ return size_type(~0);
+ }
+
+ void
+ resize(
+ size_type theCount,
+ XalanDOMChar theChar)
+ {
+ m_data.resize(theCount + 1, theChar);
+
+ m_data.back() = 0;
+ }
+
+ void
+ resize(size_type theCount)
+ {
+ resize(theCount, XalanDOMChar(0));
+ }
+
+ size_type
+ capacity() const
+ {
+ return m_data.capacity() - 1;
+ }
+
+ void
+ reserve(size_type theCount = 0)
+ {
+ m_data.reserve(theCount + 1);
+ }
+
+ void
+ clear()
+ {
+ XalanDOMCharVectorType().swap(m_data);
+ }
+
+ void
+ erase(
+ size_type theStartPosition = 0,
+ size_type theCount = size_type(npos))
+ {
+ const iterator i = getIteratorForPosition(theStartPosition);
+
+ m_data.erase(i, i + (theCount == size_type(npos) ? length() : theCount));
+ }
+
+ bool
+ empty() const
+ {
+ return m_data.size() < 2 ? true : false;
+ }
+
+ const_reference
+ operator[](size_type theIndex) const
+ {
+ return m_data[theIndex];
+ }
+
+ reference
+ operator[](size_type theIndex)
+ {
+ return m_data[theIndex];
+ }
+
+#if 0
+ // $$$ ToDo: at() is not supported in the current version of GCC's vector<>
+ // implementation. Eventually, it should be.
+ const_reference
+ at(size_type theIndex) const
+ {
+ return m_data.at(theIndex);
+ }
+
+ reference
+ at(size_type theIndex)
+ {
+ return m_data.at(theIndex);
+ }
+#endif
-typedef unsigned short XalanDOMChar;
+ const XalanDOMChar*
+ c_str() const
+ {
+ // $$$ ToDo: Do we really want to do this?
+ // for convenience, we will return a pointer to
+ // a default empty string so that c_str() never
+ // returns a null pointer...
+ return m_data.size() == 0 ? &s_empty : &m_data[0];
+ }
+
+ const XalanDOMChar*
+ data() const
+ {
+ return c_str();
+ }
+
+ void
+ swap(XalanDOMString& theOther)
+ {
+ m_data.swap(theOther.m_data);
+ }
+
+ XalanDOMString&
+ operator+=(const XalanDOMString& theSource)
+ {
+ return append(theSource);
+ }
+
+ XalanDOMString&
+ operator+=(const XalanDOMChar* theString)
+ {
+ return append(theString);
+ }
+
+ XalanDOMString&
+ operator+=(XalanDOMChar theChar)
+ {
+ append(1, theChar);
+
+ return *this;
+ }
+
+ XalanDOMString&
+ append(const XalanDOMString& theSource)
+ {
+ return append(theSource.c_str(), theSource.length());
+ }
+
+ XalanDOMString&
+ append(
+ const XalanDOMString& theSource,
+ size_type thePosition,
+ size_type theCount)
+ {
+ return append(theSource.c_str() + thePosition, theCount);
+ }
+
+ XalanDOMString&
+ append(
+ const XalanDOMChar* theString,
+ size_type theCount);
+
+ XalanDOMString&
+ append(const XalanDOMChar* theString)
+ {
+ assert(theString != 0);
+
+ return append(theString, length(theString));
+ }
+
+ XalanDOMString&
+ append(
+ size_type theCount,
+ XalanDOMChar theChar);
+
+ void
+ push_back(XalanDOMChar theChar)
+ {
+ append(1, theChar);
+ }
+
+ XalanDOMString&
+ insert(
+ size_type thePosition,
+ const XalanDOMString& theString)
+ {
+ return insert(thePosition, theString.c_str(), theString.length());
+ }
+
+ XalanDOMString&
+ insert(
+ size_type thePosition1,
+ const XalanDOMString& theString,
+ size_type thePosition2,
+ size_type theCount)
+ {
+ return insert(thePosition1, theString.c_str() + thePosition2, theCount);
+ }
+
+ XalanDOMString&
+ insert(
+ size_type thePosition,
+ const XalanDOMChar* theString,
+ size_type theCount);
+
+ XalanDOMString&
+ insert(
+ size_type thePosition,
+ const XalanDOMChar* theString)
+ {
+ return insert(thePosition, theString, length(theString));
+ }
+
+ XalanDOMString&
+ insert(
+ size_type thePosition,
+ size_type theCount,
+ XalanDOMChar theChar);
+
+ iterator
+ insert(
+ iterator thePosition,
+ XalanDOMChar theChar);
+
+ void
+ insert(
+ iterator thePosition,
+ size_type theCount,
+ XalanDOMChar theChar);
+
+ void
+ insert(
+ iterator theInsertPosition,
+ const_iterator theFirstPosition,
+ const_iterator theLastPosition);
+
+ XalanDOMString
+ substr(
+ size_type thePosition = 0,
+ size_type theCount = size_type(npos)) const
+ {
+ assert(theCount == size_type(npos) && thePosition < length() ||
+ thePosition + theCount <= length());
+
+ return XalanDOMString(*this, thePosition, theCount);
+ }
+
+ int
+ compare(const XalanDOMString& theString) const
+ {
+ return compare(theString.c_str());
+ }
+
+ int
+ compare(
+ size_type thePosition1,
+ size_type theCount1,
+ const XalanDOMString& theString) const
+ {
+ return compare(thePosition1, theCount1, theString.c_str(), theString.length());
+ }
+
+ int
+ compare(
+ size_type thePosition1,
+ size_type theCount1,
+ const XalanDOMString& theString,
+ size_type thePosition2,
+ size_type theCount2) const
+ {
+ return compare(thePosition1, theCount1, theString.c_str() + thePosition2, theCount2);
+ }
+
+ int
+ compare(const XalanDOMChar* theString) const;
+
+ int
+ compare(
+ size_type thePosition1,
+ size_type theCount1,
+ const XalanDOMChar* theString,
+ size_type theCount2 = size_type(npos)) const;
+
+ int
+ compare(const char* theString) const
+ {
+ return compare(XalanDOMString(theString));
+ }
+
+ int
+ compare(
+ size_type thePosition1,
+ size_type theCount1,
+ const char* theString,
+ size_type theCount2 = size_type(npos)) const
+ {
+ return compare(thePosition1, theCount1, XalanDOMString(theString, theCount2));
+ }
+
+ CharVectorType
+ transcode() const;
+
+protected:
+
+ /*
+ * Helper function to determine the length of a null-
+ * terminated string.
+ *
+ * @theString The string
+ * @return the length
+ */
+ static size_type
+ length(const XalanDOMChar* theString);
+
+ /*
+ * Get an iterator to the position of the terminating null.
+ *
+ * @return the iterator
+ */
+ iterator
+ getBackInsertIterator()
+ {
+ return m_data.size() == 0 ? m_data.end() : m_data.end() - 1;
+ }
+
+ const_iterator
+ getBackInsertIterator() const
+ {
+ return m_data.size() == 0 ? m_data.end() : m_data.end() - 1;
+ }
+
+ iterator
+ getIteratorForPosition(size_type thePosition)
+ {
+ return m_data.begin() + thePosition;
+ }
+
+ const_iterator
+ getIteratorForPosition(size_type thePosition) const
+ {
+ return m_data.begin() + thePosition;
+ }
+
+private:
+
+ XalanDOMCharVectorType m_data;
+
+ static const XalanDOMChar s_empty;
+};
+
+
+
+inline bool
+operator==(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ return theLHS.compare(theRHS) == 0 ? true : false;
+}
+
+
+
+inline bool
+operator==(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return theLHS.compare(theRHS) == 0 ? true : false;
+}
+
+
+
+inline bool
+operator==(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ // Note reversing of operands...
+ return theRHS.compare(theLHS) == 0 ? true : false;
+}
+
+
+
+inline bool
+operator!=(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ return !(theLHS == theRHS);
+}
+
+
+
+inline bool
+operator!=(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ return !(theLHS == theRHS);
+}
+
+
+
+inline bool
+operator!=(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ return !(theRHS == theLHS);
+}
+
+
+
+inline XalanDOMString
+operator+(
+ const XalanDOMString& theLHS,
+ const XalanDOMString& theRHS)
+{
+ XalanDOMString theTemp(theLHS);
+
+ return theTemp += theRHS;
+}
+
+
+
+inline XalanDOMString
+operator+(
+ const XalanDOMString& theLHS,
+ const XalanDOMChar* theRHS)
+{
+ XalanDOMString theTemp(theLHS);
+
+ return theTemp += theRHS;
+}
+
+
+
+inline XalanDOMString
+operator+(
+ const XalanDOMChar* theLHS,
+ const XalanDOMString& theRHS)
+{
+ XalanDOMString theTemp(theLHS);
+
+ return theTemp += theRHS;
+}
+
+
+
+inline const XalanDOMString
+operator+(
+ const char* theLHS,
+ const XalanDOMString& theRHS)
+{
+ return XalanDOMString(theLHS) + theRHS;
+}
+
+
+
+inline const XalanDOMString
+operator+(
+ const XalanDOMString& theLHS,
+ const char* theRHS)
+{
+ return theLHS + XalanDOMString(theRHS);
+}
+
+
+#endif
+
+
+// Standard vector of XalanDOMChars and chars
#if defined(XALAN_NO_NAMESPACES)
-typedef vector<XalanDOMChar> XalanDOMString;
+typedef vector<XalanDOMChar> XalanDOMCharVectorType;
+
+typedef vector<char> CharVectorType;
#else
-typedef std::vector<XalanDOMChar> XalanDOMString;
+typedef std::vector<XalanDOMChar> XalanDOMCharVectorType;
+
+typedef std::vector<char> CharVectorType;
#endif
+
+
+/**
+ * Convert a XalanDOMChar string to C++ standard library
+ * vector, transcoding to the default local code
+ * page.
+ *
+ * @param sourceString The source string
+ * @param sourceStringLength The source string length.
+ * @param targetVector The target string
+ * @param terminate If true, the transcoded string will be null-terminated
+ * @return true if successful, false if not.
+ */
+XALAN_DOM_EXPORT_FUNCTION(bool)
+TranscodeToLocalCodePage(
+ const XalanDOMChar* theSourceString,
+ unsigned int theSourceStringLength,
+ CharVectorType& targetVector,
+ bool terminate = false);
+
+
+
+/**
+ * Convert a XalanDOMChar string to C++ standard library
+ * vector, transcoding to the default local code
+ * page. The string _must_ be null-terminated.
+ *
+ * @param theSourceString The source string
+ * @param targetVector The target string
+ * @param terminate If true, the transcoded string will be null-terminated
+ * @return true if successful, false if not.
+ */
+XALAN_DOM_EXPORT_FUNCTION(bool)
+TranscodeToLocalCodePage(
+ const XalanDOMChar* theSourceString,
+ CharVectorType& targetVector,
+ bool terminate = false);
+
+
+
+/**
+ * Convert XalanDOMString to C++ standard library
+ * vector, transcoding to the default local code
+ * page. Null-terminate the sttring...
+ *
+ * @param theSourceString source string
+ * @return The transcoded string.
+ */
+inline const CharVectorType
+TranscodeToLocalCodePage(const XalanDOMChar* theSourceString)
+{
+ CharVectorType theResult;
+
+ TranscodeToLocalCodePage(theSourceString, theResult, true);
+
+ return theResult;
+}
+
+
+
+/**
+ * Convert XalanDOMString to C++ standard library
+ * vector, transcoding to the default local code
+ * page.
+ *
+ * @param theSourceString The source string
+ * @param targetVector The target string
+ * @return true if successful, false if not.
+ */
+inline bool
+TranscodeToLocalCodePage(
+ const XalanDOMString& theSourceString,
+ CharVectorType& targetVector,
+ bool terminate = false)
+{
+#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
+ return TranscodeToLocalCodePage(theSourceString.c_str(), targetVector, terminate);
#else
+ return TranscodeToLocalCodePage(theSourceString.rawBuffer(), theSourceString.length(), targetVector, terminate);
+#endif
+}
-#include <dom/DOMString.hpp>
-typedef XMLCh XalanDOMChar;
-typedef DOMString XalanDOMString;
-#endif
+/**
+ * Convert XalanDOMString to C++ standard library
+ * vector, transcoding to the default local code
+ * page.
+ *
+ * @param thetheSourceString source string
+ * @return The transcoded string.
+ */
+inline const CharVectorType
+TranscodeToLocalCodePage(const XalanDOMString& theSourceString)
+{
+ CharVectorType theResult;
+
+ TranscodeToLocalCodePage(theSourceString, theResult, true);
+
+ return theResult;
+}
+
+
+
+/**
+ * Convert a string to a C++ standard library
+ * vector, transcoding from the default local code
+ * page.
+ *
+ * @param theSourceString The source string
+ * @param theSourceStringLength The source string length.
+ * @param targetVector The target string
+ * @param terminate If true, the transcoded string will be null-terminated
+ * @return true if successful, false if not.
+ */
+XALAN_DOM_EXPORT_FUNCTION(bool)
+TranscodeFromLocalCodePage(
+ const char* theSourceString,
+ unsigned int theSourceStringLength,
+ XalanDOMCharVectorType& theTargetVector,
+ bool terminate = false);
+
+
+
+/**
+ * Convert a string to a C++ standard library
+ * vector, transcoding from the default local code
+ * page. The string _must_ be null-terminated.
+ *
+ * @param sourceString The source string
+ * @param targetVector The target string
+ * @param terminate If true, the transcoded string will be null-terminated
+ * @return true if successful, false if not.
+ */
+XALAN_DOM_EXPORT_FUNCTION(bool)
+TranscodeFromLocalCodePage(
+ const char* theSourceString,
+ XalanDOMCharVectorType& theTargetVector,
+ bool terminate = false);
+
+
+
+/**
+ * Convert XalanDOMString to C++ standard library
+ * vector, transcoding to the default local code
+ * page.
+ *
+ * @param theSourceString source string
+ * @return The transcoded string.
+ */
+XALAN_DOM_EXPORT_FUNCTION(const XalanDOMString)
+TranscodeFromLocalCodePage(const char* sourceString);
+
#endif // !defined(XALANDOMSTRING_HEADER_GUARD_1357924680)
1.4 +5 -14 xml-xalan/c/src/XalanDOM/XalanDocument.hpp
Index: XalanDocument.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDocument.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDocument.hpp 2000/08/10 18:27:04 1.3
+++ XalanDocument.hpp 2000/11/02 01:46:40 1.4
@@ -96,13 +96,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -376,14 +376,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -393,7 +393,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -444,15 +444,6 @@
*/
virtual unsigned long
getIndex() const = 0;
-
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
//@}
1.4 +5 -8 xml-xalan/c/src/XalanDOM/XalanDocumentFragment.hpp
Index: XalanDocumentFragment.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDocumentFragment.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDocumentFragment.hpp 2000/08/10 18:27:04 1.3
+++ XalanDocumentFragment.hpp 2000/11/02 01:46:40 1.4
@@ -94,10 +94,10 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
virtual NodeType
@@ -164,13 +164,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
virtual void
@@ -181,9 +181,6 @@
virtual unsigned long
getIndex() const = 0;
-
- virtual XalanDOMString
- getXSLTData() const = 0;
protected:
1.4 +9 -18 xml-xalan/c/src/XalanDOM/XalanDocumentType.hpp
Index: XalanDocumentType.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDocumentType.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDocumentType.hpp 2000/08/10 18:27:04 1.3
+++ XalanDocumentType.hpp 2000/11/02 01:46:40 1.4
@@ -93,13 +93,13 @@
/**
* Gets the name of this node.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -369,14 +369,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -386,7 +386,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -438,15 +438,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanDocumentType...
@@ -458,7 +449,7 @@
* The name of DTD; i.e., the name immediately following the
* <code>DOCTYPE</code> keyword in an XML source document.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getName() const = 0;
/**
@@ -483,21 +474,21 @@
* Get the public identifier of the external subset.
* @return The public identifier of the external subset.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const = 0;
/**
* Get the system identifier of the external subset.
* @return The system identifier of the external subset.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const = 0;
/**
* Get the internal subset as a string.
* @return The internal subset as a string.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getInternalSubset() const = 0;
//@}
1.4 +8 -17 xml-xalan/c/src/XalanDOM/XalanElement.hpp
Index: XalanElement.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanElement.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanElement.hpp 2000/08/10 18:27:04 1.3
+++ XalanElement.hpp 2000/11/02 01:46:40 1.4
@@ -86,13 +86,13 @@
~XalanElement();
// These interfaces are inherited from XalanNode
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -366,14 +366,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -383,7 +383,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -435,15 +435,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanElement...
@@ -455,7 +446,7 @@
* the value <code>"elementExample"</code>. Note that this is
* case-preserving in XML, as are all of the operations of the DOM.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getTagName() const = 0;
/**
@@ -465,7 +456,7 @@
* @return The <code>Attr</code> value as a string, or the empty string if
* that attribute does not have a specified or default value.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttribute(const XalanDOMString& name) const = 0;
/**
@@ -594,7 +585,7 @@
* @return The <code>Attr</code> value as a string, or an empty string if
* that attribute does not have a specified or default value.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const = 0;
1.4 +8 -17 xml-xalan/c/src/XalanDOM/XalanEntity.hpp
Index: XalanEntity.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanEntity.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanEntity.hpp 2000/08/10 18:27:04 1.3
+++ XalanEntity.hpp 2000/11/02 01:46:40 1.4
@@ -84,13 +84,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -360,14 +360,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -377,7 +377,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -429,15 +429,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanEntity...
@@ -449,7 +440,7 @@
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const = 0;
/**
@@ -459,7 +450,7 @@
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const = 0;
/**
@@ -467,7 +458,7 @@
*
* For parsed entities, this is <code>null</code>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNotationName() const = 0;
protected:
1.4 +5 -14 xml-xalan/c/src/XalanDOM/XalanEntityReference.hpp
Index: XalanEntityReference.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanEntityReference.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanEntityReference.hpp 2000/08/10 18:27:05 1.3
+++ XalanEntityReference.hpp 2000/11/02 01:46:40 1.4
@@ -83,13 +83,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -359,14 +359,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -376,7 +376,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -427,15 +427,6 @@
*/
virtual unsigned long
getIndex() const = 0;
-
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
//@}
1.4 +1 -1 xml-xalan/c/src/XalanDOM/XalanNode.cpp
Index: XalanNode.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanNode.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanNode.cpp 2000/08/15 19:42:24 1.3
+++ XalanNode.cpp 2000/11/02 01:46:41 1.4
@@ -59,7 +59,7 @@
#if !defined(NDEBUG)
-unsigned long XalanNode::s_instanceCount = 0;
+size_t XalanNode::s_instanceCount = 0;
#if defined(XALAN_NODE_SPECIAL_DEBUG)
1.4 +7 -16 xml-xalan/c/src/XalanDOM/XalanNode.hpp
Index: XalanNode.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanNode.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanNode.hpp 2000/08/10 18:27:05 1.3
+++ XalanNode.hpp 2000/11/02 01:46:41 1.4
@@ -104,13 +104,13 @@
NOTATION_NODE = 12
};
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -380,14 +380,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -397,7 +397,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -449,15 +449,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
@@ -467,7 +458,7 @@
* Get the number of live instances.
* @return the number of live instances.
*/
- static unsigned long
+ static size_t
getInstanceCount()
{
return s_instanceCount;
@@ -501,7 +492,7 @@
private:
#if !defined(NDEBUG)
- static unsigned long s_instanceCount;
+ static size_t s_instanceCount;
#endif
};
1.4 +7 -16 xml-xalan/c/src/XalanDOM/XalanNotation.hpp
Index: XalanNotation.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanNotation.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanNotation.hpp 2000/08/10 18:27:05 1.3
+++ XalanNotation.hpp 2000/11/02 01:46:41 1.4
@@ -83,13 +83,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -359,14 +359,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -376,7 +376,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -428,15 +428,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanNotation...
@@ -448,7 +439,7 @@
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const = 0;
/**
@@ -458,7 +449,7 @@
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const = 0;
protected:
1.4 +7 -16 xml-xalan/c/src/XalanDOM/XalanProcessingInstruction.hpp
Index: XalanProcessingInstruction.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanProcessingInstruction.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanProcessingInstruction.hpp 2000/08/10 18:27:05 1.3
+++ XalanProcessingInstruction.hpp 2000/11/02 01:46:41 1.4
@@ -83,13 +83,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -359,14 +359,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -376,7 +376,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -428,15 +428,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are new to XalanProcessingInstruction...
@@ -450,7 +441,7 @@
* XML defines this as being the
* first token following the markup that begins the processing instruction.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getTarget() const = 0;
/**
@@ -462,7 +453,7 @@
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const = 0;
//@}
1.4 +6 -15 xml-xalan/c/src/XalanDOM/XalanText.hpp
Index: XalanText.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanText.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanText.hpp 2000/08/10 18:27:05 1.3
+++ XalanText.hpp 2000/11/02 01:46:41 1.4
@@ -82,13 +82,13 @@
~XalanText();
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const = 0;
/**
@@ -362,14 +362,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const = 0;
/**
@@ -379,7 +379,7 @@
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const = 0;
/**
@@ -431,15 +431,6 @@
virtual unsigned long
getIndex() const = 0;
- /**
- * Returns the character data of the node that implements this interface,
- * according to the XSLT specification.
- *
- * @return a string containing the data.
- */
- virtual XalanDOMString
- getXSLTData() const = 0;
-
//@}
// These interfaces are inherited from XalanCharacterData...
@@ -462,7 +453,7 @@
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const = 0;
/**
1.1 xml-xalan/c/src/XalanDOM/XalanDOMString.cpp
Index: XalanDOMString.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDOMString.hpp"
#include <cassert>
#include <Include/XalanAutoPtr.hpp>
#if defined(XALAN_USE_XERCES_DOMSTRING)
static const char foo;
#elif defined(XALAN_USE_STD_STRING)
#elif defined(XALAN_USE_CUSTOM_STRING)
#include <cstdlib>
#include <dom/DOMString.hpp>
const XalanDOMChar XalanDOMString::s_empty = 0;
XalanDOMString::XalanDOMString() :
m_data()
{
}
XalanDOMString::XalanDOMString(
const XalanDOMString& theSource,
size_type theStartPosition,
size_type theCount) :
m_data()
{
if (theSource.length() != 0)
{
append(theSource, theStartPosition, theCount);
}
}
XalanDOMString::XalanDOMString(
const XalanDOMChar* theString,
size_type theCount) :
m_data()
{
assert(theString != 0);
if (*theString != 0)
{
append(theString, theCount);
}
}
XalanDOMString::XalanDOMString(
const char* theString,
size_type theCount) :
m_data()
{
assert(theString != 0);
if (*theString != 0)
{
TranscodeFromLocalCodePage(theString, theCount, m_data, true);
assert(m_data.back() == 0);
}
}
XalanDOMString::XalanDOMString(
size_type theCount,
XalanDOMChar theChar) :
m_data()
{
if (theCount != 0)
{
XalanDOMCharVectorType(theCount + 1, theChar).swap(m_data);
// Null-terminate it...
m_data.back() = 0;
}
}
XalanDOMString&
XalanDOMString::operator=(const XalanDOMChar* theRHS)
{
erase();
append(theRHS, length(theRHS));
assert(m_data.back() == 0);
return *this;
}
XalanDOMString&
XalanDOMString::append(
const XalanDOMChar* theString,
size_type theCount)
{
const size_type theLength =
theCount == size_type(npos) ? length(theString) : theCount;
if (theLength != 0)
{
if (m_data.size() == 0)
{
m_data.reserve(theLength + 1);
m_data.insert(m_data.end(), theString, theString + theLength);
m_data.push_back(0);
assert(length() == theLength);
}
else
{
m_data.insert(getBackInsertIterator(), theString, theString + theLength);
}
}
return *this;
}
XalanDOMString&
XalanDOMString::append(
size_type theCount,
XalanDOMChar theChar)
{
if (m_data.size() == 0)
{
m_data.insert(m_data.end(), theCount + 1, theChar);
m_data.back() = 0;
assert(length() == theCount);
}
else
{
m_data.insert(getBackInsertIterator(), theCount, theChar);
}
assert(m_data.back() == 0);
return *this;
}
XalanDOMString&
XalanDOMString::insert(
size_type thePosition,
const XalanDOMChar* theString,
size_type theCount)
{
m_data.insert(getIteratorForPosition(thePosition), theString, theString + theCount);
return *this;
}
XalanDOMString&
XalanDOMString::insert(
size_type thePosition,
size_type theCount,
XalanDOMChar theChar)
{
m_data.insert(getIteratorForPosition(thePosition), theCount, theChar);
return *this;
}
XalanDOMString::iterator
XalanDOMString::insert(
iterator thePosition,
XalanDOMChar theChar)
{
m_data.insert(thePosition, theChar);
return thePosition;
}
void
XalanDOMString::insert(
iterator thePosition,
size_type theCount,
XalanDOMChar theChar)
{
m_data.insert(thePosition, theCount, theChar);
}
void
XalanDOMString::insert(
iterator theInsertPosition,
const_iterator theFirstPosition,
const_iterator theLastPosition)
{
m_data.insert(theInsertPosition, theFirstPosition, theLastPosition);
}
template <class Type, class SizeType>
int
doCompare(
const Type* theLHS,
SizeType theLHSLength,
const Type* theRHS,
SizeType theRHSLength)
{
int theResult = 0;
if (theLHSLength != 0 || theRHSLength != 0)
{
Type theLHSChar = Type(0);
Type theRHSChar = Type(0);
SizeType i = 0;
for(; i < theLHSLength && i < theRHSLength; i++)
{
theLHSChar = theLHS[i];
theRHSChar = theRHS[i];
if (theLHSChar != theRHSChar)
{
break;
}
}
if (i == theLHSLength)
{
// We reached the end of theLHS...
if (i != theRHSLength)
{
// but not the end of theRHS.
theResult = -1;
}
}
else if (i == theRHSLength)
{
// We reached the end of theRHS string...
if (i != theLHSLength)
{
// but not the end of theLHS string.
theResult = 1;
}
}
else
{
// We didn't reach the end of _either_ string, so
// return the difference between the two characters
// that caused the problem.
theResult = theLHSChar - theRHSChar;
}
}
return theResult;
}
int
XalanDOMString::compare(const XalanDOMChar* theString) const
{
return doCompare(c_str(), length(), theString, length(theString));
}
int
XalanDOMString::compare(
size_type thePosition1,
size_type theCount1,
const XalanDOMChar* theString,
size_type theCount2) const
{
return doCompare(c_str() + thePosition1, theCount1, theString, theCount2);
}
XalanDOMString::CharVectorType
XalanDOMString::transcode() const
{
CharVectorType theResult;
TranscodeToLocalCodePage(c_str(), length(), theResult, true);
return theResult;
}
#endif
static inline unsigned int
length(const XalanDOMChar* theString)
{
assert(theString != 0);
const XalanDOMChar* theStringPointer = theString;
while(*theStringPointer != 0)
{
theStringPointer++;
}
return theStringPointer - theString;
}
#if defined(XALAN_USE_CUSTOM_STRING)
XalanDOMString::size_type
XalanDOMString::length(const XalanDOMChar* theString)
{
return ::length(theString);
}
#endif
static bool
doTranscodeToLocalCodePage(
const XalanDOMChar* theSourceString,
unsigned int theSourceStringLength,
bool theSourceStringIsNullTerminated,
CharVectorType& theTargetVector,
bool terminate)
{
// Short circuit if it's a null pointer, or of length 0.
if (!theSourceString || (!theSourceString[0]))
{
if (terminate == true)
{
theTargetVector.resize(1);
theTargetVector.back() = '\0';
}
else
{
theTargetVector.resize(0);
}
return true;
}
const wchar_t* theTempSource = 0;
// If our char sizes are not the same, or the input string is not null-terminated,
// we have to use a temporary buffer.
XalanArrayAutoPtr<wchar_t> theTempSourceJanitor;
#if !defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
// This is a short-cut for when the theSourceString is mull-terminated _and_
// XalanDOMChar and wchar_t are the same thing.
if (theSourceStringIsNullTerminated == true)
{
theTempSource = theSourceString;
}
else
#endif
{
if (theSourceStringIsNullTerminated == true)
{
theSourceStringLength = length(theSourceString);
}
theTempSourceJanitor.reset(new wchar_t[theSourceStringLength + 1]);
for (unsigned int index = 0; index < theSourceStringLength; ++index)
{
theTempSourceJanitor[index] = wchar_t(theSourceString[index]);
}
theTempSourceJanitor[theSourceStringLength] = 0;
theTempSource = theTempSourceJanitor.get();
}
// See how many chars we need to transcode.
const size_t targetLen = ::wcstombs(0, theTempSource, 0);
if (targetLen == size_t(-1))
{
return false;
}
else
{
// Resize, adding one byte if terminating...
theTargetVector.resize(terminate == true ? targetLen + 1 : targetLen);
// And transcode our temp source buffer to the local buffer. Terminate
//
if (wcstombs(&theTargetVector[0], theTempSource, targetLen) == size_t(-1))
{
return false;
}
else
{
if (terminate == true)
{
theTargetVector.back() = '\0';
}
return true;
}
}
}
XALAN_DOM_EXPORT_FUNCTION(bool)
TranscodeToLocalCodePage(
const XalanDOMChar* theSourceString,
unsigned int theSourceStringLength,
CharVectorType& theTargetVector,
bool terminate)
{
return doTranscodeToLocalCodePage(theSourceString, theSourceStringLength, false, theTargetVector, terminate);
}
XALAN_DOM_EXPORT_FUNCTION(bool)
TranscodeToLocalCodePage(
const XalanDOMChar* theSourceString,
CharVectorType& theTargetVector,
bool terminate)
{
return doTranscodeToLocalCodePage(theSourceString, 0, true, theTargetVector, terminate);
}
static bool
doTranscodeFromLocalCodePage(
const char* theSourceString,
unsigned int theSourceStringLength,
bool theSourceStringIsNullTerminated,
XalanDOMCharVectorType& theTargetVector,
bool terminate)
{
// Short circuit if it's a null pointer, or of length 0.
if (!theSourceString || (!theSourceString[0]))
{
if (terminate == true)
{
theTargetVector.resize(1);
theTargetVector.back() = '\0';
}
else
{
theTargetVector.resize(0);
}
return true;
}
if (theSourceStringIsNullTerminated == true)
{
theSourceStringLength = strlen(theSourceString);
}
// See how many chars we need to transcode.
const size_t theTargetLength = ::mbstowcs(0, theSourceString, theSourceStringLength);
if (theTargetLength == size_t(-1))
{
return false;
}
else
{
#if defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
typedef XalanDOMString::WideCharVectorType WideCharVectorType;
WideCharVectorType theTempResult;
theTempResult.resize(terminate == true ? theTargetLength + 1 : theTargetLength);
wchar_t* const theTargetPointer = &theTempResult[0];
#else
theTargetVector.resize(terminate == true ? theTargetLength + 1 : theTargetLength);
wchar_t* const theTargetPointer = &theTargetVector[0];
#endif
if (mbstowcs(theTargetPointer, theSourceString, theSourceStringLength) == size_t(-1))
{
return false;
}
else
{
#if defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
const WideCharVectorType::size_type theTempSize = theTempResult.size();
theTargetVector.reserve(theTempSize);
for(WideCharVectorType::size_type i = 0; i < theTempSize; ++i)
{
theTargetVector.push_back(WideCharVectorType::value_type(theTempResult[i]));
}
#endif
if (terminate == true)
{
theTargetVector.back() = '\0';
}
return true;
}
}
}
XALAN_DOM_EXPORT_FUNCTION(bool)
TranscodeFromLocalCodePage(
const char* theSourceString,
unsigned int theSourceStringLength,
XalanDOMCharVectorType& theTargetVector,
bool terminate)
{
return doTranscodeFromLocalCodePage(theSourceString, theSourceStringLength, false, theTargetVector, terminate);
}
XALAN_DOM_EXPORT_FUNCTION(bool)
TranscodeFromLocalCodePage(
const char* theSourceString,
XalanDOMCharVectorType& theTargetVector,
bool terminate)
{
return doTranscodeFromLocalCodePage(theSourceString, 0, true, theTargetVector, terminate);
}
XALAN_DOM_EXPORT_FUNCTION(const XalanDOMString)
TranscodeFromLocalCodePage(const char* sourceString)
{
XalanDOMCharVectorType theResult;
TranscodeFromLocalCodePage(sourceString, theResult, false);
const XalanDOMCharVectorType::size_type theSize = theResult.size();
if (theSize == 0)
{
return XalanDOMString();
}
else
{
return XalanDOMString(&theResult[0], theSize);
}
}
1.3 +22 -49 xml-xalan/c/src/XercesParserLiaison/XercesAttrBridge.cpp
Index: XercesAttrBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesAttrBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesAttrBridge.cpp 2000/08/10 18:41:35 1.2
+++ XercesAttrBridge.cpp 2000/11/02 01:46:42 1.3
@@ -66,6 +66,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
#include "XercesElementBridge.hpp"
@@ -91,18 +92,18 @@
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -247,14 +248,7 @@
void
XercesAttrBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -262,14 +256,7 @@
void
XercesAttrBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -279,31 +266,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -311,19 +300,11 @@
void
XercesAttrBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
-
bool
XercesAttrBridge::isIndexed() const
{
@@ -339,19 +320,11 @@
}
-
-XalanDOMString
-XercesAttrBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getName() const
{
- return m_xercesNode.getName();
+ return m_navigator.getPooledString(m_xercesNode.getName().rawBuffer());
}
@@ -364,10 +337,10 @@
-XalanDOMString
+const XalanDOMString&
XercesAttrBridge::getValue() const
{
- return m_xercesNode.getValue();
+ return m_navigator.getPooledString(m_xercesNode.getValue().rawBuffer());
}
@@ -377,7 +350,7 @@
{
try
{
- m_xercesNode.setValue(value);
+ m_xercesNode.setValue(c_wstr(value));
}
catch(const DOM_DOMException& theException)
{
1.4 +7 -14 xml-xalan/c/src/XercesParserLiaison/XercesAttrBridge.hpp
Index: XercesAttrBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesAttrBridge.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesAttrBridge.hpp 2000/08/10 18:41:35 1.3
+++ XercesAttrBridge.hpp 2000/11/02 01:46:42 1.4
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_Attr.hpp>
@@ -97,13 +93,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -377,14 +373,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -394,7 +390,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -435,9 +431,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanAttr...
@@ -448,7 +441,7 @@
* Returns the name of this attribute.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getName() const;
/**
@@ -467,7 +460,7 @@
* The value of the attribute is returned as a string.
* Character and general entity references are replaced with their values.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getValue() const;
//@}
1.5 +16 -0 xml-xalan/c/src/XercesParserLiaison/XercesBridgeNavigator.cpp
Index: XercesBridgeNavigator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesBridgeNavigator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XercesBridgeNavigator.cpp 2000/08/22 20:19:19 1.4
+++ XercesBridgeNavigator.cpp 2000/11/02 01:46:43 1.5
@@ -365,3 +365,19 @@
return theXalanText;
}
+
+
+
+const XalanDOMString&
+XercesBridgeNavigator::getPooledString(const XalanDOMString& theString) const
+{
+ return m_ownerDocument->getPooledString(theString);
+}
+
+
+
+const XalanDOMString&
+XercesBridgeNavigator:: getPooledString(const XalanDOMChar* theString) const
+{
+ return m_ownerDocument->getPooledString(theString);
+}
1.6 +24 -2 xml-xalan/c/src/XercesParserLiaison/XercesBridgeNavigator.hpp
Index: XercesBridgeNavigator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesBridgeNavigator.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XercesBridgeNavigator.hpp 2000/08/15 19:42:33 1.5
+++ XercesBridgeNavigator.hpp 2000/11/02 01:46:43 1.6
@@ -67,6 +67,10 @@
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class DOM_Attr;
class DOM_Node;
class XercesDocumentBridge;
@@ -117,8 +121,6 @@
DOM_Attr
mapNode(const XalanAttr* theXercesNode) const;
-public:
-
unsigned long
getIndex() const
{
@@ -241,6 +243,26 @@
splitText(
DOM_Text& theXercesText,
unsigned int offset) const;
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(const XalanDOMString& theString) const;
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(const XalanDOMChar* theString) const;
private:
1.4 +25 -86 xml-xalan/c/src/XercesParserLiaison/XercesCDATASectionBridge.cpp
Index: XercesCDATASectionBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesCDATASectionBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesCDATASectionBridge.cpp 2000/10/11 19:43:08 1.3
+++ XercesCDATASectionBridge.cpp 2000/11/02 01:46:43 1.4
@@ -66,6 +66,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -88,18 +89,18 @@
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -250,14 +251,7 @@
void
XercesCDATASectionBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -265,14 +259,7 @@
void
XercesCDATASectionBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -282,31 +269,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -314,14 +303,7 @@
void
XercesCDATASectionBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -342,19 +324,11 @@
}
-
-XalanDOMString
-XercesCDATASectionBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-XalanDOMString
+const XalanDOMString&
XercesCDATASectionBridge::getData() const
{
- return m_xercesNode.getData();
+ return m_navigator.getPooledString(m_xercesNode.getData().rawBuffer());
}
@@ -372,14 +346,7 @@
unsigned int offset,
unsigned int count) const
{
- try
- {
- return m_xercesNode.substringData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ return XercesBridgeHelper::substringData(m_xercesNode, offset, count);
}
@@ -387,14 +354,7 @@
void
XercesCDATASectionBridge::appendData(const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.appendData(arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::appendData(m_xercesNode, arg);
}
@@ -404,14 +364,7 @@
unsigned int offset,
const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.insertData(offset, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::insertData(m_xercesNode, offset, arg);
}
@@ -421,14 +374,7 @@
unsigned int offset,
unsigned int count)
{
- try
- {
- m_xercesNode.deleteData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::deleteData(m_xercesNode, offset, count);
}
@@ -439,14 +385,7 @@
unsigned int count,
const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.replaceData(offset, count, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::replaceData(m_xercesNode, offset, count, arg);
}
@@ -462,5 +401,5 @@
bool
XercesCDATASectionBridge::isIgnorableWhitespace() const
{
- return isWhitespace(m_xercesNode.getData());
+ return isXMLWhitespace(getData());
}
1.3 +6 -13 xml-xalan/c/src/XercesParserLiaison/XercesCDATASectionBridge.hpp
Index: XercesCDATASectionBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesCDATASectionBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesCDATASectionBridge.hpp 2000/08/10 18:41:36 1.2
+++ XercesCDATASectionBridge.hpp 2000/11/02 01:46:43 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_CDATASection.hpp>
@@ -94,13 +90,13 @@
/**
* Gets the name of this node.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -374,14 +370,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -391,7 +387,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -432,9 +428,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanCDATASection...
@@ -457,7 +450,7 @@
* fit in a <code>DOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const;
/**
1.3 +24 -85 xml-xalan/c/src/XercesParserLiaison/XercesCommentBridge.cpp
Index: XercesCommentBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesCommentBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesCommentBridge.cpp 2000/08/10 18:41:36 1.2
+++ XercesCommentBridge.cpp 2000/11/02 01:46:43 1.3
@@ -62,6 +62,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -84,18 +85,18 @@
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -246,14 +247,7 @@
void
XercesCommentBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -261,14 +255,7 @@
void
XercesCommentBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -277,31 +264,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -309,14 +298,7 @@
void
XercesCommentBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -336,19 +318,11 @@
}
-
-XalanDOMString
-XercesCommentBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-XalanDOMString
+const XalanDOMString&
XercesCommentBridge::getData() const
{
- return m_xercesNode.getData();
+ return m_navigator.getPooledString(m_xercesNode.getData().rawBuffer());
}
@@ -366,14 +340,7 @@
unsigned int offset,
unsigned int count) const
{
- try
- {
- return m_xercesNode.substringData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ return XercesBridgeHelper::substringData(m_xercesNode, offset, count);
}
@@ -381,14 +348,7 @@
void
XercesCommentBridge::appendData(const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.appendData(arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::appendData(m_xercesNode, arg);
}
@@ -398,14 +358,7 @@
unsigned int offset,
const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.insertData(offset, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::insertData(m_xercesNode, offset, arg);
}
@@ -415,14 +368,7 @@
unsigned int offset,
unsigned int count)
{
- try
- {
- m_xercesNode.deleteData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::deleteData(m_xercesNode, offset, count);
}
@@ -433,12 +379,5 @@
unsigned int count,
const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.replaceData(offset, count, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::replaceData(m_xercesNode, offset, count, arg);
}
1.3 +6 -13 xml-xalan/c/src/XercesParserLiaison/XercesCommentBridge.hpp
Index: XercesCommentBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesCommentBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesCommentBridge.hpp 2000/08/10 18:41:36 1.2
+++ XercesCommentBridge.hpp 2000/11/02 01:46:43 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_Comment.hpp>
@@ -94,13 +90,13 @@
/**
* Gets the name of this node.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -373,14 +369,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -390,7 +386,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -431,9 +427,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanCDATASection...
@@ -456,7 +449,7 @@
* fit in a <code>DOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const;
/**
1.2 +8 -4 xml-xalan/c/src/XercesParserLiaison/XercesDOMImplementationBridge.cpp
Index: XercesDOMImplementationBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMImplementationBridge.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOMImplementationBridge.cpp 2000/04/11 14:39:29 1.1
+++ XercesDOMImplementationBridge.cpp 2000/11/02 01:46:43 1.2
@@ -62,6 +62,10 @@
+#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include "XercesDOMException.hpp"
@@ -93,16 +97,16 @@
const XalanDOMString& feature,
const XalanDOMString& version)
{
- return m_xercesNode.hasFeature(feature, version);
+ return m_xercesNode.hasFeature(c_wstr(feature), c_wstr(version));
}
XalanDocumentType*
XercesDOMImplementationBridge::createDocumentType(
- const DOMString& qualifiedName,
- const DOMString& publicId,
- const DOMString& systemId)
+ const XalanDOMString& qualifiedName,
+ const XalanDOMString& publicId,
+ const XalanDOMString& systemId)
{
// $$$ ToDo: Fix this!!!
throw XercesDOMException(XercesDOMException::NO_MODIFICATION_ALLOWED_ERR);
1.2 +3 -3 xml-xalan/c/src/XercesParserLiaison/XercesDOMImplementationBridge.hpp
Index: XercesDOMImplementationBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMImplementationBridge.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOMImplementationBridge.hpp 2000/04/11 14:39:29 1.1
+++ XercesDOMImplementationBridge.hpp 2000/11/02 01:46:43 1.2
@@ -122,9 +122,9 @@
*/
virtual XalanDocumentType*
createDocumentType(
- const DOMString& qualifiedName,
- const DOMString& publicId,
- const DOMString& systemId);
+ const XalanDOMString& qualifiedName,
+ const XalanDOMString& publicId,
+ const XalanDOMString& systemId);
/**
* Creates an XML <code>DOM_Document</code> object of the specified type
1.3 +9 -13 xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.cpp
Index: XercesDOMSupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesDOMSupport.cpp 2000/09/05 02:24:56 1.2
+++ XercesDOMSupport.cpp 2000/11/02 01:46:43 1.3
@@ -74,7 +74,8 @@
XercesDOMSupport::XercesDOMSupport() :
- DOMSupport()
+ DOMSupport(),
+ m_domSupportDefault()
{
}
@@ -89,11 +90,12 @@
void
XercesDOMSupport::reset()
{
+ m_domSupportDefault.reset();
}
-XalanDOMString
+const XalanDOMString&
XercesDOMSupport::getNamespaceOfNode(const XalanNode& theNode) const
{
return theNode.getNamespaceURI();
@@ -101,22 +103,16 @@
-XalanDOMString
+const XalanDOMString&
XercesDOMSupport::getExpandedElementName(const XalanElement& elem) const
{
- const XalanDOMString theNamespace = getNamespaceOfNode(elem);
-
- return 0 != length(theNamespace) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + elem.getLocalName()
- : elem.getLocalName();
+ return m_domSupportDefault.getExpandedElementName(elem);
}
-XalanDOMString
-XercesDOMSupport::getExpandedAttributeName(const XalanAttr& attr) const
+const XalanDOMString&
+XercesDOMSupport::getExpandedAttributeName(const XalanAttr& attr) const
{
- const XalanDOMString theNamespace = getNamespaceOfNode(attr);
-
- return 0 != length(theNamespace) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + attr.getLocalName()
- : attr.getLocalName();
+ return m_domSupportDefault.getExpandedAttributeName(attr);
}
1.2 +8 -4 xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.hpp
Index: XercesDOMSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOMSupport.hpp 2000/08/10 18:03:35 1.1
+++ XercesDOMSupport.hpp 2000/11/02 01:46:43 1.2
@@ -65,7 +65,7 @@
#include <DOMSupport/DOMSupport.hpp>
-//#include <DOMSupport/DOMSupport.hpp>
+#include <DOMSupport/DOMSupportDefault.hpp>
@@ -91,7 +91,7 @@
* @param theNode DOM node whose namespace is queried
* @return namespace corresponding to 'theNode'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceOfNode(const XalanNode& theNode) const;
/**
@@ -100,7 +100,7 @@
* @param elem DOM element queried
* @return expanded name corresponding to 'elem'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const;
/**
@@ -109,8 +109,12 @@
* @param attr DOM attribute queried
* @return expanded name corresponding to 'attr'
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
+
+private:
+
+ DOMSupportDefault m_domSupportDefault;
};
1.2 +166 -0 xml-xalan/c/src/XercesParserLiaison/XercesDOM_NodeHack.cpp
Index: XercesDOM_NodeHack.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOM_NodeHack.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOM_NodeHack.cpp 2000/04/11 14:39:29 1.1
+++ XercesDOM_NodeHack.cpp 2000/11/02 01:46:43 1.2
@@ -61,6 +61,11 @@
+#include <dom/ElementImpl.hpp>
+#include <dom/TextImpl.hpp>
+
+
+
XercesDOM_NodeHack::XercesDOM_NodeHack(NodeImpl* theImpl) :
DOM_Node(theImpl)
{
@@ -81,6 +86,167 @@
+XercesDOM_AttrHack::XercesDOM_AttrHack(const DOM_Attr& theSource) :
+ DOM_Attr(theSource)
+{
+}
+
+
+
XercesDOM_AttrHack::~XercesDOM_AttrHack()
{
+}
+
+
+
+XercesDOM_ElementHack::XercesDOM_ElementHack(ElementImpl* theImpl) :
+ DOM_Element(theImpl)
+{
+}
+
+
+
+XercesDOM_ElementHack::XercesDOM_ElementHack(const DOM_Element& theSource) :
+ DOM_Element(theSource)
+{
+}
+
+
+
+XercesDOM_ElementHack::~XercesDOM_ElementHack()
+{
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getNodeNameImpl() const
+{
+ return getImpl()->getNodeName();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getNodeValueImpl() const
+{
+ return getImpl()->getNodeValue();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack:: getNamespaceURIImpl() const
+{
+ return getImpl()->getNamespaceURI();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getPrefixImpl() const
+{
+ return getImpl()->getPrefix();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getLocalNameImpl() const
+{
+ return getImpl()->getLocalName();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getTagNameImpl() const
+{
+ return getImpl()->getTagName();
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getAttributeImpl(const DOMString& name) const
+{
+ return getImpl()->getAttribute(name);
+}
+
+
+
+const DOMString
+XercesDOM_ElementHack::getAttributeNSImpl(
+ const DOMString& namespaceURI,
+ const DOMString& localName) const
+{
+ return getImpl()->getAttributeNS(namespaceURI, localName);
+}
+
+
+
+XercesDOM_TextHack::XercesDOM_TextHack(TextImpl* theImpl) :
+ DOM_Text(theImpl)
+{
+}
+
+
+
+XercesDOM_TextHack::XercesDOM_TextHack(const DOM_Text& theSource) :
+ DOM_Text(theSource)
+{
+}
+
+
+
+XercesDOM_TextHack::~XercesDOM_TextHack()
+{
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getNodeNameImpl() const
+{
+ return getImpl()->getNodeName();
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getNodeValueImpl() const
+{
+ return getImpl()->getNodeValue();
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getNamespaceURIImpl() const
+{
+ return getImpl()->getNamespaceURI();
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getPrefixImpl() const
+{
+ return getImpl()->getPrefix();
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getLocalNameImpl() const
+{
+ return getImpl()->getLocalName();
+}
+
+
+
+const DOMString
+XercesDOM_TextHack::getDataImpl() const
+{
+ return getImpl()->getData();
}
1.2 +108 -0 xml-xalan/c/src/XercesParserLiaison/XercesDOM_NodeHack.hpp
Index: XercesDOM_NodeHack.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOM_NodeHack.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOM_NodeHack.hpp 2000/04/11 14:39:29 1.1
+++ XercesDOM_NodeHack.hpp 2000/11/02 01:46:43 1.2
@@ -9,6 +9,8 @@
#include <dom/DOM_Node.hpp>
#include <dom/DOM_Attr.hpp>
+#include <dom/DOM_Element.hpp>
+#include <dom/DOM_Text.hpp>
@@ -47,7 +49,113 @@
XercesDOM_AttrHack(AttrImpl* theImpl = 0);
+ XercesDOM_AttrHack(const DOM_Attr& theSource);
+
~XercesDOM_AttrHack();
+};
+
+
+
+class XALAN_XERCESPARSERLIAISON_EXPORT XercesDOM_ElementHack : public DOM_Element
+{
+public:
+
+ XercesDOM_ElementHack(ElementImpl* theImpl = 0);
+
+ XercesDOM_ElementHack(const DOM_Element& theSource);
+
+ ~XercesDOM_ElementHack();
+
+
+ const DOMString
+ getNodeNameImpl() const;
+
+ const DOMString
+ getNodeValueImpl() const;
+
+ const DOMString
+ getNamespaceURIImpl() const;
+
+ const DOMString
+ getPrefixImpl() const;
+
+ const DOMString
+ getLocalNameImpl() const;
+
+ const DOMString
+ getTagNameImpl() const;
+
+ const DOMString
+ getAttributeImpl(const DOMString& name) const;
+
+ const DOMString
+ getAttributeNSImpl(
+ const DOMString& namespaceURI,
+ const DOMString& localName) const;
+
+ ElementImpl*
+ getImpl() const
+ {
+ return (ElementImpl*)fImpl;
+ }
+
+ static ElementImpl*
+ getImpl(const DOM_Element& theNode)
+ {
+#if defined(XALAN_OLD_STYLE_CASTS)
+ return ((const XercesDOM_ElementHack&)theNode).getImpl();
+#else
+ return static_cast<const XercesDOM_ElementHack&>(theNode).getImpl();
+#endif
+ }
+};
+
+
+
+class XALAN_XERCESPARSERLIAISON_EXPORT XercesDOM_TextHack : public DOM_Text
+{
+public:
+
+ XercesDOM_TextHack(TextImpl* theImpl = 0);
+
+ XercesDOM_TextHack(const DOM_Text& theSource);
+
+ ~XercesDOM_TextHack();
+
+
+ const DOMString
+ getNodeNameImpl() const;
+
+ const DOMString
+ getNodeValueImpl() const;
+
+ const DOMString
+ getNamespaceURIImpl() const;
+
+ const DOMString
+ getPrefixImpl() const;
+
+ const DOMString
+ getLocalNameImpl() const;
+
+ const DOMString
+ getDataImpl() const;
+
+ TextImpl*
+ getImpl() const
+ {
+ return (TextImpl*)fImpl;
+ }
+
+ static TextImpl*
+ getImpl(const DOM_Text& theNode)
+ {
+#if defined(XALAN_OLD_STYLE_CASTS)
+ return ((const XercesDOM_TextHack&)theNode).getImpl();
+#else
+ return static_cast<const XercesDOM_TextHack&>(theNode).getImpl();
+#endif
+ }
};
1.13 +107 -238 xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.cpp
Index: XercesDocumentBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XercesDocumentBridge.cpp 2000/09/19 14:47:22 1.12
+++ XercesDocumentBridge.cpp 2000/11/02 01:46:43 1.13
@@ -82,6 +82,7 @@
#include "XercesAttrBridge.hpp"
+#include "XercesBridgeHelper.hpp"
#include "XercesCommentBridge.hpp"
#include "XercesCDATASectionBridge.hpp"
#include "XercesDOM_NodeHack.hpp"
@@ -107,8 +108,6 @@
m_documentElement(0),
m_children(theXercesDocument.getChildNodes(),
m_navigator),
- m_cachedNodeLists(theXercesDocument,
- m_navigator),
m_nodeMap(),
m_domImplementation(new XercesDOMImplementationBridge(theXercesDocument.getImplementation())),
m_navigators(1, XercesBridgeNavigator(this, !buildBridge)),
@@ -116,12 +115,11 @@
m_nodes(),
m_doctype(0),
m_mappingMode(!buildBridge),
- m_indexValid(false)
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
- , m_elementAllocator(25),
+ m_indexValid(false),
+ m_elementAllocator(25),
m_textAllocator(25),
- m_attributeAllocator(25)
-#endif
+ m_attributeAllocator(25),
+ m_stringPool()
{
#if !defined(XALAN_NO_NAMESPACES)
using std::make_pair;
@@ -352,6 +350,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
// Update the member variable for the new instance.
This->m_doctype = new XercesDocumentTypeBridge(theDoctype, theNavigator);
@@ -362,18 +364,7 @@
}
This->m_nodes.push_back(m_doctype);
-#else
- // Update the member variable for the new instance.
- m_doctype = new XercesDocumentTypeBridge(theDoctype, theNavigator);
-
- if (mapNode == true)
- {
- m_nodeMap.addAssociation(theDoctype, m_doctype);
- }
- m_nodes.push_back(m_doctype);
-#endif
-
return m_doctype;
}
@@ -393,17 +384,14 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
XercesElementBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
This->m_elementAllocator.create(theXercesNode,
theNavigator);
-#else
- new XercesElementBridge(theXercesNode,
- theNavigator);
-
- This->m_nodes.push_back(theBridge);
-#endif
if (m_doctype != 0 || mapNode == true)
{
@@ -412,27 +400,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- XercesElementBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
- m_elementAllocator.create(theXercesNode,
- theNavigator);
-#else
- new XercesElementBridge(theXercesNode,
- theNavigator);
-
- m_nodes.push_back(theBridge);
-#endif
-
- if (m_doctype != 0 || mapNode == true)
- {
- // Add it to the node map, since we my need it for getting
- // elements by ID, or we're in mapping mode.
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-#endif
-
return theBridge;
}
@@ -456,6 +423,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -464,16 +435,7 @@
// Add it to the node map...
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else
- m_nodes.push_back(theBridge);
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-#endif
-
return theBridge;
}
@@ -493,17 +455,14 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
XercesTextBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
This->m_textAllocator.create(theXercesNode,
theNavigator);
-#else
- new XercesTextBridge(theXercesNode,
- theNavigator);
-
- This->m_nodes.push_back(theBridge);
-#endif
if (mapNode == true)
{
@@ -511,27 +470,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- XercesTextBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
- m_textAllocator.create(theXercesNode,
- theNavigator);
-#else
- new XercesTextBridge(theXercesNode,
- theNavigator);
-
- m_nodes.push_back(theBridge);
-#endif
-
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-
-#endif
-
return theBridge;
}
@@ -555,6 +493,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -564,18 +506,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-
-#endif
-
return theBridge;
}
@@ -599,6 +529,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -608,18 +542,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-
-#endif
-
return theBridge;
}
@@ -643,6 +565,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -652,18 +578,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-
-#endif
-
return theBridge;
}
@@ -683,41 +597,19 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
XercesAttrBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
This->m_attributeAllocator.create(theXercesNode,
theNavigator);
-#else
- new XercesAttrBridge(theXercesNode,
- theNavigator);
-
- This->m_nodes.push_back(theBridge);
-#endif
// Add it to the node map -- attributes ALWAYS go in the map
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
-#else // XALAN_NO_MUTABLE
-
- XercesAttrBridge* const theBridge =
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
- m_attributeAllocator.create(theXercesNode,
- theNavigator);
-#else
- new XercesAttrBridge(theXercesNode,
- theNavigator);
-
- m_nodes.push_back(theBridge);
-#endif
-
- // Add it to the node map -- attributes ALWAYS go in the map
- // for now...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
-
-#endif
-
return theBridge;
}
@@ -741,6 +633,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -748,16 +644,6 @@
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- // Add it to the node map -- entities ALWAYS go in the map
- // for now...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
-
-#endif
-
return theBridge;
}
@@ -781,6 +667,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -790,18 +680,6 @@
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
}
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- if (mapNode == true)
- {
- // Add it to the node map...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
- }
-
-#endif
-
return theBridge;
}
@@ -825,6 +703,10 @@
#if defined(XALAN_NO_MUTABLE)
XercesDocumentBridge* const This =
(XercesDocumentBridge*)this;
+#else
+ const XercesDocumentBridge* const This =
+ this;
+#endif
This->m_nodes.push_back(theBridge);
@@ -832,16 +714,6 @@
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theBridge);
-#else // XALAN_NO_MUTABLE
-
- m_nodes.push_back(theBridge);
-
- // Add it to the node map -- notations ALWAYS go in the map
- // for now...
- m_nodeMap.addAssociation(theXercesNode, theBridge);
-
-#endif
-
return theBridge;
}
@@ -1081,20 +953,18 @@
-// The rest of these are the standard DOM interfaces...
-
-XalanDOMString
+const XalanDOMString&
XercesDocumentBridge::getNodeName() const
{
- return m_xercesDocument.getNodeName();
+ return getPooledString(m_xercesDocument.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentBridge::getNodeValue() const
{
- return m_xercesDocument.getNodeValue();
+ return getPooledString(m_xercesDocument.getNodeValue().rawBuffer());
}
@@ -1248,14 +1118,7 @@
void
XercesDocumentBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesDocument.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesDocument, nodeValue);
}
@@ -1263,14 +1126,7 @@
void
XercesDocumentBridge::normalize()
{
- try
- {
- m_xercesDocument.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesDocument);
}
@@ -1279,31 +1135,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesDocument.supports(feature, version);
+ return m_xercesDocument.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentBridge::getNamespaceURI() const
{
- return m_xercesDocument.getNamespaceURI();
+ return getPooledString(m_xercesDocument.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentBridge::getPrefix() const
{
- return m_xercesDocument.getPrefix();
+ return getPooledString(m_xercesDocument.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentBridge::getLocalName() const
{
- return m_xercesDocument.getLocalName();
+ return getPooledString(m_xercesDocument.getLocalName().rawBuffer());
}
@@ -1311,14 +1169,7 @@
void
XercesDocumentBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesDocument.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesDocument, prefix);
}
@@ -1341,14 +1192,6 @@
-XalanDOMString
-XercesDocumentBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
XalanElement*
XercesDocumentBridge::createElement(const XalanDOMString& tagName)
{
@@ -1357,7 +1200,7 @@
try
{
const DOM_Element theXercesNode =
- m_xercesDocument.createElement(tagName);
+ m_xercesDocument.createElement(c_wstr(tagName));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1405,7 +1248,7 @@
try
{
const DOM_Text theXercesNode =
- m_xercesDocument.createTextNode(data);
+ m_xercesDocument.createTextNode(c_wstr(data));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1429,7 +1272,7 @@
try
{
const DOM_Comment theXercesNode =
- m_xercesDocument.createComment(data);
+ m_xercesDocument.createComment(c_wstr(data));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1453,7 +1296,7 @@
try
{
const DOM_CDATASection theXercesNode =
- m_xercesDocument.createCDATASection(data);
+ m_xercesDocument.createCDATASection(c_wstr(data));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1479,7 +1322,7 @@
try
{
const DOM_ProcessingInstruction theXercesNode =
- m_xercesDocument.createProcessingInstruction(target, data);
+ m_xercesDocument.createProcessingInstruction(c_wstr(target), c_wstr(data));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1503,7 +1346,7 @@
try
{
const DOM_Attr theXercesNode =
- m_xercesDocument.createAttribute(name);
+ m_xercesDocument.createAttribute(c_wstr(name));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1527,7 +1370,7 @@
try
{
const DOM_EntityReference theXercesNode =
- m_xercesDocument.createEntityReference(name);
+ m_xercesDocument.createEntityReference(c_wstr(name));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1571,9 +1414,10 @@
XalanNodeList*
-XercesDocumentBridge::getElementsByTagName(const XalanDOMString& tagname) const
+XercesDocumentBridge::getElementsByTagName(const XalanDOMString& /* tagname */) const
{
- return m_cachedNodeLists.getElementsByTagName(tagname);
+ // Not supported
+ return 0;
}
@@ -1604,7 +1448,7 @@
try
{
const DOM_Element theXercesNode =
- m_xercesDocument.createElementNS(namespaceURI, qualifiedName);
+ m_xercesDocument.createElementNS(c_wstr(namespaceURI), c_wstr(qualifiedName));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1630,7 +1474,7 @@
try
{
const DOM_Attr theXercesNode =
- m_xercesDocument.createAttributeNS(namespaceURI, qualifiedName);
+ m_xercesDocument.createAttributeNS(c_wstr(namespaceURI), c_wstr(qualifiedName));
assert(theXercesNode.isNull() == false);
theBridgeNode = createBridgeNode(theXercesNode, 0, true);
@@ -1648,10 +1492,11 @@
XalanNodeList*
XercesDocumentBridge::getElementsByTagNameNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
{
- return m_cachedNodeLists.getElementsByTagNameNS(namespaceURI, localName);
+ // Not supported
+ return 0;
}
@@ -1662,9 +1507,9 @@
// $$$ ToDo: This is because DOM_Document::getElementById() is not
// const...
#if defined(XALAN_NO_MUTABLE)
- const DOM_Node theXercesNode(((DOM_Document&)m_xercesDocument).getElementById(elementId));
+ const DOM_Node theXercesNode(((DOM_Document&)m_xercesDocument).getElementById(c_wstr(elementId)));
#else
- const DOM_Node theXercesNode(m_xercesDocument.getElementById(elementId));
+ const DOM_Node theXercesNode(m_xercesDocument.getElementById(c_wstr(elementId)));
#endif
return theXercesNode.isNull() == true ? 0 :
@@ -1908,4 +1753,28 @@
// Pop the context marker...
m_siblingNavigatorStack.pop_back();
+}
+
+
+
+const XalanDOMString&
+XercesDocumentBridge::getPooledString(const XalanDOMString& theString) const
+{
+#if defined(XALAN_NO_MUTABLE)
+ return ((XercesDocumentBridge*)this)->m_stringPool.get(theString);
+#else
+ return m_stringPool.get(theString);
+#endif
+}
+
+
+
+const XalanDOMString&
+XercesDocumentBridge:: getPooledString(const XalanDOMChar* theString) const
+{
+#if defined(XALAN_NO_MUTABLE)
+ return ((XercesDocumentBridge*)this)->m_stringPool.get(theString);
+#else
+ return m_stringPool.get(theString);
+#endif
}
1.11 +33 -23 xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.hpp
Index: XercesDocumentBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XercesDocumentBridge.hpp 2000/09/20 20:48:26 1.10
+++ XercesDocumentBridge.hpp 2000/11/02 01:46:43 1.11
@@ -83,28 +83,25 @@
-#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <Include/XalanAutoPtr.hpp>
+#include <PlatformSupport/XalanDOMStringPool.hpp>
+
+
+
#include <DOMSupport/TreeWalker.hpp>
#include <XercesParserLiaison/XercesToXalanNodeMap.hpp>
#include <XercesParserLiaison/XercesBridgeNavigator.hpp>
-#include <XercesParserLiaison/XercesDocumentNamedNodeListCache.hpp>
#include <XercesParserLiaison/XercesNodeListBridge.hpp>
#include <XercesParserLiaison/XercesTreeWalker.hpp>
-
-
-#define XALAN_USE_BLOCK_ALLOCATORS
-
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
#include <XercesParserLiaison/XercesElementBridgeAllocator.hpp>
#include <XercesParserLiaison/XercesTextBridgeAllocator.hpp>
#include <XercesParserLiaison/XercesAttributeBridgeAllocator.hpp>
-#endif
@@ -151,10 +148,10 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
virtual NodeType
@@ -221,13 +218,13 @@
const XalanDOMString& feature,
const XalanDOMString& version) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
virtual void
@@ -239,9 +236,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
virtual XalanElement*
createElement(const XalanDOMString& tagName);
@@ -358,9 +352,6 @@
}
/**
- *
- * Constructor for XercesDocumentBridge.
- *
* Build the entire bridge structure. This should be done before any
* processing begins, if the tree will be shared amongst multiple
* threads.
@@ -436,6 +427,27 @@
NavigatorStackType m_siblingNavigatorStack;
};
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(const XalanDOMString& theString) const;
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(const XalanDOMChar* theString) const;
+
private:
XalanNode*
@@ -552,8 +564,6 @@
XercesNodeListBridge m_children;
- XercesDocumentNamedNodeListCache m_cachedNodeLists;
-
mutable XercesToXalanNodeMap m_nodeMap;
XalanAutoPtr<XalanDOMImplementation> m_domImplementation;
@@ -572,13 +582,13 @@
bool m_indexValid;
-#if defined(XALAN_USE_BLOCK_ALLOCATORS)
mutable XercesElementBridgeAllocator m_elementAllocator;
mutable XercesTextBridgeAllocator m_textAllocator;
mutable XercesAttributeBridgeAllocator m_attributeAllocator;
-#endif
+
+ mutable XalanDOMStringPool m_stringPool;
};
1.4 +17 -44 xml-xalan/c/src/XercesParserLiaison/XercesDocumentFragmentBridge.cpp
Index: XercesDocumentFragmentBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentFragmentBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesDocumentFragmentBridge.cpp 2000/08/10 18:41:36 1.3
+++ XercesDocumentFragmentBridge.cpp 2000/11/02 01:46:43 1.4
@@ -66,7 +66,7 @@
-#include "XercesDOMException.hpp"
+#include "XercesBridgeHelper.hpp"
#include "XercesDocumentBridge.hpp"
@@ -90,18 +90,18 @@
-XalanDOMString
+const XalanDOMString&
XercesDocumentFragmentBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentFragmentBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -244,14 +244,7 @@
void
XercesDocumentFragmentBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -259,14 +252,7 @@
void
XercesDocumentFragmentBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -275,31 +261,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentFragmentBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentFragmentBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentFragmentBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -307,14 +295,7 @@
void
XercesDocumentFragmentBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -337,12 +318,4 @@
return 0;
// return m_navigator.getIndex();
-}
-
-
-
-XalanDOMString
-XercesDocumentFragmentBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
}
1.3 +5 -12 xml-xalan/c/src/XercesParserLiaison/XercesDocumentFragmentBridge.hpp
Index: XercesDocumentFragmentBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentFragmentBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesDocumentFragmentBridge.hpp 2000/08/10 18:41:36 1.2
+++ XercesDocumentFragmentBridge.hpp 2000/11/02 01:46:43 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_DocumentFragment.hpp>
@@ -97,13 +93,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -377,14 +373,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -394,7 +390,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -434,9 +430,6 @@
virtual unsigned long
getIndex() const;
-
- virtual XalanDOMString
- getXSLTData() const;
//@}
1.2 +2 -2 xml-xalan/c/src/XercesParserLiaison/XercesDocumentNamedNodeListCache.cpp
Index: XercesDocumentNamedNodeListCache.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentNamedNodeListCache.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDocumentNamedNodeListCache.cpp 2000/04/11 14:39:29 1.1
+++ XercesDocumentNamedNodeListCache.cpp 2000/11/02 01:46:43 1.2
@@ -88,7 +88,7 @@
DOM_NodeList
XercesDocumentNamedNodeListCache::getXercesNodeList(const XalanDOMString& tagname) const
{
- return m_xercesDocument.getElementsByTagName(tagname);
+ return m_xercesDocument.getElementsByTagName(c_wstr(tagname));
}
@@ -98,5 +98,5 @@
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
- return m_xercesDocument.getElementsByTagNameNS(namespaceURI, localName);
+ return m_xercesDocument.getElementsByTagNameNS(c_wstr(namespaceURI), c_wstr(localName));
}
1.4 +25 -51 xml-xalan/c/src/XercesParserLiaison/XercesDocumentTypeBridge.cpp
Index: XercesDocumentTypeBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentTypeBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesDocumentTypeBridge.cpp 2000/08/10 18:41:36 1.3
+++ XercesDocumentTypeBridge.cpp 2000/11/02 01:46:43 1.4
@@ -62,6 +62,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -88,18 +89,18 @@
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -253,14 +254,7 @@
void
XercesDocumentTypeBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -268,14 +262,7 @@
void
XercesDocumentTypeBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -285,31 +272,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -317,14 +306,7 @@
void
XercesDocumentTypeBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -345,18 +327,10 @@
-XalanDOMString
-XercesDocumentTypeBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getName() const
{
- return m_xercesNode.getName();
+ return m_navigator.getPooledString(m_xercesNode.getName().rawBuffer());
}
@@ -377,24 +351,24 @@
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getPublicId() const
{
- return m_xercesNode.getPublicId();
+ return m_navigator.getPooledString(m_xercesNode.getPublicId().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getSystemId() const
{
- return m_xercesNode.getSystemId();
+ return m_navigator.getPooledString(m_xercesNode.getSystemId().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesDocumentTypeBridge::getInternalSubset() const
{
- return m_xercesNode.getInternalSubset();
+ return m_navigator.getPooledString(m_xercesNode.getInternalSubset().rawBuffer());
}
1.3 +9 -16 xml-xalan/c/src/XercesParserLiaison/XercesDocumentTypeBridge.hpp
Index: XercesDocumentTypeBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentTypeBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesDocumentTypeBridge.hpp 2000/08/10 18:41:37 1.2
+++ XercesDocumentTypeBridge.hpp 2000/11/02 01:46:43 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_DocumentType.hpp>
@@ -98,13 +94,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -378,14 +374,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -395,7 +391,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -436,9 +432,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanDocumentType...
@@ -450,7 +443,7 @@
* The name of DTD; i.e., the name immediately following the
* <code>DOCTYPE</code> keyword in an XML source document.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getName() const;
/**
@@ -475,21 +468,21 @@
* Get the public identifier of the external subset.
* @return The public identifier of the external subset.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const;
/**
* Get the system identifier of the external subset.
* @return The system identifier of the external subset.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const;
/**
* Get the internal subset as a string.
* @return The internal subset as a string.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getInternalSubset() const;
//@}
1.4 +39 -65 xml-xalan/c/src/XercesParserLiaison/XercesElementBridge.cpp
Index: XercesElementBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesElementBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesElementBridge.cpp 2000/08/22 20:19:20 1.3
+++ XercesElementBridge.cpp 2000/11/02 01:46:43 1.4
@@ -66,8 +66,9 @@
-#include "XercesDOMException.hpp"
+#include "XercesBridgeHelper.hpp"
#include "XercesBridgeNavigator.hpp"
+#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -81,9 +82,7 @@
m_children(theXercesElement.getChildNodes(),
theNavigator),
m_attributes(theXercesElement.getAttributes(),
- theNavigator),
- m_cachedNodeLists(theXercesElement,
- theNavigator)
+ theNavigator)
{
}
@@ -95,18 +94,18 @@
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeNameImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValueImpl().rawBuffer());
}
@@ -249,14 +248,7 @@
void
XercesElementBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -264,14 +256,7 @@
void
XercesElementBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -280,31 +265,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURIImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefixImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalNameImpl().rawBuffer());
}
@@ -312,14 +299,7 @@
void
XercesElementBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -340,32 +320,24 @@
-XalanDOMString
-XercesElementBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getTagName() const
{
- return m_xercesNode.getTagName();
+ return m_navigator.getPooledString(m_xercesNode.getTagNameImpl().rawBuffer());
}
-XalanDOMString
-XercesElementBridge::getAttribute(const XalanDOMString& name) const
+const XalanDOMString&
+XercesElementBridge::getAttribute(const XalanDOMString& name) const
{
- return m_xercesNode.getAttribute(name);
+ return m_navigator.getPooledString(m_xercesNode.getAttributeImpl(c_wstr(name)).rawBuffer());
}
XalanAttr*
-XercesElementBridge::getAttributeNode(const XalanDOMString& name) const
+XercesElementBridge::getAttributeNode(const XalanDOMString& name) const
{
#if defined(XALAN_OLD_STYLE_CASTS)
return (XalanAttr*)m_attributes.getNamedItem(name);
@@ -377,9 +349,10 @@
XalanNodeList*
-XercesElementBridge::getElementsByTagName(const XalanDOMString& name) const
+XercesElementBridge::getElementsByTagName(const XalanDOMString& /* name */) const
{
- return m_cachedNodeLists.getElementsByTagName(name);
+ // Not supported...
+ return 0;
}
@@ -391,7 +364,7 @@
{
try
{
- m_xercesNode.setAttribute(name, value);
+ m_xercesNode.setAttribute(c_wstr(name), c_wstr(value));
}
catch(const DOM_DOMException& theException)
{
@@ -462,7 +435,7 @@
{
try
{
- m_xercesNode.removeAttribute(name);
+ m_xercesNode.removeAttribute(c_wstr(name));
}
catch(const DOM_DOMException& theException)
{
@@ -472,12 +445,12 @@
-XalanDOMString
+const XalanDOMString&
XercesElementBridge::getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
- return m_xercesNode.getAttributeNS(namespaceURI, localName);
+ return m_navigator.getPooledString(m_xercesNode.getAttributeNSImpl(c_wstr(namespaceURI), c_wstr(localName)).rawBuffer());
}
@@ -490,7 +463,7 @@
{
try
{
- m_xercesNode.setAttributeNS(namespaceURI, qualifiedName, value);
+ m_xercesNode.setAttributeNS(c_wstr(namespaceURI), c_wstr(qualifiedName), c_wstr(value));
}
catch(const DOM_DOMException& theException)
{
@@ -507,7 +480,7 @@
{
try
{
- m_xercesNode.removeAttributeNS(namespaceURI, localName);
+ m_xercesNode.removeAttributeNS(c_wstr(namespaceURI), c_wstr(localName));
}
catch(const DOM_DOMException& theException)
{
@@ -523,7 +496,7 @@
const XalanDOMString& localName) const
{
const DOM_Attr theAttrNode =
- m_xercesNode.getAttributeNodeNS(namespaceURI, localName);
+ m_xercesNode.getAttributeNodeNS(c_wstr(namespaceURI), c_wstr(localName));
return m_navigator.mapNode(theAttrNode);
}
@@ -561,8 +534,9 @@
XalanNodeList*
XercesElementBridge::getElementsByTagNameNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const
+ const XalanDOMString& /* namespaceURI */,
+ const XalanDOMString& /* localName */) const
{
- return m_cachedNodeLists.getElementsByTagNameNS(namespaceURI, localName);
+ // Not supported...
+ return 0;
}
1.3 +10 -15 xml-xalan/c/src/XercesParserLiaison/XercesElementBridge.hpp
Index: XercesElementBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesElementBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesElementBridge.hpp 2000/08/10 18:41:37 1.2
+++ XercesElementBridge.hpp 2000/11/02 01:46:43 1.3
@@ -79,7 +79,7 @@
-#include <XercesParserLiaison/XercesElementNamedNodeListCache.hpp>
+#include <XercesParserLiaison/XercesDOM_NodeHack.hpp>
#include <XercesParserLiaison/XercesNamedNodeMapBridge.hpp>
#include <XercesParserLiaison/XercesNodeListBridge.hpp>
@@ -104,13 +104,13 @@
/**
* Gets the name of this node.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -384,14 +384,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -401,7 +401,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -442,9 +442,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanElement...
@@ -457,7 +454,7 @@
* the value <code>"elementExample"</code>. Note that this is
* case-preserving in XML, as are all of the operations of the DOM.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getTagName() const;
/**
@@ -467,7 +464,7 @@
* @return The <code>DOM_Attr</code> value as a string, or the empty string if
* that attribute does not have a specified or default value.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttribute(const XalanDOMString& name) const;
/**
@@ -596,7 +593,7 @@
* @return The <code>DOM_Attr</code> value as a string, or an empty string if
* that attribute does not have a specified or default value.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
@@ -737,15 +734,13 @@
operator==(const XercesElementBridge& theRHS) const;
// Data members...
- DOM_Element m_xercesNode;
+ XercesDOM_ElementHack m_xercesNode;
const XercesBridgeNavigator& m_navigator;
XercesNodeListBridge m_children;
XercesNamedNodeMapBridge m_attributes;
-
- XercesElementNamedNodeListCache m_cachedNodeLists;
};
1.2 +2 -2 xml-xalan/c/src/XercesParserLiaison/XercesElementNamedNodeListCache.cpp
Index: XercesElementNamedNodeListCache.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesElementNamedNodeListCache.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesElementNamedNodeListCache.cpp 2000/04/11 14:39:30 1.1
+++ XercesElementNamedNodeListCache.cpp 2000/11/02 01:46:44 1.2
@@ -88,7 +88,7 @@
DOM_NodeList
XercesElementNamedNodeListCache::getXercesNodeList(const XalanDOMString& tagname) const
{
- return m_xercesElement.getElementsByTagName(tagname);
+ return m_xercesElement.getElementsByTagName(c_wstr(tagname));
}
@@ -98,5 +98,5 @@
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
- return m_xercesElement.getElementsByTagNameNS(namespaceURI, localName);
+ return m_xercesElement.getElementsByTagNameNS(c_wstr(namespaceURI), c_wstr(localName));
}
1.4 +23 -50 xml-xalan/c/src/XercesParserLiaison/XercesEntityBridge.cpp
Index: XercesEntityBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesEntityBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesEntityBridge.cpp 2000/08/10 18:41:37 1.3
+++ XercesEntityBridge.cpp 2000/11/02 01:46:44 1.4
@@ -62,8 +62,8 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesBridgeNavigator.hpp"
-#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -87,18 +87,18 @@
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -241,14 +241,7 @@
void
XercesEntityBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -256,14 +249,7 @@
void
XercesEntityBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -272,31 +258,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -304,14 +292,7 @@
void
XercesEntityBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -332,32 +313,24 @@
-XalanDOMString
-XercesEntityBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getPublicId() const
{
- return m_xercesNode.getPublicId();
+ return m_navigator.getPooledString(m_xercesNode.getPublicId().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getSystemId() const
{
- return m_xercesNode.getSystemId();
+ return m_navigator.getPooledString(m_xercesNode.getSystemId().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityBridge::getNotationName() const
{
- return m_xercesNode.getNotationName();
+ return m_navigator.getPooledString(m_xercesNode.getNotationName().rawBuffer());
}
1.4 +8 -15 xml-xalan/c/src/XercesParserLiaison/XercesEntityBridge.hpp
Index: XercesEntityBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesEntityBridge.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesEntityBridge.hpp 2000/08/10 18:41:38 1.3
+++ XercesEntityBridge.hpp 2000/11/02 01:46:44 1.4
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_Entity.hpp>
@@ -97,13 +93,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -377,14 +373,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -394,7 +390,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -435,9 +431,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanEntity...
@@ -449,7 +442,7 @@
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const;
/**
@@ -459,7 +452,7 @@
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const;
/**
@@ -467,7 +460,7 @@
*
* For parsed entities, this is <code>null</code>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNotationName() const;
private:
1.3 +17 -44 xml-xalan/c/src/XercesParserLiaison/XercesEntityReferenceBridge.cpp
Index: XercesEntityReferenceBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesEntityReferenceBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesEntityReferenceBridge.cpp 2000/08/10 18:41:38 1.2
+++ XercesEntityReferenceBridge.cpp 2000/11/02 01:46:44 1.3
@@ -62,7 +62,7 @@
-#include "XercesDOMException.hpp"
+#include "XercesBridgeHelper.hpp"
#include "XercesDocumentBridge.hpp"
@@ -86,18 +86,18 @@
-XalanDOMString
+const XalanDOMString&
XercesEntityReferenceBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityReferenceBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -240,14 +240,7 @@
void
XercesEntityReferenceBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -255,14 +248,7 @@
void
XercesEntityReferenceBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -272,31 +258,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesEntityReferenceBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityReferenceBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesEntityReferenceBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -304,14 +292,7 @@
void
XercesEntityReferenceBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -328,12 +309,4 @@
XercesEntityReferenceBridge::getIndex() const
{
return m_navigator.getIndex();
-}
-
-
-
-XalanDOMString
-XercesEntityReferenceBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
}
1.3 +5 -12 xml-xalan/c/src/XercesParserLiaison/XercesEntityReferenceBridge.hpp
Index: XercesEntityReferenceBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesEntityReferenceBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesEntityReferenceBridge.hpp 2000/08/10 18:41:38 1.2
+++ XercesEntityReferenceBridge.hpp 2000/11/02 01:46:44 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_EntityReference.hpp>
@@ -97,13 +93,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -377,14 +373,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -394,7 +390,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -434,9 +430,6 @@
virtual unsigned long
getIndex() const;
-
- virtual XalanDOMString
- getXSLTData() const;
//@}
1.4 +9 -1 xml-xalan/c/src/XercesParserLiaison/XercesNamedNodeListCache.cpp
Index: XercesNamedNodeListCache.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesNamedNodeListCache.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesNamedNodeListCache.cpp 2000/08/22 20:19:21 1.3
+++ XercesNamedNodeListCache.cpp 2000/11/02 01:46:44 1.4
@@ -137,7 +137,15 @@
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
- XalanDOMString theSearchString(namespaceURI + localName);
+ const unsigned int theNamespaceURILength = length(namespaceURI);
+ const unsigned int theLocalNameLength = length(localName);
+
+ XalanDOMString theSearchString;
+
+ reserve(theSearchString, theNamespaceURILength + theLocalNameLength + 1);
+
+ append(theSearchString, namespaceURI);
+ append(theSearchString, localName);
const NodeListCacheType::const_iterator i =
m_cachedNodeListsNS.find(theSearchString);
1.3 +5 -5 xml-xalan/c/src/XercesParserLiaison/XercesNamedNodeMapBridge.cpp
Index: XercesNamedNodeMapBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesNamedNodeMapBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesNamedNodeMapBridge.cpp 2000/08/22 20:19:22 1.2
+++ XercesNamedNodeMapBridge.cpp 2000/11/02 01:46:44 1.3
@@ -139,7 +139,7 @@
XalanNode*
XercesNamedNodeMapBridge::getNamedItem(const XalanDOMString& name) const
{
- return m_navigator.mapNode(m_xercesNamedNodeMap.getNamedItem(name));
+ return m_navigator.mapNode(m_xercesNamedNodeMap.getNamedItem(c_wstr(name)));
}
@@ -160,7 +160,7 @@
try
{
const DOM_Node theXercesNode =
- m_xercesNamedNodeMap.removeNamedItem(name);
+ m_xercesNamedNodeMap.removeNamedItem(c_wstr(name));
// A node was removed, so get it corresponding XalanNode...
theXalanNode = m_navigator.mapNode(theXercesNode);
@@ -182,9 +182,9 @@
const XalanDOMString& localName) const
{
#if defined(XALAN_NO_MUTABLE)
- return m_navigator.mapNode(((XercesNamedNodeMapBridge*)this)->m_xercesNamedNodeMap.getNamedItemNS(namespaceURI, localName));
+ return m_navigator.mapNode(((XercesNamedNodeMapBridge*)this)->m_xercesNamedNodeMap.getNamedItemNS(c_wstr(namespaceURI), c_wstr(localName)));
#else
- return m_navigator.mapNode(m_xercesNamedNodeMap.getNamedItemNS(namespaceURI, localName));
+ return m_navigator.mapNode(m_xercesNamedNodeMap.getNamedItemNS(c_wstr(namespaceURI), c_wstr(localName)));
#endif
}
@@ -238,7 +238,7 @@
try
{
const DOM_Node theXercesNode =
- m_xercesNamedNodeMap.removeNamedItemNS(namespaceURI, localName);
+ m_xercesNamedNodeMap.removeNamedItemNS(c_wstr(namespaceURI), c_wstr(localName));
// A node was removed, so get it corresponding XalanNode...
theXalanNode = m_navigator.mapNode(theXercesNode);
1.3 +21 -48 xml-xalan/c/src/XercesParserLiaison/XercesNotationBridge.cpp
Index: XercesNotationBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesNotationBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesNotationBridge.cpp 2000/08/10 18:41:38 1.2
+++ XercesNotationBridge.cpp 2000/11/02 01:46:44 1.3
@@ -62,7 +62,7 @@
-#include "XercesDOMException.hpp"
+#include "XercesBridgeHelper.hpp"
#include "XercesDocumentBridge.hpp"
@@ -84,18 +84,18 @@
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -238,14 +238,7 @@
void
XercesNotationBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -253,14 +246,7 @@
void
XercesNotationBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -269,31 +255,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -301,14 +289,7 @@
void
XercesNotationBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -329,24 +310,16 @@
-XalanDOMString
-XercesNotationBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getPublicId() const
{
- return m_xercesNode.getPublicId();
+ return m_navigator.getPooledString(m_xercesNode.getPublicId().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesNotationBridge::getSystemId() const
{
- return m_xercesNode.getSystemId();
+ return m_navigator.getPooledString(m_xercesNode.getSystemId().rawBuffer());
}
1.3 +7 -14 xml-xalan/c/src/XercesParserLiaison/XercesNotationBridge.hpp
Index: XercesNotationBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesNotationBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesNotationBridge.hpp 2000/08/10 18:41:39 1.2
+++ XercesNotationBridge.hpp 2000/11/02 01:46:44 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_Notation.hpp>
@@ -93,13 +89,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -373,14 +369,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -390,7 +386,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -431,9 +427,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanNotation...
@@ -445,7 +438,7 @@
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPublicId() const;
/**
@@ -455,7 +448,7 @@
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getSystemId() const;
private:
1.21 +11 -7 xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.cpp
Index: XercesParserLiaison.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XercesParserLiaison.cpp 2000/09/21 16:49:31 1.20
+++ XercesParserLiaison.cpp 2000/11/02 01:46:44 1.21
@@ -71,8 +71,11 @@
+#include <Include/XalanAutoPtr.hpp>
+
+
+
#include <PlatformSupport/STLHelper.hpp>
-#include <PlatformSupport/XalanAutoPtr.hpp>
#include <PlatformSupport/XalanUnicode.hpp>
@@ -81,6 +84,7 @@
+#include "XercesDOMSupport.hpp"
#include "XercesDocumentBridge.hpp"
@@ -99,11 +103,11 @@
-XercesParserLiaison::XercesParserLiaison(DOMSupport& theSupport) :
+XercesParserLiaison::XercesParserLiaison(XercesDOMSupport& theSupport) :
m_DOMSupport(theSupport),
m_specialCharacters(theDefaultSpecialCharacters),
m_indent(-1),
- m_shouldExpandEntityRefs(false),
+ m_shouldExpandEntityRefs(true),
m_useValidation(false),
m_includeIgnorableWhitespace(true),
m_doNamespaces(true),
@@ -152,7 +156,7 @@
void
XercesParserLiaison::parseXMLStream(
- InputSource& urlInputSource,
+ const InputSource& urlInputSource,
DocumentHandler& handler,
const XalanDOMString& /* identifier */)
{
@@ -167,7 +171,7 @@
XalanDocument*
XercesParserLiaison::parseXMLStream(
- InputSource& reader,
+ const InputSource& reader,
const XalanDOMString& /* identifier */)
{
XalanAutoPtr<DOMParser> theParser(CreateDOMParser());
@@ -213,7 +217,7 @@
/**
* Returns the element name with the namespace expanded.
*/
-XalanDOMString
+const XalanDOMString&
XercesParserLiaison::getExpandedElementName(const XalanElement& elem) const
{
return m_DOMSupport.getExpandedElementName(elem);
@@ -224,7 +228,7 @@
/**
* Returns the attribute name with the namespace expanded.
*/
-XalanDOMString
+const XalanDOMString&
XercesParserLiaison::getExpandedAttributeName(const XalanAttr& attr) const
{
return m_DOMSupport.getExpandedAttributeName(attr);
1.16 +7 -6 xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.hpp
Index: XercesParserLiaison.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesParserLiaison.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XercesParserLiaison.hpp 2000/09/19 14:47:38 1.15
+++ XercesParserLiaison.hpp 2000/11/02 01:46:44 1.16
@@ -85,6 +85,7 @@
class EntityResolver;
class InputSource;
class SAXParser;
+class XercesDOMSupport;
class XercesDocumentBridge;
class XSLProcessor;
@@ -99,7 +100,7 @@
*
* @param theSupport instance of DOMSupport object
*/
- XercesParserLiaison(DOMSupport& theSupport);
+ XercesParserLiaison(XercesDOMSupport& theSupport);
virtual
~XercesParserLiaison();
@@ -114,12 +115,12 @@
virtual XalanDocument*
parseXMLStream(
- InputSource& reader,
+ const InputSource& reader,
const XalanDOMString& identifier = XalanDOMString());
virtual void
parseXMLStream(
- InputSource& urlInputSource,
+ const InputSource& urlInputSource,
DocumentHandler& handler,
const XalanDOMString& identifier = XalanDOMString());
@@ -129,10 +130,10 @@
virtual XalanDocument*
getDOMFactory();
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedElementName(const XalanElement& elem) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
virtual void
@@ -406,7 +407,7 @@
private:
// Data members...
- DOMSupport& m_DOMSupport;
+ XercesDOMSupport& m_DOMSupport;
XalanDOMString m_specialCharacters;
1.3 +22 -48 xml-xalan/c/src/XercesParserLiaison/XercesProcessingInstructionBridge.cpp
Index: XercesProcessingInstructionBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesProcessingInstructionBridge.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesProcessingInstructionBridge.cpp 2000/08/10 18:41:39 1.2
+++ XercesProcessingInstructionBridge.cpp 2000/11/02 01:46:44 1.3
@@ -62,6 +62,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -84,18 +85,18 @@
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeName().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValue().rawBuffer());
}
@@ -246,14 +247,7 @@
void
XercesProcessingInstructionBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -261,14 +255,7 @@
void
XercesProcessingInstructionBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -277,31 +264,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURI().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefix().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalName().rawBuffer());
}
@@ -309,14 +298,7 @@
void
XercesProcessingInstructionBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -336,27 +318,19 @@
}
-
-XalanDOMString
-XercesProcessingInstructionBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getTarget() const
{
- return m_xercesNode.getTarget();
+ return m_navigator.getPooledString(m_xercesNode.getTarget().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesProcessingInstructionBridge::getData() const
{
- return m_xercesNode.getData();
+ return m_navigator.getPooledString(m_xercesNode.getData().rawBuffer());
}
@@ -366,7 +340,7 @@
{
try
{
- m_xercesNode.setData(data);
+ m_xercesNode.setData(c_wstr(data));
}
catch(const DOM_DOMException& theException)
{
1.3 +7 -14 xml-xalan/c/src/XercesParserLiaison/XercesProcessingInstructionBridge.hpp
Index: XercesProcessingInstructionBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesProcessingInstructionBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesProcessingInstructionBridge.hpp 2000/08/10 18:41:39 1.2
+++ XercesProcessingInstructionBridge.hpp 2000/11/02 01:46:44 1.3
@@ -63,10 +63,6 @@
-#include <cassert>
-
-
-
#include <dom/DOM_ProcessingInstruction.hpp>
@@ -93,13 +89,13 @@
// These interfaces are inherited from XalanNode...
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -373,14 +369,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -390,7 +386,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -431,9 +427,6 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
// These interfaces are inherited from XalanProcessingInstruction...
@@ -447,7 +440,7 @@
* XML defines this as being the
* first token following the markup that begins the processing instruction.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getTarget() const;
/**
@@ -459,7 +452,7 @@
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const;
//@}
1.4 +26 -88 xml-xalan/c/src/XercesParserLiaison/XercesTextBridge.cpp
Index: XercesTextBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesTextBridge.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesTextBridge.cpp 2000/10/11 19:43:08 1.3
+++ XercesTextBridge.cpp 2000/11/02 01:46:44 1.4
@@ -66,6 +66,7 @@
+#include "XercesBridgeHelper.hpp"
#include "XercesBridgeNavigator.hpp"
#include "XercesDOMException.hpp"
#include "XercesDocumentBridge.hpp"
@@ -90,18 +91,18 @@
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getNodeName() const
{
- return m_xercesNode.getNodeName();
+ return m_navigator.getPooledString(m_xercesNode.getNodeNameImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getNodeValue() const
{
- return m_xercesNode.getNodeValue();
+ return m_navigator.getPooledString(m_xercesNode.getNodeValueImpl().rawBuffer());
}
@@ -248,18 +249,10 @@
}
-
void
XercesTextBridge::setNodeValue(const XalanDOMString& nodeValue)
{
- try
- {
- m_xercesNode.setNodeValue(nodeValue);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setNodeValue(m_xercesNode, nodeValue);
}
@@ -267,14 +260,7 @@
void
XercesTextBridge::normalize()
{
- try
- {
- m_xercesNode.normalize();
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::normalize(m_xercesNode);
}
@@ -284,31 +270,33 @@
const XalanDOMString& feature,
const XalanDOMString& version) const
{
- return m_xercesNode.supports(feature, version);
+ return m_xercesNode.supports(
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(feature),
+ XercesBridgeHelper::XalanDOMStringToXercesDOMString(version));
}
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getNamespaceURI() const
{
- return m_xercesNode.getNamespaceURI();
+ return m_navigator.getPooledString(m_xercesNode.getNamespaceURIImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getPrefix() const
{
- return m_xercesNode.getPrefix();
+ return m_navigator.getPooledString(m_xercesNode.getPrefixImpl().rawBuffer());
}
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getLocalName() const
{
- return m_xercesNode.getLocalName();
+ return m_navigator.getPooledString(m_xercesNode.getLocalNameImpl().rawBuffer());
}
@@ -316,14 +304,7 @@
void
XercesTextBridge::setPrefix(const XalanDOMString& prefix)
{
- try
- {
- m_xercesNode.setPrefix(prefix);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::setPrefix(m_xercesNode, prefix);
}
@@ -344,18 +325,10 @@
-XalanDOMString
-XercesTextBridge::getXSLTData() const
-{
- return DOMServices::getNodeData(*this);
-}
-
-
-
-XalanDOMString
+const XalanDOMString&
XercesTextBridge::getData() const
{
- return m_xercesNode.getData();
+ return m_navigator.getPooledString(m_xercesNode.getDataImpl().rawBuffer());
}
@@ -373,14 +346,7 @@
unsigned int offset,
unsigned int count) const
{
- try
- {
- return m_xercesNode.substringData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ return XercesBridgeHelper::substringData(m_xercesNode, offset, count);
}
@@ -388,14 +354,7 @@
void
XercesTextBridge::appendData(const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.appendData(arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::appendData(m_xercesNode, arg);
}
@@ -403,16 +362,9 @@
void
XercesTextBridge::insertData(
unsigned int offset,
- const XalanDOMString& arg)
+ const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.insertData(offset, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::insertData(m_xercesNode, offset, arg);
}
@@ -422,14 +374,7 @@
unsigned int offset,
unsigned int count)
{
- try
- {
- m_xercesNode.deleteData(offset, count);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::deleteData(m_xercesNode, offset, count);
}
@@ -440,14 +385,7 @@
unsigned int count,
const XalanDOMString& arg)
{
- try
- {
- m_xercesNode.replaceData(offset, count, arg);
- }
- catch(const DOM_DOMException& theException)
- {
- throw XercesDOMException(theException);
- }
+ XercesBridgeHelper::replaceData(m_xercesNode, offset, count, arg);
}
@@ -463,5 +401,5 @@
bool
XercesTextBridge::isIgnorableWhitespace() const
{
- return isWhitespace(m_xercesNode.getData());
+ return isXMLWhitespace(getData());
}
1.3 +12 -11 xml-xalan/c/src/XercesParserLiaison/XercesTextBridge.hpp
Index: XercesTextBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesTextBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesTextBridge.hpp 2000/08/10 18:41:39 1.2
+++ XercesTextBridge.hpp 2000/11/02 01:46:44 1.3
@@ -71,6 +71,10 @@
+#include <XercesParserLiaison/XercesDOM_NodeHack.hpp>
+
+
+
class XercesBridgeNavigator;
@@ -90,13 +94,13 @@
/**
* Gets the name of this node.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeName() const;
/**
* Gets the value of this node, depending on its type.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNodeValue() const;
/**
@@ -370,14 +374,14 @@
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getNamespaceURI() const;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getPrefix() const;
/**
@@ -387,7 +391,7 @@
* <code>createElement</code> from the <code>DOM_Document</code> interface,
* it is null.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getLocalName() const;
/**
@@ -428,12 +432,9 @@
virtual unsigned long
getIndex() const;
- virtual XalanDOMString
- getXSLTData() const;
-
//@}
- // These interfaces are inherited from XalanCDATASection...
+ // These interfaces are inherited from XalanText...
/** @name Getter functions. */
//@{
@@ -453,7 +454,7 @@
* fit in a <code>DOMString</code> variable on the implementation
* platform.
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getData() const;
/**
@@ -604,7 +605,7 @@
operator==(const XercesTextBridge& theRHS) const;
// Data members...
- DOM_Text m_xercesNode;
+ XercesDOM_TextHack m_xercesNode;
const XercesBridgeNavigator& m_navigator;
};
1.1 xml-xalan/c/src/XercesParserLiaison/XercesBridgeHelper.cpp
Index: XercesBridgeHelper.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XercesBridgeHelper.hpp"
#include <dom/DOM_CharacterData.hpp>
#include "XercesDOMException.hpp"
void
XercesBridgeHelper::setNodeValue(
DOM_Node& theXercesNode,
const XalanDOMString& nodeValue)
{
try
{
theXercesNode.setNodeValue(XalanDOMStringToXercesDOMString(nodeValue));
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
void
XercesBridgeHelper::normalize(DOM_Node& theXercesNode)
{
try
{
theXercesNode.normalize();
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
bool
XercesBridgeHelper::supports(
const DOM_Node& theXercesNode,
const XalanDOMString& feature,
const XalanDOMString& version)
{
return theXercesNode.supports(
XalanDOMStringToXercesDOMString(feature),
XalanDOMStringToXercesDOMString(version));
}
void
XercesBridgeHelper::setPrefix(
DOM_Node& theXercesNode,
const XalanDOMString& prefix)
{
try
{
theXercesNode.setPrefix(XalanDOMStringToXercesDOMString(prefix));
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
const XalanDOMString
XercesBridgeHelper::substringData(
const DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count)
{
try
{
const DOMString theString(theXercesNode.substringData(offset, count));
return XalanDOMString(theString.rawBuffer(), theString.length());
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
void
XercesBridgeHelper::appendData(
DOM_CharacterData& theXercesNode,
const XalanDOMString& arg)
{
try
{
theXercesNode.appendData(XalanDOMStringToXercesDOMString(arg));
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
void
XercesBridgeHelper::insertData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
const XalanDOMString& arg)
{
try
{
theXercesNode.insertData(offset, XalanDOMStringToXercesDOMString(arg));
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
void
XercesBridgeHelper::deleteData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count)
{
try
{
theXercesNode.deleteData(offset, count);
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
void
XercesBridgeHelper::replaceData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count,
const XalanDOMString& arg)
{
try
{
theXercesNode.replaceData(offset, count, XalanDOMStringToXercesDOMString(arg));
}
catch(const DOM_DOMException& theException)
{
throw XercesDOMException(theException);
}
}
1.1 xml-xalan/c/src/XercesParserLiaison/XercesBridgeHelper.hpp
Index: XercesBridgeHelper.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XERCESBRIDGEHELPER_HEADER_GUARD_1357924680)
#define XERCESBRIDGEHELPER_HEADER_GUARD_1357924680
#include <XercesParserLiaison/XercesParserLiaisonDefinitions.hpp>
#include <cassert>
#include <dom/DOM_Node.hpp>
#include <XalanDOM/XalanDOMString.hpp>
#include <XercesParserLiaison/XercesBridgeNavigator.hpp>
class DOM_CharacterData;
class XALAN_XERCESPARSERLIAISON_EXPORT XercesBridgeHelper
{
public:
#if defined(XALAN_USE_XERCES_DOMSTRING)
static const DOMString&
XalanDOMStringToXercesDOMString(const XalanDOMString& theString)
{
return theString;
}
#else
static const DOMString
XalanDOMStringToXercesDOMString(const XalanDOMString& theString)
{
return DOMString(&theString[0], theString.length());
}
#endif
static void
setNodeValue(
DOM_Node& theXercesNode,
const XalanDOMString& nodeValue);
static void
normalize(DOM_Node& theXercesNode);
static bool
supports(
const DOM_Node& theXercesNode,
const XalanDOMString& feature,
const XalanDOMString& version);
static void
setPrefix(
DOM_Node& theXercesNode,
const XalanDOMString& prefix);
static const XalanDOMString
substringData(
const DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count);
static void
appendData(
DOM_CharacterData& theXercesNode,
const XalanDOMString& arg);
static void
insertData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
const XalanDOMString& arg);
static void
deleteData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count);
static void
replaceData(
DOM_CharacterData& theXercesNode,
unsigned int offset,
unsigned int count,
const XalanDOMString& arg);
private:
// Not implemented...
XercesBridgeHelper();
XercesBridgeHelper(const XercesBridgeHelper&);
};
#endif // !defined(XERCESBRIDGEHELPER_HEADER_GUARD_1357924680)