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/09/05 04:24:57 UTC
cvs commit: xml-xalan/c/src/XercesPlatformSupport XercesDOMPrintWriter.cpp XercesTextOutputStream.cpp
dbertoni 00/09/04 19:24:57
Modified: c/src/DOMSupport DOMServices.cpp DOMServices.hpp
DOMSupportDefault.cpp NamespaceResolver.cpp
c/src/ICUBridge FunctionICUFormatNumber.cpp
c/src/PlatformSupport DOMStringHelper.cpp
DOMStringHelper.hpp DOMStringPrintWriter.cpp
DoubleSupport.cpp NamedNodeMapAttributeList.cpp
NamedNodeMapAttributeList.hpp
PlatformSupportInit.cpp PrintWriter.cpp
PrintWriter.hpp URISupport.cpp URISupport.hpp
XalanDecimalFormatSymbols.cpp XalanNumberFormat.cpp
XalanNumberFormat.hpp
c/src/TestXPath TestXPath.cpp
c/src/TestXSLT process.cpp
c/src/XMLSupport FormatterToDOM.cpp FormatterToDOM.hpp
FormatterToHTML.cpp FormatterToXML.cpp
FormatterToXML.hpp XMLSupportInit.cpp
c/src/XPath FunctionLang.hpp FunctionNormalize.hpp QName.cpp
XLocator.hpp XPathEnvSupportDefault.cpp
XPathProcessorImpl.cpp XPathProcessorImpl.hpp
c/src/XSLT AVT.cpp Constants.cpp Constants.hpp
ElemAttribute.cpp ElemElement.cpp
ElemLiteralResult.cpp ElemNumber.cpp
ElemTemplateElement.cpp ElemTextLiteral.cpp
ElemValueOf.cpp FunctionDocument.cpp
FunctionElementAvailable.cpp
FunctionFunctionAvailable.cpp
FunctionSystemProperty.cpp NamespacesHandler.cpp
NamespacesHandler.hpp Stylesheet.cpp
StylesheetExecutionContextDefault.cpp
StylesheetHandler.cpp StylesheetRoot.cpp
TraceListenerDefault.cpp XSLTEngineImpl.cpp
XSLTEngineImpl.hpp XSLTInit.cpp
c/src/XercesParserLiaison XercesDOMSupport.cpp
XercesParserLiaison.cpp
c/src/XercesPlatformSupport XercesDOMPrintWriter.cpp
XercesTextOutputStream.cpp
Added: c/src/PlatformSupport XalanUnicode.hpp
Log:
Replaced embedded character constants with Unicode symbolic constants. Replaced many dynamically transcoded string with statically transcoded ones.
Revision Changes Path
1.16 +16 -3 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DOMServices.cpp 2000/08/31 19:42:47 1.15
+++ DOMServices.cpp 2000/09/05 02:24:43 1.16
@@ -74,6 +74,10 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
+
+
+
#include "DOMSupportException.hpp"
@@ -85,12 +89,15 @@
static XalanDOMString s_XMLNamespaceURI;
static XalanDOMString s_XMLNamespace;
static XalanDOMString s_XMLNamespaceWithSeparator;
+static XalanDOMString s_XMLNamespaceSeparatorString;
+
const XalanDOMString& DOMServices::s_XMLString = ::s_XMLString;
const XalanDOMString& DOMServices::s_XMLNamespaceURI = ::s_XMLNamespaceURI;
const XalanDOMString& DOMServices::s_XMLNamespace = ::s_XMLNamespace;
const XalanDOMString& DOMServices::s_XMLNamespaceWithSeparator = ::s_XMLNamespaceWithSeparator;
+const XalanDOMString& DOMServices::s_XMLNamespaceSeparatorString = ::s_XMLNamespaceSeparatorString;
@@ -101,11 +108,15 @@
static unsigned int s_XMLNamespaceURILength = 0;
static unsigned int s_XMLNamespaceLength = 0;
static unsigned int s_XMLNamespaceWithSeparatorLength = 0;
+static unsigned int s_XMLNamespaceSeparatorStringLength = 0;
+
+
const unsigned int& DOMServices::s_XMLStringLength = ::s_XMLStringLength;
const unsigned int& DOMServices::s_XMLNamespaceURILength = ::s_XMLNamespaceURILength;
const unsigned int& DOMServices::s_XMLNamespaceLength = ::s_XMLNamespaceLength;
const unsigned int& DOMServices::s_XMLNamespaceWithSeparatorLength = ::s_XMLNamespaceWithSeparatorLength;
+const unsigned int& DOMServices::s_XMLNamespaceSeparatorStringLength = ::s_XMLNamespaceSeparatorStringLength;
@@ -146,7 +157,7 @@
{
const XalanDOMChar theChar = charAt(theData, i);
- if (!(theChar == 0x20 || theChar == 0xD || theChar == 0xA || theChar == 0x9))
+ if (!isSpace(theChar))
{
break;
}
@@ -164,11 +175,13 @@
::s_XMLNamespaceURI = XALAN_STATIC_UCODE_STRING("http://www.w3.org/XML/1998/namespace");
::s_XMLNamespace = XALAN_STATIC_UCODE_STRING("xmlns");
::s_XMLNamespaceWithSeparator = XALAN_STATIC_UCODE_STRING("xmlns:");
+ ::s_XMLNamespaceSeparatorString = XALAN_STATIC_UCODE_STRING(":");
::s_XMLStringLength = length(DOMServices::s_XMLString);
::s_XMLNamespaceURILength = length(DOMServices::s_XMLNamespaceURI);
::s_XMLNamespaceLength = length(DOMServices::s_XMLNamespace);
::s_XMLNamespaceWithSeparatorLength = length(DOMServices::s_XMLNamespaceWithSeparator);
+ ::s_XMLNamespaceSeparatorStringLength = length(DOMServices::s_XMLNamespaceSeparatorString);
}
@@ -407,7 +420,7 @@
{
const XalanDOMString qname = n.getNodeName();
- const unsigned int index = indexOf(qname, ':');
+ const unsigned int index = indexOf(qname, XalanUnicode::charColon);
return index == length(qname) ? qname : substring(qname, index + 1);
}
@@ -592,7 +605,7 @@
{
// slightly inefficient for default decl.
const unsigned int index = indexOf(aname,
- ':');
+ XalanUnicode::charColon);
const XalanDOMString p = (isPrefix)
? substring(aname,index + 1,len)
1.13 +3 -0 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DOMServices.hpp 2000/08/31 19:42:48 1.12
+++ DOMServices.hpp 2000/09/05 02:24:43 1.13
@@ -91,11 +91,14 @@
static const XalanDOMString& s_XMLNamespaceURI;
static const XalanDOMString& s_XMLNamespace;
static const XalanDOMString& s_XMLNamespaceWithSeparator;
+ static const XalanDOMString& s_XMLNamespaceSeparatorString;
static const unsigned int& s_XMLStringLength;
static const unsigned int& s_XMLNamespaceURILength;
static const unsigned int& s_XMLNamespaceLength;
static const unsigned int& s_XMLNamespaceWithSeparatorLength;
+ static const unsigned int& s_XMLNamespaceSeparatorStringLength;
+
class XALAN_DOMSUPPORT_EXPORT WhitespaceSupport
{
1.5 +2 -2 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOMSupportDefault.cpp 2000/04/11 14:30:44 1.4
+++ DOMSupportDefault.cpp 2000/09/05 02:24:43 1.5
@@ -110,7 +110,7 @@
{
const XalanDOMString theNamespace = getNamespaceOfNode(elem);
- return (0 != length(theNamespace)) ? theNamespace + XALAN_STATIC_UCODE_STRING(":") + DOMServices::getLocalNameOfNode(elem)
+ return (0 != length(theNamespace)) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + DOMServices::getLocalNameOfNode(elem)
: DOMServices::getLocalNameOfNode(elem);
}
@@ -121,6 +121,6 @@
{
const XalanDOMString theNamespace = getNamespaceOfNode(attr);
- return (0 != length(theNamespace)) ? theNamespace + XALAN_STATIC_UCODE_STRING(":") + DOMServices::getLocalNameOfNode(attr)
+ return (0 != length(theNamespace)) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + DOMServices::getLocalNameOfNode(attr)
: DOMServices::getLocalNameOfNode(attr);
}
1.11 +6 -2 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NamespaceResolver.cpp 2000/07/02 02:40:50 1.10
+++ NamespaceResolver.cpp 2000/09/05 02:24:43 1.11
@@ -67,6 +67,10 @@
+#include <PlatformSupport/XalanUnicode.hpp>
+
+
+
#include "DOMServices.hpp"
@@ -176,7 +180,7 @@
{
XalanDOMString nodeName = theLocalNode->getNodeName();
- unsigned int indexOfNSSep = indexOf(nodeName, ':');
+ unsigned int indexOfNSSep = indexOf(nodeName, XalanUnicode::charColon);
XalanDOMString prefix;
@@ -253,7 +257,7 @@
const XalanDOMString aname = attr->getNodeName();
// Quick test of first character, to reduce cost of startsWith.
- if(charAt(aname, 0) == 'x')
+ if(charAt(aname, 0) == charAt(DOMServices::s_XMLNamespaceWithSeparator, 0))
{
// "xmlns:"* prefix declaration?
bool isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
1.4 +4 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionICUFormatNumber.cpp 2000/08/04 21:18:10 1.3
+++ FunctionICUFormatNumber.cpp 2000/09/05 02:24:44 1.4
@@ -83,7 +83,10 @@
FunctionICUFormatNumber::FunctionICUFormatNumberInstaller::~FunctionICUFormatNumberInstaller()
{
- XPath::uninstallFunction(XALAN_STATIC_UCODE_STRING("format-number"));
+ // Reinstall the standard function to overwrite the ICU version...
+ XPath::installFunction(
+ XALAN_STATIC_UCODE_STRING("format-number"),
+ FunctionFormatNumber());
}
1.32 +92 -50 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.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- DOMStringHelper.cpp 2000/08/22 20:18:50 1.31
+++ DOMStringHelper.cpp 2000/09/05 02:24:44 1.32
@@ -76,6 +76,7 @@
using std::back_inserter;
using std::copy;
using std::hex;
+using std::ios;
using std::istrstream;
using std::ostream;
using std::ostrstream;
@@ -99,25 +100,21 @@
#include "STLHelper.hpp"
#include "TextOutputStream.hpp"
#include "XalanAutoPtr.hpp"
+#include "XalanUnicode.hpp"
// The maximum number of digits that sprintf can put in a buffer.
-// 50 for now. We're using this because we want to avoid transcoding
+// 100 for now. We're using this because we want to avoid transcoding
// number strings when we don't have to,
-const size_t MAX_PRINTF_DIGITS = 50;
+const size_t MAX_PRINTF_DIGITS = 100;
#if !defined(XALAN_LSTRSUPPORT)
-// This string is defined just to make sure that
-// _something_ trips the initialization code
-// before main() is entered.
-const XalanDOMString theDummy(XALAN_STATIC_UCODE_STRING("dummy"));
-
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(const XalanDOMString)
initializeAndTranscode(const char* theString)
{
@@ -137,6 +134,42 @@
+static XalanDOMString theNaNString;
+
+static XalanDOMString theNegativeInfinityString;
+
+static XalanDOMString thePositiveInfinityString;
+
+
+
+/**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
+DOMStringHelperInitialize()
+{
+ theNaNString = XALAN_STATIC_UCODE_STRING("NaN");
+ theNegativeInfinityString = XALAN_STATIC_UCODE_STRING("-Infinity");
+ thePositiveInfinityString = XALAN_STATIC_UCODE_STRING("Infinity");
+}
+
+
+
+/**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
+DOMStringHelperTerminate()
+{
+ clear(theNaNString);
+ clear(theNegativeInfinityString);
+ clear(thePositiveInfinityString);
+}
+
+
+
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(unsigned int)
indexOf(
const XalanDOMChar* theString,
@@ -908,16 +941,16 @@
-static void
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
CopyWideStringToVector(
const XalanDOMChar* theString,
- vector<char>& theVector)
+ CharVectorType& theVector)
{
const unsigned int theLength = length(theString);
if (theLength != 0)
{
- theVector.reserve(theLength + 1);
+ theVector.reserve(theVector.size() + theLength + 1);
for(unsigned int i = 0; i < theLength; i++)
{
@@ -959,7 +992,7 @@
{
long theResult = 0;
- vector<char> theVector;
+ CharVectorType theVector;
CopyWideStringToVector(theString,
theVector);
@@ -979,7 +1012,7 @@
{
unsigned long theResult = 0;
- vector<char> theVector;
+ CharVectorType theVector;
CopyWideStringToVector(theString,
theVector);
@@ -1036,15 +1069,15 @@
{
if (DoubleSupport::isNaN(theDouble) == true)
{
- return XALAN_STATIC_UCODE_STRING("NaN");
+ return theNaNString;
}
else if (DoubleSupport::isPositiveInfinity(theDouble) == true)
{
- return XALAN_STATIC_UCODE_STRING("Infinity");
+ return thePositiveInfinityString;
}
else if (DoubleSupport::isNegativeInfinity(theDouble) == true)
{
- return XALAN_STATIC_UCODE_STRING("-Infinity");
+ return theNegativeInfinityString;
}
else
{
@@ -1056,48 +1089,59 @@
double fracPart = fabs(modf(theDouble, &intPart));
- if (fracPart == 0)
- {
- return LongToDOMString(long(theDouble));
- }
- else
- {
- char theBuffer[MAX_PRINTF_DIGITS + 1];
+ char theBuffer[MAX_PRINTF_DIGITS + 1];
- ostrstream theFormatter(theBuffer, sizeof(theBuffer));
+#if 1
+ sprintf(theBuffer, "%f", theDouble);
+#else
+ ostrstream theFormatter(theBuffer, sizeof(theBuffer));
+
+ // Ensure that we get fixed point results, and that there's enough precision.
+ theFormatter.flags((theFormatter.flags() & ~ios::scientific) | ios::fixed);
- theFormatter << theDouble << '\0';
+ theFormatter.precision(20);
- // OK, now we have to clean up the output for
- // the XPath standard, which says no trailing
- // '0's for the decimal portion. So start with
- // the last digit, and replace any '0's with the
- // null character. We know at this point that
- // we have at least 1 digit before the decimal
- // point, and and least 1 non-zero digit after
- // the decimal point, since any values with no
- // fractional part were printed as integers
- XalanDOMCharVectorType theResult =
+ theFormatter << theDouble << '\0';
+#endif
+ // OK, now we have to clean up the output for
+ // the XPath standard, which says no trailing
+ // '0's for the decimal portion. So start with
+ // the last digit, and replace any '0's with the
+ // null character. We know at this point that
+ // we have at least 1 digit before the decimal
+ // point, and and least 1 non-zero digit after
+ // the decimal point, since any values with no
+ // fractional part were printed as integers
+ XalanDOMCharVectorType theResult =
+#if defined(XALAN_NON_ASCII_PLATFORM)
+ MakeXalanDOMCharVector(theBuffer, true);
+#else
MakeXalanDOMCharVector(theBuffer, false);
+#endif
- XalanDOMCharVectorType::iterator thePosition = theResult.end();
+ XalanDOMCharVectorType::iterator thePosition = theResult.end();
- // Move to the terminating null byte...
- --thePosition;
+ // Move to the terminating null byte...
+ --thePosition;
- // Now, move back while there are zeros.
- while(*--thePosition == '0')
- {
- }
+ // Now, move back while there are zeros.
+ while(*--thePosition == XalanUnicode::charDigit_0)
+ {
+ }
+ // If there's no fractional part, make sure we get rid
+ // of the decimal point...
+ if (fracPart != 0 ||
+ *thePosition != XalanUnicode::charFullStop)
+ {
// Move up one, since we need to keep at least one...
++thePosition;
-
- // Terminate it...
- *thePosition = 0;
-
- return XalanDOMString(theResult.begin());
}
+
+ // Terminate it...
+ *thePosition = 0;
+
+ return XalanDOMString(theResult.begin());
}
}
@@ -1229,10 +1273,8 @@
// Next spot...
--thePointer;
- // Isolate the left most character. We may need to
- // change this to a switch statement on platforms
- // that are not ASCII-based (i.e. EBCDIC)
- *thePointer = wchar_t(theUnsignedLong % 10 + '0');
+ // Isolate the left most character.
+ *thePointer = wchar_t(theUnsignedLong % 10 + XalanUnicode::charDigit_0);
// OK, we're done with it...
theUnsignedLong /= 10;
1.28 +39 -5 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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- DOMStringHelper.hpp 2000/08/15 17:43:22 1.27
+++ DOMStringHelper.hpp 2000/09/05 02:24:45 1.28
@@ -89,6 +89,10 @@
+#include <PlatformSupport/XalanUnicode.hpp>
+
+
+
class TextOutputStream;
@@ -115,7 +119,26 @@
#endif
+
+/**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
+DOMStringHelperInitialize();
+
+
+
/**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
+DOMStringHelperTerminate();
+
+
+
+/**
* Reserve some space in the string for more efficient
* concatenation...
*
@@ -742,11 +765,11 @@
inline bool
isSpace(XalanDOMChar theChar)
{
- return theChar > 0x20 ? false :
- (theChar == 0x20 ||
- theChar == 0xD ||
- theChar == 0xA ||
- theChar == 0x9) ? true : false;
+ return theChar > XalanUnicode::charSpace ? false :
+ (theChar == XalanUnicode::charSpace ||
+ theChar == XalanUnicode::charCR ||
+ theChar == XalanUnicode::charLF ||
+ theChar == XalanUnicode::charHTab) ? true : false;
}
@@ -1203,9 +1226,20 @@
// A standard vector of XalanChars
#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
+
+
+
+XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
+CopyWideStringToVector(
+ const XalanDOMChar* theString,
+ CharVectorType& theVector);
1.6 +3 -3 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DOMStringPrintWriter.cpp 2000/08/28 01:14:40 1.5
+++ DOMStringPrintWriter.cpp 2000/09/05 02:24:45 1.6
@@ -192,11 +192,11 @@
{
if (b == true)
{
- print(XALAN_STATIC_UCODE_STRING("true"));
+ print(s_trueString);
}
else
{
- print(XALAN_STATIC_UCODE_STRING("false"));
+ print(s_falseString);
}
}
#endif
@@ -270,7 +270,7 @@
void
DOMStringPrintWriter::println()
{
- m_outputString += XALAN_STATIC_UCODE_STRING("\n");
+ m_outputString += s_newlineString;
}
1.11 +167 -29 xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp
Index: DoubleSupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DoubleSupport.cpp 2000/08/15 19:41:10 1.10
+++ DoubleSupport.cpp 2000/09/05 02:24:45 1.11
@@ -69,7 +69,9 @@
#endif
+
#include "DOMStringHelper.hpp"
+#include "XalanUnicode.hpp"
@@ -342,13 +344,10 @@
void
-processWhitespace(const XalanDOMChar*& theString)
+consumeWhitespace(const XalanDOMChar*& theString)
{
while(*theString != 0 &&
- (*theString == 0x20 ||
- *theString == 0xD ||
- *theString == 0xA ||
- *theString == 0x9))
+ isSpace(*theString))
{
++theString;
}
@@ -356,6 +355,139 @@
+#if 1
+
+void
+consumeNumbers(const XalanDOMChar*& theString)
+{
+ while(*theString &&
+ *theString >= XalanUnicode::charDigit_0 &&
+ *theString <= XalanUnicode::charDigit_9)
+ {
+ ++theString;
+ }
+}
+
+
+
+double
+doConvert(const XalanDOMChar* theString)
+{
+ assert(theString != 0);
+ assert(*theString != 0);
+
+ double theResult = 0.0;
+
+ bool fError = false;
+ bool fGotDecimalPoint = false;
+ bool fGotDigit = false;
+ bool fGotMinus = false;
+ bool fGotWhitespace = false;
+
+ const XalanDOMChar* theCurrent = theString;
+
+ // trim any whitespace
+ consumeWhitespace(theCurrent);
+
+ while(*theCurrent != 0 && fError == false)
+ {
+ switch(*theCurrent)
+ {
+ case XalanUnicode::charFullStop:
+ if (fGotDecimalPoint == true || // can't have more than one...
+ fGotWhitespace == true) // can't have one after whitespace...
+ {
+ fError = true;
+ }
+ else
+ {
+ fGotDecimalPoint = true;
+
+ ++theCurrent;
+ }
+ break;
+
+ case XalanUnicode::charHyphenMinus:
+ if (fGotDecimalPoint == true ||
+ fGotMinus == true ||
+ fGotDigit == true ||
+ fGotWhitespace == true)
+ {
+ // Error -- more than one, or in bad position.
+ fError = true;
+ }
+ else
+ {
+ fGotMinus = true;
+
+ ++theCurrent;
+ }
+ break;
+
+ case XalanUnicode::charDigit_0:
+ case XalanUnicode::charDigit_1:
+ case XalanUnicode::charDigit_2:
+ case XalanUnicode::charDigit_3:
+ case XalanUnicode::charDigit_4:
+ case XalanUnicode::charDigit_5:
+ case XalanUnicode::charDigit_6:
+ case XalanUnicode::charDigit_7:
+ case XalanUnicode::charDigit_8:
+ case XalanUnicode::charDigit_9:
+ if (fGotWhitespace == true)
+ {
+ fError = true;
+ }
+ else
+ {
+ fGotDigit = true;
+
+ consumeNumbers(theCurrent);
+ }
+ break;
+
+ case XalanUnicode::charSpace:
+ case XalanUnicode::charCR:
+ case XalanUnicode::charHTab:
+ case XalanUnicode::charLF:
+ if (fGotWhitespace == true)
+ {
+ fError = true;
+ }
+ else
+ {
+ fGotWhitespace = true;
+
+ consumeWhitespace(theCurrent);
+ }
+ break;
+
+ default:
+ fError = true;
+ break;
+ }
+ }
+
+ if (fError == true || fGotDigit == false)
+ {
+ return DoubleSupport::getNaN();
+ }
+ else
+ {
+ CharVectorType theVector;
+
+ CopyWideStringToVector(theString, theVector);
+
+ return atof(&theVector.front());
+ }
+}
+
+#else
+
+// This version is disabled because it turns out that
+// an unsigned long is not large enough to accumulate
+// all values (duh!). Perhaps on 64-bit platforms, we
+// can use this code, as it's much faster.
void
accumulateNumbers(
const XalanDOMChar*& theString,
@@ -369,12 +501,14 @@
// accumulate as an integer, to avoid
// rounding issues. It's also much
// faster...
- unsigned long temp = 0;
+ double temp = 0;
- while(*theString && *theString >= '0' && *theString <= '9')
+ while(*theString &&
+ *theString >= XalanUnicode::charDigit_0 &&
+ *theString <= XalanUnicode::charDigit_9)
{
temp *= 10;
- temp += char(*theString) - '0';
+ temp += char(*theString) - XalanUnicode::charDigit_0;
++theString;
}
@@ -384,19 +518,21 @@
else
{
// Accumulate a divisor, so we can divide at the end.
- unsigned long theDivisor = 1;
+ double theDivisor = 1;
// accumulate as an integer, to avoid
// rounding issues. It's also much
// faster...
unsigned long temp = 0;
- while(*theString && *theString >= '0' && *theString <= '9')
+ while(*theString &&
+ *theString >= XalanUnicode::charDigit_0 &&
+ *theString <= XalanUnicode::charDigit_9)
{
theDivisor *= 10;
temp *= 10;
- temp += char(*theString) - '0';
+ temp += char(*theString) - XalanUnicode::charDigit_0;
++theString;
}
@@ -430,13 +566,13 @@
const XalanDOMChar* theCurrent = theString;
// trim any whitespace
- processWhitespace(theCurrent);
+ consumeWhitespace(theCurrent);
while(*theCurrent != 0 && fError == false)
{
switch(*theCurrent)
{
- case '.':
+ case XalanUnicode::charFullStop:
if (fGotDecimalPoint == true || // can't have more than one...
fGotWhitespace == true) // can't have one after whitespace...
{
@@ -450,7 +586,7 @@
}
break;
- case '-':
+ case XalanUnicode::charHyphenMinus:
if (fGotDecimalPoint == true ||
fGotMinus == true ||
fGotDigit == true ||
@@ -467,16 +603,16 @@
}
break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
+ case XalanUnicode::charDigit_0:
+ case XalanUnicode::charDigit_1:
+ case XalanUnicode::charDigit_2:
+ case XalanUnicode::charDigit_3:
+ case XalanUnicode::charDigit_4:
+ case XalanUnicode::charDigit_5:
+ case XalanUnicode::charDigit_6:
+ case XalanUnicode::charDigit_7:
+ case XalanUnicode::charDigit_8:
+ case XalanUnicode::charDigit_9:
if (fGotWhitespace == true)
{
fError = true;
@@ -489,10 +625,10 @@
}
break;
- case 0x20:
- case 0xD:
- case 0x9:
- case 0xA:
+ case XalanUnicode::charSpace:
+ case XalanUnicode::charCR:
+ case XalanUnicode::charHTab:
+ case XalanUnicode::charLF:
if (fGotWhitespace == true)
{
fError = true;
@@ -501,7 +637,7 @@
{
fGotWhitespace = true;
- processWhitespace(theCurrent);
+ consumeWhitespace(theCurrent);
}
break;
@@ -520,6 +656,8 @@
return fGotMinus == true ? -theResult : theResult;
}
}
+
+#endif
1.9 +28 -5 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NamedNodeMapAttributeList.cpp 2000/08/22 20:18:50 1.8
+++ NamedNodeMapAttributeList.cpp 2000/09/05 02:24:45 1.9
@@ -72,7 +72,6 @@
m_lastIndex(theMap.getLength() - 1),
m_cachedData()
{
- m_cachedData.push_back(XALAN_STATIC_UCODE_STRING("CDATA"));
}
@@ -116,9 +115,9 @@
const XMLCh*
NamedNodeMapAttributeList::getType(const unsigned int /* index */) const
{
- assert(m_cachedData.size() > 0);
+ assert(length(s_typeString) > 0);
- return c_wstr(m_cachedData.front());
+ return c_wstr(s_typeString);
}
@@ -144,9 +143,9 @@
const XMLCh*
NamedNodeMapAttributeList::getType(const XMLCh* const /* name */) const
{
- assert(m_cachedData.size() > 0);
+ assert(length(s_typeString) > 0);
- return c_wstr(m_cachedData.front());
+ return c_wstr(s_typeString);
}
@@ -200,4 +199,28 @@
#else
m_cachedData.push_back(theData);
#endif
+}
+
+
+
+static XalanDOMString s_typeString;
+
+
+
+const XalanDOMString& NamedNodeMapAttributeList::s_typeString = ::s_typeString;
+
+
+
+void
+NamedNodeMapAttributeList::initialize()
+{
+ ::s_typeString = XALAN_STATIC_UCODE_STRING("CDATA");
+}
+
+
+
+void
+NamedNodeMapAttributeList::terminate()
+{
+ clear(::s_typeString);
}
1.5 +17 -0 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp
Index: NamedNodeMapAttributeList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NamedNodeMapAttributeList.hpp 2000/08/22 20:18:51 1.4
+++ NamedNodeMapAttributeList.hpp 2000/09/05 02:24:45 1.5
@@ -84,6 +84,21 @@
{
public:
+ /**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+ static void
+ terminate();
+
+
explicit
NamedNodeMapAttributeList(const XalanNamedNodeMap& theMap);
@@ -138,6 +153,8 @@
#endif
mutable CacheType m_cachedData;
+
+ static const XalanDOMString& s_typeString;
};
1.2 +26 -0 xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp
Index: PlatformSupportInit.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PlatformSupportInit.cpp 2000/08/31 19:42:51 1.1
+++ PlatformSupportInit.cpp 2000/09/05 02:24:45 1.2
@@ -59,6 +59,14 @@
+#include "DOMStringHelper.hpp"
+#include "NamedNodeMapAttributeList.hpp"
+#include "PrintWriter.hpp"
+#include "URISupport.hpp"
+#include "XalanNumberFormat.hpp"
+
+
+
unsigned long PlatformSupportInit::s_initCounter = 0;
@@ -91,6 +99,15 @@
void
PlatformSupportInit::initialize()
{
+ DOMStringHelperInitialize();
+
+ PrintWriter::initialize();
+
+ NamedNodeMapAttributeList::initialize();
+
+ XalanNumberFormat::initialize();
+
+ URISupport::initialize();
}
@@ -98,4 +115,13 @@
void
PlatformSupportInit::terminate()
{
+ URISupport::terminate();
+
+ XalanNumberFormat::terminate();
+
+ NamedNodeMapAttributeList::terminate();
+
+ PrintWriter::terminate();
+
+ DOMStringHelperTerminate();
}
1.2 +44 -0 xml-xalan/c/src/PlatformSupport/PrintWriter.cpp
Index: PrintWriter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/PrintWriter.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PrintWriter.cpp 1999/12/18 19:47:50 1.1
+++ PrintWriter.cpp 2000/09/05 02:24:45 1.2
@@ -59,6 +59,10 @@
+#include "DOMStringHelper.hpp"
+
+
+
PrintWriter::PrintWriter(bool fAutoFlush) :
Writer(),
m_fAutoFlush(fAutoFlush)
@@ -69,4 +73,44 @@
PrintWriter::~PrintWriter()
{
+}
+
+
+
+static XalanDOMString s_trueString;
+
+static XalanDOMString s_falseString;
+
+static XalanDOMString s_newlineString;
+
+
+const XalanDOMString& PrintWriter::s_trueString = ::s_trueString;
+
+const XalanDOMString& PrintWriter::s_falseString = ::s_falseString;
+
+const XalanDOMString& PrintWriter::s_newlineString = ::s_newlineString;
+
+
+
+void
+PrintWriter::initialize()
+{
+ ::s_trueString = XALAN_STATIC_UCODE_STRING("true");
+
+ ::s_falseString = XALAN_STATIC_UCODE_STRING("false");
+
+ // $$$ ToDo: Does this need to be \r\n for some platforms?
+ ::s_newlineString = XALAN_STATIC_UCODE_STRING("\n");
+}
+
+
+
+void
+PrintWriter::terminate()
+{
+ clear(::s_trueString);
+
+ clear(::s_falseString);
+
+ clear(::s_newlineString);
}
1.9 +23 -1 xml-xalan/c/src/PlatformSupport/PrintWriter.hpp
Index: PrintWriter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/PrintWriter.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PrintWriter.hpp 2000/08/15 19:41:11 1.8
+++ PrintWriter.hpp 2000/09/05 02:24:45 1.9
@@ -74,6 +74,21 @@
public:
/**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+ static void
+ terminate();
+
+
+ /**
* Constructor
*
* @param fAutoFlush if true, the output will not be buffered
@@ -186,8 +201,15 @@
println(const XalanDOMString& s) = 0;
protected:
+
+ const bool m_fAutoFlush;
+
+ // Some static strings to help derived classes...
+ static const XalanDOMString& s_trueString;
+
+ static const XalanDOMString& s_falseString;
- const bool m_fAutoFlush;
+ static const XalanDOMString& s_newlineString;
private:
1.8 +51 -8 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- URISupport.cpp 2000/08/22 20:18:52 1.7
+++ URISupport.cpp 2000/09/05 02:24:45 1.8
@@ -68,6 +68,7 @@
#include "STLHelper.hpp"
+#include "XalanUnicode.hpp"
@@ -87,6 +88,9 @@
return url;
}
+
+
+
XalanDOMString
URISupport::getURLStringFromString(const XalanDOMString& urlString)
{
@@ -94,7 +98,7 @@
// Let's see what sort of URI we have...
const unsigned int len = length(theNormalizedURI);
- const unsigned int index = indexOf(theNormalizedURI, ':');
+ const unsigned int index = indexOf(theNormalizedURI, XalanUnicode::charColon);
bool protocolPresent = false;
@@ -125,9 +129,10 @@
NormalizeURIText(theNormalizedURI);
- const XalanDOMString theFilePrefix(indexOf(theNormalizedURI, '/') == 0 ?
- XALAN_STATIC_UCODE_STRING("file://") :
- XALAN_STATIC_UCODE_STRING("file:///"));
+ const XalanDOMString theFilePrefix(
+ indexOf(theNormalizedURI, XalanUnicode::charSolidus) == 0 ?
+ s_fileProtocolString1 :
+ s_fileProtocolString2);
theNormalizedURI = theFilePrefix + theNormalizedURI;
}
@@ -158,7 +163,9 @@
const unsigned int theContextLength = length(context);
- const unsigned int indexOfSlash = theContextLength == 0 ? 0 : lastIndexOf(context, '/');
+ const unsigned int indexOfSlash = theContextLength == 0 ?
+ 0 :
+ lastIndexOf(context, XalanUnicode::charSolidus);
bool hasPath = true;
@@ -175,7 +182,7 @@
// Is there a colon, indicating some sort of drive spec, or protocol?
const unsigned int theURLStringLength = length(urlString);
- const unsigned int theColonIndex = indexOf(urlString, ':');
+ const unsigned int theColonIndex = indexOf(urlString, XalanUnicode::charColon);
if (theColonIndex == theURLStringLength)
{
@@ -248,7 +255,7 @@
// OK, look for a quick, cheap exit...
const unsigned int len = length(uriString);
- const unsigned int index = indexOf(uriString, '\\');
+ const unsigned int index = indexOf(uriString, XalanUnicode::charReverseSolidus);
if (index != len)
{
@@ -257,7 +264,11 @@
// Start replacing at the index point, since that's the
// first one...
- replace(theVector.begin(), theVector.end(), '\\', '/');
+ replace(
+ theVector.begin(),
+ theVector.end(),
+ XalanUnicode::charReverseSolidus,
+ XalanUnicode::charSolidus);
uriString = XalanDOMString(&theVector[0]);
}
@@ -277,4 +288,36 @@
URISupport::InvalidURIException::~InvalidURIException()
{
+}
+
+
+
+static XalanDOMString s_fileProtocolString1;
+
+static XalanDOMString s_fileProtocolString2;
+
+
+
+const XalanDOMString& URISupport::s_fileProtocolString1 = ::s_fileProtocolString1;
+
+const XalanDOMString& URISupport::s_fileProtocolString2 = ::s_fileProtocolString2;
+
+
+
+void
+URISupport::initialize()
+{
+ ::s_fileProtocolString1 = XALAN_STATIC_UCODE_STRING("file://");
+
+ ::s_fileProtocolString2 = XALAN_STATIC_UCODE_STRING("file:///");
+}
+
+
+
+void
+URISupport::terminate()
+{
+ clear(::s_fileProtocolString1);
+
+ clear(::s_fileProtocolString2);
}
1.4 +20 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- URISupport.hpp 2000/08/22 20:18:53 1.3
+++ URISupport.hpp 2000/09/05 02:24:45 1.4
@@ -84,6 +84,21 @@
typedef XalanAutoPtr<XMLURL> URLAutoPtrType;
/**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+ static void
+ terminate();
+
+
+ /**
* Determine the fully qualified URI for a string.
*
* @param urlString string to qualify
@@ -150,6 +165,11 @@
virtual
~InvalidURIException();
};
+
+
+ static const XalanDOMString& s_fileProtocolString1;
+
+ static const XalanDOMString& s_fileProtocolString2;
};
1.2 +10 -8 xml-xalan/c/src/PlatformSupport/XalanDecimalFormatSymbols.cpp
Index: XalanDecimalFormatSymbols.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanDecimalFormatSymbols.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanDecimalFormatSymbols.cpp 2000/05/08 17:17:05 1.1
+++ XalanDecimalFormatSymbols.cpp 2000/09/05 02:24:45 1.2
@@ -56,27 +56,29 @@
*/
#include "XalanDecimalFormatSymbols.hpp"
#include "DOMStringHelper.hpp"
+#include "XalanUnicode.hpp"
static XalanDOMChar theNaNDefault[] = { 0xFFFD, 0 };
static XalanDOMChar theInfinityDefault[] = { 0x221E, 0 };
+static XalanDOMChar theCurrencySymbol[] = { XalanUnicode::charDollarSign, 0 };
XalanDecimalFormatSymbols::XalanDecimalFormatSymbols() :
- m_currencySymbol(XALAN_STATIC_UCODE_STRING("$")),
- m_decimalSeparator('.'),
+ m_currencySymbol(theCurrencySymbol),
+ m_decimalSeparator(XalanUnicode::charFullStop),
m_digit(0),
- m_groupingSeparator(','),
+ m_groupingSeparator(XalanUnicode::charComma),
m_infinity(theInfinityDefault),
m_internationalCurrencySymbol(),
- m_minusSign('-'),
- m_monetaryDecimalSeparator('.'),
+ m_minusSign(XalanUnicode::charHyphenMinus),
+ m_monetaryDecimalSeparator(XalanUnicode::charFullStop),
m_NaN(theNaNDefault),
- m_patternSeparator(';'),
- m_percent('%'),
+ m_patternSeparator(XalanUnicode::charSemicolon),
+ m_percent(XalanUnicode::charPercentSign),
m_perMill(0),
- m_zeroDigit('0')
+ m_zeroDigit(XalanUnicode::charDigit_0)
{
}
1.5 +25 -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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanNumberFormat.cpp 2000/08/22 20:18:53 1.4
+++ XalanNumberFormat.cpp 2000/09/05 02:24:45 1.5
@@ -66,7 +66,7 @@
XalanNumberFormat::XalanNumberFormat() :
m_isGroupingUsed(false),
- m_groupingSeparator(XALAN_STATIC_UCODE_STRING(",")),
+ m_groupingSeparator(s_defaultGroupingSeparator),
m_groupingSize(3) // Default to US values
{
}
@@ -195,4 +195,28 @@
XalanNumberFormat::setGroupingSeparator(const XalanDOMString& s)
{
m_groupingSeparator = s;
+}
+
+
+
+static XalanDOMString s_defaultGroupingSeparator;
+
+
+
+const XalanDOMString& XalanNumberFormat::s_defaultGroupingSeparator = ::s_defaultGroupingSeparator;
+
+
+
+void
+XalanNumberFormat::initialize()
+{
+ ::s_defaultGroupingSeparator = XALAN_STATIC_UCODE_STRING(",");
+}
+
+
+
+void
+XalanNumberFormat::terminate()
+{
+ clear(::s_defaultGroupingSeparator);
}
1.2 +20 -3 xml-xalan/c/src/PlatformSupport/XalanNumberFormat.hpp
Index: XalanNumberFormat.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanNumberFormat.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanNumberFormat.hpp 2000/05/08 17:17:05 1.1
+++ XalanNumberFormat.hpp 2000/09/05 02:24:45 1.2
@@ -72,6 +72,21 @@
{
public:
+ /**
+ * Initialize static data. Must be called before any
+ * other functions are called. See PlatformSupportInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Destroy static data. After thus function is called,
+ * no other functions can be called. See PlatformSupportInit.
+ */
+ static void
+ terminate();
+
+
explicit
XalanNumberFormat();
@@ -172,11 +187,13 @@
operator==(const XalanNumberFormat&);
// Data members...
- bool m_isGroupingUsed;
+ bool m_isGroupingUsed;
+
+ XalanDOMString m_groupingSeparator;
- XalanDOMString m_groupingSeparator;
+ int m_groupingSize;
- int m_groupingSize;
+ static const XalanDOMString& s_defaultGroupingSeparator;
};
1.1 xml-xalan/c/src/PlatformSupport/XalanUnicode.hpp
Index: XalanUnicode.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 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(XALANUNICODE_HEADER_GUARD_1357924680)
#define XALANUNICODE_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <PlatformSupport/PlatformSupportDefinitions.hpp>
#include <XalanDOM/XalanDOMString.hpp>
#if defined(XALAN_NO_NAMESPACES)
struct XALAN_PLATFORMSUPPORT_EXPORT XalanUnicode
#else
namespace XalanUnicode
#endif
{
#if defined(XALAN_NO_NAMESPACES)
enum
{
charHTab = 0x09,
charLF = 0x0A,
charCR = 0x0D,
charSpace = 0x20,
charExclamationMark = 0x21,
charQuoteMark = 0x22,
charNumberSign = 0x23,
charDollarSign = 0x24,
charPercentSign = 0x25,
charAmpersand = 0x26,
charApostrophe = 0x27,
charLeftParenthesis = 0x28,
charRightParenthesis = 0x29,
charAsterisk = 0x2A,
charPlusSign = 0x2B,
charComma = 0x2C,
charHyphenMinus = 0x2D,
charFullStop = 0x2E,
charSolidus = 0x2F,
charDigit_0 = 0x30,
charDigit_1 = 0x31,
charDigit_2 = 0x32,
charDigit_3 = 0x33,
charDigit_4 = 0x34,
charDigit_5 = 0x35,
charDigit_6 = 0x36,
charDigit_7 = 0x37,
charDigit_8 = 0x38,
charDigit_9 = 0x39,
charColon = 0x3A,
charSemicolon = 0x3B,
charLessThanSign = 0x3C,
charEqualsSign = 0x3D,
charGreaterThanSign = 0x3E,
charQuestionMark = 0x3F,
charCommercialAt = 0x40,
charLetter_A = 0x41,
charLetter_B = 0x42,
charLetter_C = 0x43,
charLetter_D = 0x44,
charLetter_E = 0x45,
charLetter_F = 0x46,
charLetter_G = 0x47,
charLetter_H = 0x48,
charLetter_I = 0x49,
charLetter_J = 0x4A,
charLetter_K = 0x4B,
charLetter_L = 0x4C,
charLetter_M = 0x4D,
charLetter_N = 0x4E,
charLetter_O = 0x4F,
charLetter_P = 0x50,
charLetter_Q = 0x51,
charLetter_R = 0x52,
charLetter_S = 0x53,
charLetter_T = 0x54,
charLetter_U = 0x55,
charLetter_V = 0x56,
charLetter_W = 0x57,
charLetter_X = 0x58,
charLetter_Y = 0x59,
charLetter_Z = 0x5A,
charLeftSquareBracket = 0x5B,
charReverseSolidus = 0x5C,
charRightSquareBracket = 0x5D,
charCircumflexAccent = 0x5E,
charLowLine = 0x5F,
charLetter_a = 0x61,
charLetter_f = 0x66,
charLetter_g = 0x67,
charLetter_i = 0x69,
charLetter_l = 0x6C,
charLetter_m = 0x6D,
charLetter_n = 0x6E,
charLetter_o = 0x6F,
charLetter_p = 0x70,
charLetter_q = 0x71,
charLetter_s = 0x73,
charLetter_t = 0x74,
charLetter_u = 0x75,
charLeftCurlyBracket = 0x7B,
charVerticalLine = 0x7C,
charRightCurlyBracket = 0x7D
};
#else
static const XalanDOMChar charHTab = 0x09;
static const XalanDOMChar charLF = 0x0A;
static const XalanDOMChar charCR = 0x0D;
static const XalanDOMChar charSpace = 0x20;
static const XalanDOMChar charExclamationMark = 0x21;
static const XalanDOMChar charQuoteMark = 0x22;
static const XalanDOMChar charNumberSign = 0x23;
static const XalanDOMChar charDollarSign = 0x24;
static const XalanDOMChar charPercentSign = 0x25;
static const XalanDOMChar charAmpersand = 0x26;
static const XalanDOMChar charApostrophe = 0x27;
static const XalanDOMChar charLeftParenthesis = 0x28;
static const XalanDOMChar charRightParenthesis = 0x29;
static const XalanDOMChar charAsterisk = 0x2A;
static const XalanDOMChar charPlusSign = 0x2B;
static const XalanDOMChar charComma = 0x2C;
static const XalanDOMChar charHyphenMinus = 0x2D;
static const XalanDOMChar charFullStop = 0x2E;
static const XalanDOMChar charSolidus = 0x2F;
static const XalanDOMChar charDigit_0 = 0x30;
static const XalanDOMChar charDigit_1 = 0x31;
static const XalanDOMChar charDigit_2 = 0x32;
static const XalanDOMChar charDigit_3 = 0x33;
static const XalanDOMChar charDigit_4 = 0x34;
static const XalanDOMChar charDigit_5 = 0x35;
static const XalanDOMChar charDigit_6 = 0x36;
static const XalanDOMChar charDigit_7 = 0x37;
static const XalanDOMChar charDigit_8 = 0x38;
static const XalanDOMChar charDigit_9 = 0x39;
static const XalanDOMChar charColon = 0x3A;
static const XalanDOMChar charSemicolon = 0x3B;
static const XalanDOMChar charLessThanSign = 0x3C;
static const XalanDOMChar charEqualsSign = 0x3D;
static const XalanDOMChar charGreaterThanSign = 0x3E;
static const XalanDOMChar charQuestionMark = 0x3F;
static const XalanDOMChar charCommercialAt = 0x40;
static const XalanDOMChar charLetter_A = 0x41;
static const XalanDOMChar charLetter_B = 0x42;
static const XalanDOMChar charLetter_C = 0x43;
static const XalanDOMChar charLetter_D = 0x44;
static const XalanDOMChar charLetter_E = 0x45;
static const XalanDOMChar charLetter_F = 0x46;
static const XalanDOMChar charLetter_G = 0x47;
static const XalanDOMChar charLetter_H = 0x48;
static const XalanDOMChar charLetter_I = 0x49;
static const XalanDOMChar charLetter_J = 0x4A;
static const XalanDOMChar charLetter_K = 0x4B;
static const XalanDOMChar charLetter_L = 0x4C;
static const XalanDOMChar charLetter_M = 0x4D;
static const XalanDOMChar charLetter_N = 0x4E;
static const XalanDOMChar charLetter_O = 0x4F;
static const XalanDOMChar charLetter_P = 0x50;
static const XalanDOMChar charLetter_Q = 0x51;
static const XalanDOMChar charLetter_R = 0x52;
static const XalanDOMChar charLetter_S = 0x53;
static const XalanDOMChar charLetter_T = 0x54;
static const XalanDOMChar charLetter_U = 0x55;
static const XalanDOMChar charLetter_V = 0x56;
static const XalanDOMChar charLetter_W = 0x57;
static const XalanDOMChar charLetter_X = 0x58;
static const XalanDOMChar charLetter_Y = 0x59;
static const XalanDOMChar charLetter_Z = 0x5A;
static const XalanDOMChar charLeftSquareBracket = 0x5B;
static const XalanDOMChar charReverseSolidus = 0x5C;
static const XalanDOMChar charRightSquareBracket = 0x5D;
static const XalanDOMChar charCircumflexAccent = 0x5E;
static const XalanDOMChar charLowLine = 0x5F;
static const XalanDOMChar charLetter_a = 0x61;
static const XalanDOMChar charLetter_f = 0x66;
static const XalanDOMChar charLetter_g = 0x67;
static const XalanDOMChar charLetter_i = 0x69;
static const XalanDOMChar charLetter_l = 0x6C;
static const XalanDOMChar charLetter_m = 0x6D;
static const XalanDOMChar charLetter_n = 0x6E;
static const XalanDOMChar charLetter_o = 0x6F;
static const XalanDOMChar charLetter_p = 0x70;
static const XalanDOMChar charLetter_q = 0x71;
static const XalanDOMChar charLetter_s = 0x73;
static const XalanDOMChar charLetter_t = 0x74;
static const XalanDOMChar charLetter_u = 0x75;
static const XalanDOMChar charLeftCurlyBracket = 0x7B;
static const XalanDOMChar charVerticalLine = 0x7C;
static const XalanDOMChar charRightCurlyBracket = 0x7D;
#endif
#if defined(XALAN_NO_NAMESPACES)
private:
// Not implemented...
XalanUnicode();
XalanUnicode(const XalanUnicode&);
~XalanUnicode();
XalanUnicode&
operator=(const XalanUnicode&);
#endif
};
#endif // XALANUNICODE_HEADER_GUARD_1357924680
1.19 +2 -1 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TestXPath.cpp 2000/08/31 19:21:44 1.18
+++ TestXPath.cpp 2000/09/05 02:24:47 1.19
@@ -87,6 +87,7 @@
#include <PlatformSupport/DoubleSupport.hpp>
#include <PlatformSupport/DirectoryEnumerator.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -1131,7 +1132,7 @@
for (int i = theLength - 1; i > 0; i--)
{
- if (charAt(theXMLFileName, i) == '.')
+ if (charAt(theXMLFileName, i) == XalanUnicode::charFullStop)
{
thePeriodIndex = i;
1.37 +1 -2 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.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- process.cpp 2000/08/31 21:05:33 1.36
+++ process.cpp 2000/09/05 02:24:48 1.37
@@ -133,14 +133,13 @@
-//#define XALAN_USE_ICU
+#define XALAN_USE_ICU
#if defined(XALAN_USE_ICU)
#include <ICUBridge/ICUBridge.hpp>
#include <ICUBridge/FunctionICUFormatNumber.hpp>
#include <ICUBridge/ICUXalanNumberFormatFactory.hpp>
#include <ICUBridge/ICUBridgeCollationCompareFunctor.hpp>
#endif
-
1.10 +36 -2 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FormatterToDOM.cpp 2000/08/22 20:20:29 1.9
+++ FormatterToDOM.cpp 2000/09/05 02:24:48 1.10
@@ -198,8 +198,10 @@
const XMLCh* const chars,
const unsigned int length)
{
- append(m_doc->createProcessingInstruction(XALAN_STATIC_UCODE_STRING("xslt-next-is-raw"),
- XALAN_STATIC_UCODE_STRING("formatter-to-dom")));
+ append(m_doc->createProcessingInstruction(
+ s_xsltNextIsRawString,
+ s_formatterToDOMString));
+
append(m_doc->createTextNode(XalanDOMString(chars, length)));
}
@@ -275,4 +277,36 @@
{
m_doc->appendChild(newNode);
}
+}
+
+
+
+static XalanDOMString s_xsltNextIsRawString;
+
+static XalanDOMString s_formatterToDOMString;
+
+
+
+const XalanDOMString& FormatterToDOM::s_xsltNextIsRawString = ::s_xsltNextIsRawString;
+
+const XalanDOMString& FormatterToDOM::s_formatterToDOMString = ::s_formatterToDOMString;
+
+
+
+void
+FormatterToDOM::initialize()
+{
+ ::s_xsltNextIsRawString = XALAN_STATIC_UCODE_STRING("xslt-next-is-raw");
+
+ ::s_formatterToDOMString = XALAN_STATIC_UCODE_STRING("formatter-to-dom");
+}
+
+
+
+void
+FormatterToDOM::terminate()
+{
+ clear(::s_xsltNextIsRawString);
+
+ clear(::s_formatterToDOMString);
}
1.10 +25 -4 xml-xalan/c/src/XMLSupport/FormatterToDOM.hpp
Index: FormatterToDOM.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToDOM.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FormatterToDOM.hpp 2000/08/22 20:20:29 1.9
+++ FormatterToDOM.hpp 2000/09/05 02:24:48 1.10
@@ -73,6 +73,10 @@
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class XalanDocument;
class XalanDocumentFragment;
class XalanElement;
@@ -89,6 +93,19 @@
public:
/**
+ * Perform static initialization. See class XMLSupportInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Perform static shut down. See class XMLSupportInit.
+ */
+ static void
+ terminate();
+
+
+ /**
* Construct a FormatterToDOM instance. it will add the DOM nodes
* to the document fragment.
*
@@ -197,19 +214,23 @@
// Data members...
- XalanDocument* m_doc;
+ XalanDocument* m_doc;
- XalanDocumentFragment* m_docFrag;
+ XalanDocumentFragment* m_docFrag;
- XalanElement* m_currentElem;
+ XalanElement* m_currentElem;
#if defined(XALAN_NO_NAMESPACES)
typedef vector<XalanElement*> ElementStackType;
#else
typedef std::vector<XalanElement*> ElementStackType;
#endif
+
+ ElementStackType m_elemStack;
+
+ static const XalanDOMString& s_xsltNextIsRawString;
- ElementStackType m_elemStack;
+ static const XalanDOMString& s_formatterToDOMString;
};
1.24 +89 -79 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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- FormatterToHTML.cpp 2000/08/31 19:42:55 1.23
+++ FormatterToHTML.cpp 2000/09/05 02:24:48 1.24
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
/**
- * $Id: FormatterToHTML.cpp,v 1.23 2000/08/31 19:42:55 dbertoni Exp $
+ * $Id: FormatterToHTML.cpp,v 1.24 2000/09/05 02:24:48 dbertoni Exp $
*
* $State: Exp $
*
@@ -81,6 +81,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/Writer.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -199,19 +200,28 @@
FormatterToHTML::FormatterToHTML(
- Writer& writer,
- const XalanDOMString& encoding,
- const XalanDOMString& mediaType,
- const XalanDOMString& doctypeSystem,
- const XalanDOMString& doctypePublic,
- bool doIndent,
- int indent,
- const XalanDOMString& version,
- const XalanDOMString& standalone,
- bool xmlDecl) :
- FormatterToXML(writer, version, doIndent, indent,
- encoding, mediaType, doctypeSystem, doctypePublic,
- xmlDecl, standalone, OUTPUT_METHOD_HTML),
+ Writer& writer,
+ const XalanDOMString& encoding,
+ const XalanDOMString& mediaType,
+ const XalanDOMString& doctypeSystem,
+ const XalanDOMString& doctypePublic,
+ bool doIndent,
+ int indent,
+ const XalanDOMString& version,
+ const XalanDOMString& standalone,
+ bool xmlDecl) :
+ FormatterToXML(
+ writer,
+ version,
+ doIndent,
+ indent,
+ encoding,
+ mediaType,
+ doctypeSystem,
+ doctypePublic,
+ xmlDecl,
+ standalone,
+ OUTPUT_METHOD_HTML),
m_currentElementName(),
m_inBlockElem(false)
{
@@ -231,9 +241,9 @@
{
FormatterToXML::initAttrCharsMap();
- m_attrCharsMap['\n'] = 'S';
- m_attrCharsMap['<'] = 0;
- m_attrCharsMap['>'] = 0;
+ m_attrCharsMap[XalanUnicode::charLF] = 'S';
+ m_attrCharsMap[XalanUnicode::charLessThanSign] = 0;
+ m_attrCharsMap[XalanUnicode::charGreaterThanSign] = 0;
}
@@ -245,10 +255,10 @@
memset(m_charsMap, 0, sizeof(m_charsMap));
- m_charsMap['\n'] = 'S';
- m_charsMap['<'] = 'S';
- m_charsMap['>'] = 'S';
- m_charsMap['&'] = 'S';
+ m_charsMap[XalanUnicode::charLF] = 'S';
+ m_charsMap[XalanUnicode::charLessThanSign] = 'S';
+ m_charsMap[XalanUnicode::charGreaterThanSign] = 'S';
+ m_charsMap[XalanUnicode::charAmpersand] = 'S';
memset(m_charsMap, 'S', 10);
@@ -308,7 +318,7 @@
{
accum(s_doctypeHeaderPublicString);
accum(m_doctypePublic);
- accum('"');
+ accum(XalanUnicode::charQuoteMark);
}
if(isEmptySystem == false)
@@ -318,14 +328,14 @@
accum(s_doctypeHeaderSystemString);
}
- accum(' ');
- accum('"');
+ accum(XalanUnicode::charSpace);
+ accum(XalanUnicode::charQuoteMark);
accum(m_doctypeSystem);
- accum('"');
+ accum(XalanUnicode::charQuoteMark);
}
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
outputLineSep();
}
@@ -370,7 +380,7 @@
m_currentElementName = nameUpper;
- accum('<');
+ accum(XalanUnicode::charLessThanSign);
accum(name);
@@ -431,10 +441,10 @@
indent(m_currentIndent);
}
- accum('<');
- accum('/');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charSolidus);
accum(name);
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
m_currentElementName = name;
}
@@ -442,21 +452,21 @@
{
if(elemDesc.is(ElemDesc::EMPTY) == false)
{
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
if (shouldIndent == true)
{
indent(m_currentIndent);
}
- accum('<');
- accum('/');
- accum(name);
- accum('>');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charSolidus);
+ accum(name, 0, length(name));
+ accum(XalanUnicode::charGreaterThanSign);
}
else
{
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
}
}
@@ -546,19 +556,19 @@
++i;
}
- else if ('\n' == ch)
+ else if (XalanUnicode::charLF == ch)
{
outputLineSep();
}
- else if ('<' == ch)
+ else if (XalanUnicode::charLessThanSign == ch)
{
pos = copyEntityIntoBuffer(s_ltString, pos);
}
- else if ('>' == ch)
+ else if (XalanUnicode::charGreaterThanSign == ch)
{
pos = copyEntityIntoBuffer(s_gtString, pos);
}
- else if ('&' == ch)
+ else if (XalanUnicode::charAmpersand == ch)
{
pos = copyEntityIntoBuffer(s_ampString, pos);
}
@@ -639,9 +649,9 @@
void
FormatterToHTML::entityReference(const XMLCh* const name)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
accum(name);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
@@ -708,21 +718,21 @@
indent(m_currentIndent);
}
- accum('<');
- accum('?');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charQuestionMark);
accum(target);
if (length(data) > 0)
{
if(isSpace(data[0]) == false)
{
- accum(' ');
+ accum(XalanUnicode::charSpace);
}
accum(data);
}
- accum('>'); // different from XML
+ accum(XalanUnicode::charGreaterThanSign); // different from XML
m_startNewLine = true;
}
@@ -745,9 +755,9 @@
{
accum(ch);
}
- else if('&' == ch &&
+ else if(XalanUnicode::charAmpersand == ch &&
i + 1 < strLen &&
- '{' == string[i + 1])
+ XalanUnicode::charLeftCurlyBracket == string[i + 1])
{
accum(ch); // no escaping in this case, as specified in 15.2
}
@@ -775,58 +785,58 @@
next = ((ch - 0xd800) << 10) + next -0xdc00 + 0x00010000;
}
- accum('&');
- accum('#');
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charNumberSign);
accum(UnsignedLongToDOMString(next));
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if(ch >= 160 && ch <= 255)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
accum(theHTMLLatin1Symbols[ch - 160]);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if(ch >= 913 && ch <= 937 && ch != 930)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
accum(theHTMLSymbols1[ch - 913]);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if(ch >= 945 && ch <= 969)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
accum(theHTMLSymbols2[ch - 945]);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if(ch >= 977 && ch <= 978)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
// substracting the number of unused characters
accum(theHTMLSymbols2[ch - 945 - 7]);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if(ch == 982)
{
- accum('&');
+ accum(XalanUnicode::charAmpersand);
// substracting the number of unused characters
accum(theHTMLSymbols2[ch - 945 - 10]);
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
else if (402 == ch)
{
- accum('&');
- accum('f');
- accum('n');
- accum('o');
- accum('f');
- accum(';');
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_f);
+ accum(XalanUnicode::charLetter_n);
+ accum(XalanUnicode::charLetter_o);
+ accum(XalanUnicode::charLetter_f);
+ accum(XalanUnicode::charSemicolon);
}
else
{
- accum('&');
- accum('#');
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charNumberSign);
accum(UnsignedLongToDOMString(ch));
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
}
}
@@ -841,14 +851,14 @@
{
const unsigned int len = length(s);
- accum('&');
+ accum(XalanUnicode::charAmpersand);
for(unsigned int i= 0; i < len; ++i)
{
accum(s[i]);
}
- accum(';');
+ accum(XalanUnicode::charSemicolon);
return pos;
}
@@ -863,7 +873,7 @@
{
const XalanDOMString nameUpper = toUpperCase(name);
- accum(' ');
+ accum(XalanUnicode::charSpace);
if(elemDesc.isAttrFlagSet(nameUpper, ElemDesc::ATTREMPTY) == true &&
(length(value) == 0) || equalsIgnoreCase(value, name) == true)
@@ -873,8 +883,8 @@
else
{
accum(name);
- accum('=');
- accum('\"');
+ accum(XalanUnicode::charEqualsSign);
+ accum(XalanUnicode::charQuoteMark);
if(elemDesc.isAttrFlagSet(nameUpper, ElemDesc::ATTRURL) == true)
{
@@ -885,7 +895,7 @@
writeAttrString(value, m_encoding);
}
- accum('\"');
+ accum(XalanUnicode::charQuoteMark);
}
}
@@ -903,19 +913,19 @@
const XalanDOMChar ch = string[i];
// if first 8 bytes are 0, no need to append them.
- if (ch < 9 || ch > 127 || ch == '"' || ch == ' ')
+ if (ch < 9 || ch > 127 || ch == XalanUnicode::charQuoteMark || ch == XalanUnicode::charSpace)
{
const unsigned int b1 = (ch & 0xFF00) >> 8;
const unsigned int b2 = ch & 0x00FF;
if(b1 != 0)
{
- accum('%');
+ accum(XalanUnicode::charPercentSign);
accum(UnsignedLongToHexDOMString(b1));
}
- accum('%');
+ accum(XalanUnicode::charPercentSign);
accum(UnsignedLongToHexDOMString(b2));
}
else
1.25 +167 -147 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- FormatterToXML.cpp 2000/08/31 19:42:57 1.24
+++ FormatterToXML.cpp 2000/09/05 02:24:48 1.25
@@ -71,7 +71,16 @@
-static const XalanDOMChar theDefaultAttrSpecialChars[] = {'<', '>', '&', '"', '\r', '\n', 0 };
+static const XalanDOMChar theDefaultAttrSpecialChars[] =
+{
+ XalanUnicode::charLessThanSign,
+ XalanUnicode::charGreaterThanSign,
+ XalanUnicode::charAmpersand,
+ XalanUnicode::charQuoteMark,
+ XalanUnicode::charCR,
+ XalanUnicode::charLF,
+ 0
+};
FormatterToXML::FormatterToXML(
@@ -108,8 +117,8 @@
m_currentIndent(0),
m_indent(indent),
m_preserves(),
- m_shouldFlush(true),
m_bytesEqualChars(false),
+ m_shouldFlush(true),
m_spaceBeforeClose(false),
m_escapeCData(false),
m_inEntityRef(false),
@@ -118,7 +127,6 @@
m_mediaType(mediaType),
m_attrSpecialChars(theDefaultAttrSpecialChars),
m_charBuf(),
- m_byteBuf(),
m_pos(0),
m_level(0),
m_elemStack()
@@ -138,18 +146,14 @@
m_isUTF8 = equals(m_encoding, s_utf8EncodingString); // || isEmpty(m_encoding);
if (equals(m_encoding, s_windows1250EncodingString) == true ||
- equals(m_encoding, s_usASCIIEncodingString) == true ||
+ equals(m_encoding, s_usASCIIEncodingString) == true ||
equals(m_encoding, s_asciiEncodingString) == true)
{
m_bytesEqualChars = true;
-
- m_byteBuf.resize(s_maxBufferSize + 1);
- }
- else
- {
- m_charBuf.resize(s_maxBufferSize + 1);
}
+ m_charBuf.resize(s_maxBufferSize + 1);
+
#if 0
DOMString2IntMapType::const_iterator it =
s_revsize.find(toUpperCase(m_encoding));
@@ -203,10 +207,10 @@
memset(m_charsMap, 0, sizeof(m_charsMap));
- m_charsMap['\n'] = 'S';
- m_charsMap['<'] = 'S';
- m_charsMap['>'] = 'S';
- m_charsMap['&'] = 'S';
+ m_charsMap[XalanUnicode::charLF] = 'S';
+ m_charsMap[XalanUnicode::charLessThanSign] = 'S';
+ m_charsMap[XalanUnicode::charGreaterThanSign] = 'S';
+ m_charsMap[XalanUnicode::charAmpersand] = 'S';
memset(m_charsMap, 'S', 20);
@@ -234,9 +238,9 @@
{
accum(s_doctypeHeaderPublicString); // " PUBLIC \""
accum(m_doctypePublic);
- accum('"');
- accum(' ');
- accum('"');
+ accum(XalanUnicode::charQuoteMark);
+ accum(XalanUnicode::charSpace);
+ accum(XalanUnicode::charQuoteMark);
}
else
{
@@ -244,8 +248,8 @@
}
accum(m_doctypeSystem);
- accum('"');
- accum('>');
+ accum(XalanUnicode::charQuoteMark);
+ accum(XalanUnicode::charGreaterThanSign);
outputLineSep();
}
@@ -253,49 +257,64 @@
void
-FormatterToXML::accum(char ch)
+FormatterToXML::accum(XalanDOMChar ch)
{
- if(m_bytesEqualChars == true)
+ if (m_bytesEqualChars == true)
{
- m_byteBuf[m_pos++] = ch;
-
- if(m_pos == s_maxBufferSize)
+ if (ch > 255)
{
- flushBytes();
+ writeNumberedEntityReference(ch);
}
+ else
+ {
+ m_charBuf[m_pos++] = char(ch);
+ }
}
else
{
m_charBuf[m_pos++] = ch;
+ }
- if(m_pos == s_maxBufferSize)
- {
- flushChars();
- }
+ if(m_pos == s_maxBufferSize)
+ {
+ flushChars();
}
}
void
-FormatterToXML::accum(XalanDOMChar ch)
+FormatterToXML::accum(const XalanDOMChar* chars)
{
- if(m_bytesEqualChars == true)
+ if (m_bytesEqualChars == true)
{
- m_byteBuf[m_pos++] = ByteBufferType::value_type(ch);
-
- if(m_pos == s_maxBufferSize)
+ for(const XalanDOMChar* current = chars; *current != 0; ++current)
{
- flushBytes();
+ if (*current > 255)
+ {
+ writeNumberedEntityReference(*current);
+ }
+ else
+ {
+ m_charBuf[m_pos++] = *current;
+ }
+
+ if(m_pos == s_maxBufferSize)
+ {
+ flushChars();
+ }
}
}
else
{
- m_charBuf[m_pos++] = ch;
-
- if(m_pos == s_maxBufferSize)
+ for(const XalanDOMChar* current = chars; *current != 0; ++current)
{
- flushChars();
+ m_charBuf[m_pos++] = *current;
+
+ if(m_pos == s_maxBufferSize)
+ {
+ flushChars();
+ }
}
}
}
@@ -310,15 +329,22 @@
{
const DOMCharBufferType::size_type n = start + length;
- if(m_bytesEqualChars == true)
+ if (m_bytesEqualChars == true)
{
for(DOMCharBufferType::size_type i = start; i < n; ++i)
{
- m_byteBuf[m_pos++] = ByteBufferType::value_type(chars[i]);
+ if (chars[i] > 255)
+ {
+ writeNumberedEntityReference(chars[i]);
+ }
+ else
+ {
+ m_charBuf[m_pos++] = char(chars[i]);
+ }
if(m_pos == s_maxBufferSize)
{
- flushBytes();
+ flushChars();
}
}
}
@@ -462,49 +488,49 @@
i++;
}
- else if (escLF == false && '\n' == ch)
+ else if (escLF == false && XalanUnicode::charLF == ch)
{
outputLineSep();
}
- else if ('<' == ch)
+ else if (XalanUnicode::charLessThanSign == ch)
{
- accum('&');
- accum('l');
- accum('t');
- accum(';');
- }
- else if ('>' == ch)
- {
- accum('&');
- accum('g');
- accum('t');
- accum(';');
- }
- else if ('&' == ch)
- {
- accum('&');
- accum('a');
- accum('m');
- accum('p');
- accum(';');
- }
- else if ('"' == ch)
- {
- accum('&');
- accum('q');
- accum('u');
- accum('o');
- accum('t');
- accum(';');
- }
- else if ('\'' == ch)
- {
- accum('&');
- accum('a');
- accum('p');
- accum('o');
- accum('s');
- accum(';');
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_l);
+ accum(XalanUnicode::charLetter_t);
+ accum(XalanUnicode::charSemicolon);
+ }
+ else if (XalanUnicode::charGreaterThanSign == ch)
+ {
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_g);
+ accum(XalanUnicode::charLetter_t);
+ accum(XalanUnicode::charSemicolon);
+ }
+ else if (XalanUnicode::charAmpersand == ch)
+ {
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_a);
+ accum(XalanUnicode::charLetter_m);
+ accum(XalanUnicode::charLetter_p);
+ accum(XalanUnicode::charSemicolon);
+ }
+ else if (XalanUnicode::charQuoteMark == ch)
+ {
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_q);
+ accum(XalanUnicode::charLetter_u);
+ accum(XalanUnicode::charLetter_o);
+ accum(XalanUnicode::charLetter_t);
+ accum(XalanUnicode::charSemicolon);
+ }
+ else if (XalanUnicode::charApostrophe == ch)
+ {
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charLetter_a);
+ accum(XalanUnicode::charLetter_p);
+ accum(XalanUnicode::charLetter_o);
+ accum(XalanUnicode::charLetter_s);
+ accum(XalanUnicode::charSemicolon);
}
else
{
@@ -517,20 +543,6 @@
void
-FormatterToXML::flushBytes()
-{
- assert(m_byteBuf.size() > 0 && m_byteBuf.size() > m_pos);
-
- m_byteBuf[m_pos] = '\0';
-
- m_writer.write(&m_byteBuf[0]);
-
- m_pos = 0;
-}
-
-
-
-void
FormatterToXML::flushChars()
{
assert(m_charBuf.size() > 0 && m_charBuf.size() > m_pos);
@@ -547,14 +559,7 @@
void
FormatterToXML::flush()
{
- if(m_bytesEqualChars == true)
- {
- flushBytes();
- }
- else
- {
- flushChars();
- }
+ flushChars();
}
@@ -674,7 +679,7 @@
m_startNewLine = true;
- accum('<');
+ accum(XalanUnicode::charLessThanSign);
accum(name);
const unsigned int nAttrs = attrs.getLength();
@@ -709,21 +714,21 @@
indent(m_currentIndent);
}
- accum('<');
- accum('/');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charSolidus);
accum(name);
}
else
{
if(m_spaceBeforeClose == true)
{
- accum(' ');
+ accum(XalanUnicode::charSpace);
}
- accum('/');
+ accum(XalanUnicode::charSolidus);
}
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
if (hasChildNodes == true)
{
@@ -767,21 +772,21 @@
indent(m_currentIndent);
}
- accum('<');
- accum('?');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charQuestionMark);
accum(target);
const unsigned int len = length(data);
if ( len > 0 && !isSpace(data[0]))
{
- accum(' ');
+ accum(XalanUnicode::charSpace);
}
accumNormalizedPIData(data, len);
- accum('?');
- accum('>');
+ accum(XalanUnicode::charQuestionMark);
+ accum(XalanUnicode::charGreaterThanSign);
m_startNewLine = true;
}
@@ -837,7 +842,6 @@
-
void
FormatterToXML::charactersRaw(
const XMLCh* const chars,
@@ -909,7 +913,7 @@
i++;
}
- else if('\n' == c)
+ else if(XalanUnicode::charLF == c)
{
outputLineSep();
}
@@ -956,9 +960,9 @@
}
else if(isCData == true &&
i < end - 2 &&
- ']' == c &&
- ']' == ch[i + 1] &&
- '>' == ch[ i + 2])
+ XalanUnicode::charRightSquareBracket == c &&
+ XalanUnicode::charRightSquareBracket == ch[i + 1] &&
+ XalanUnicode::charGreaterThanSign == ch[ i + 2])
{
accum(XALAN_STATIC_UCODE_STRING("]]]]><![CDATA[>"));
@@ -1007,10 +1011,10 @@
void
FormatterToXML::writeNumberedEntityReference(unsigned long theNumber)
{
- accum('&');
- accum('#');
+ accum(XalanUnicode::charAmpersand);
+ accum(XalanUnicode::charNumberSign);
accum(UnsignedLongToDOMString(theNumber));
- accum(';');
+ accum(XalanUnicode::charSemicolon);
}
@@ -1025,9 +1029,9 @@
indent(m_currentIndent);
}
- m_writer.write('&');
+ m_writer.write(XalanUnicode::charAmpersand);
m_writer.write(name);
- m_writer.write(';');
+ m_writer.write(XalanUnicode::charSemicolon);
}
@@ -1065,16 +1069,16 @@
indent(m_currentIndent);
}
- accum('<');
- accum('!');
- accum('-');
- accum('-');
+ accum(XalanUnicode::charLessThanSign);
+ accum(XalanUnicode::charExclamationMark);
+ accum(XalanUnicode::charHyphenMinus);
+ accum(XalanUnicode::charHyphenMinus);
accum(data);
- accum('-');
- accum('-');
- accum('>');
+ accum(XalanUnicode::charHyphenMinus);
+ accum(XalanUnicode::charHyphenMinus);
+ accum(XalanUnicode::charGreaterThanSign);
m_startNewLine = true;
}
@@ -1126,9 +1130,9 @@
if(length >= 1 &&
ch[length - 1] <= m_maxCharacter)
{
- accum(']');
- accum(']');
- accum('>');
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charRightSquareBracket);
+ accum(XalanUnicode::charGreaterThanSign);
}
}
}
@@ -1145,7 +1149,7 @@
// See if the parent element has already been flagged as having children.
if(false == m_elemStack.back())
{
- accum('>');
+ accum(XalanUnicode::charGreaterThanSign);
m_isprevtext = false;
m_elemStack.pop_back();
@@ -1188,17 +1192,37 @@
const XalanDOMChar* name,
const XalanDOMChar* value)
{
- accum(' ');
+ accum(XalanUnicode::charSpace);
accum(name);
- accum('=');
- accum('"');
+ accum(XalanUnicode::charEqualsSign);
+ accum(XalanUnicode::charQuoteMark);
writeAttrString(value, m_encoding);
- accum('"');
+ accum(XalanUnicode::charQuoteMark);
+}
+
+
+
+void
+FormatterToXML::outputLineSep()
+{
+ // $$$ ToDo: Does this need to be CR/LF on some platforms?
+ accum(XalanUnicode::charLF);
}
void
+FormatterToXML::printSpace(int n)
+{
+ for (int i = 0; i < n; i ++)
+ {
+ accum(XalanUnicode::charSpace);
+ }
+}
+
+
+
+void
FormatterToXML::indent(int n)
{
if(m_startNewLine == true)
@@ -1227,10 +1251,10 @@
{
const XalanDOMChar theChar = theData[i];
- if (theChar == '?' && i + 1 < theLength && theData[i + 1] == '>')
+ if (theChar == XalanUnicode::charQuestionMark && i + 1 < theLength && theData[i + 1] == XalanUnicode::charGreaterThanSign)
{
- accum('?');
- accum(' ');
+ accum(XalanUnicode::charQuestionMark);
+ accum(XalanUnicode::charSpace);
}
else
{
@@ -1299,7 +1323,7 @@
{
String encoding = System.getProperty("file.encoding");
- unsigned int dashindex = (encoding != null ? encoding.indexOf('-') : -1);
+ unsigned int dashindex = (encoding != null ? encoding.indexOf(XalanUnicode::charHyphenMinus) : -1);
if(3 == dashindex)
{
String ISOprefix = new String(encoding.toCharArray(), 0, 3);
@@ -1560,11 +1584,7 @@
const XalanDOMCharVectorType& FormatterToXML::s_utf8EncodingString = ::s_utf8EncodingString;
-XalanDOMChar FormatterToXML::s_lineSep = '\n';
-
-
bool FormatterToXML::s_javaEncodingIsISO = false;
-
const FormatterToXML::DOMCharBufferType::size_type FormatterToXML::s_maxBufferSize = 512;
1.16 +16 -34 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FormatterToXML.hpp 2000/08/31 19:42:57 1.15
+++ FormatterToXML.hpp 2000/09/05 02:24:49 1.16
@@ -75,6 +75,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -335,26 +336,24 @@
* Output a line break.
*/
void
- outputLineSep()
- {
- accum(s_lineSep);
- }
+ outputLineSep();
/**
- * Append a character to the buffer.
+ * Append a wide character to the buffer.
*
* @ch the character to append.
*/
void
- accum(char ch);
+ accum(XalanDOMChar ch);
/**
- * Append a wide character to the buffer.
+ * Append a mull-termiated array of wide character to
+ * the buffer.
*
- * @ch the character to append.
+ * @chars the array to append
*/
void
- accum(XalanDOMChar ch);
+ accum(const XalanDOMChar* chars);
/**
* Append an array of wide character to the buffer.
@@ -421,12 +420,6 @@
initCharsMap();
/**
- * Flush the byte buffer.
- */
- void
- flushBytes();
-
- /**
* Flush the char buffer.
*/
void
@@ -673,13 +666,7 @@
* @param n Number of spaces to print.
*/
void
- printSpace(int n)
- {
- for (int i = 0; i < n; i ++)
- {
- accum(' ');
- }
- }
+ printSpace(int n);
/**
* Normalize the data in a PI, to replace any
@@ -693,10 +680,13 @@
// Data members...
- bool m_shouldFlush;
-
+ /**
+ * True if an encoding is only has only values from 0 - 255
+ */
bool m_bytesEqualChars;
+ bool m_shouldFlush;
+
/**
* Add space before '/>' for XHTML.
*/
@@ -804,12 +794,10 @@
*/
static const XalanDOMCharVectorType& s_utf8EncodingString;
-
- DOMCharBufferType m_charBuf;
- ByteBufferType m_byteBuf;
+ DOMCharBufferType m_charBuf;
- ByteBufferType::size_type m_pos;
+ DOMCharBufferType::size_type m_pos;
static const DOMCharBufferType::size_type s_maxBufferSize;
@@ -823,12 +811,6 @@
* has children.
*/
BoolStackType m_elemStack;
-
- /**
- * Use the system line seperator to write line breaks. This should
- * always be '\n'.
- */
- static XalanDOMChar s_lineSep;
};
1.2 +6 -0 xml-xalan/c/src/XMLSupport/XMLSupportInit.cpp
Index: XMLSupportInit.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/XMLSupportInit.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLSupportInit.cpp 2000/08/31 19:42:59 1.1
+++ XMLSupportInit.cpp 2000/09/05 02:24:49 1.2
@@ -59,7 +59,9 @@
+#include "FormatterToDOM.hpp"
#include "FormatterToHTML.hpp"
+#include "FormatterToXML.hpp"
@@ -96,6 +98,8 @@
void
XMLSupportInit::initialize()
{
+ FormatterToDOM::initialize();
+
FormatterToXML::initialize();
FormatterToHTML::initialize();
@@ -109,4 +113,6 @@
FormatterToHTML::terminate();
FormatterToXML::terminate();
+
+ FormatterToDOM::terminate();
}
1.7 +2 -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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FunctionLang.hpp 2000/08/15 19:43:18 1.6
+++ FunctionLang.hpp 2000/09/05 02:24:50 1.7
@@ -74,6 +74,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -141,7 +142,7 @@
const unsigned int valLen = length(lang);
if(length(langVal) == valLen ||
- charAt(langVal, valLen) == '-')
+ charAt(langVal, valLen) == XalanUnicode::charHyphenMinus)
{
fMatch = true;
1.6 +2 -1 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FunctionNormalize.hpp 2000/04/18 15:26:41 1.5
+++ FunctionNormalize.hpp 2000/09/05 02:24:50 1.6
@@ -63,6 +63,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -149,7 +150,7 @@
// space.
if (isSpace(thePreviousChar) == false && theVector.size() > 0)
{
- theVector.push_back(XalanDOMChar(' '));
+ theVector.push_back(XalanDOMChar(XalanUnicode::charSpace));
}
}
else
1.11 +3 -2 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- QName.cpp 2000/08/28 01:17:16 1.10
+++ QName.cpp 2000/09/05 02:24:50 1.11
@@ -62,6 +62,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/XSLException.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -95,7 +96,7 @@
m_namespace(),
m_localpart()
{
- const unsigned int indexOfNSSep = indexOf(qname, ':');
+ const unsigned int indexOfNSSep = indexOf(qname, XalanUnicode::charColon);
if(indexOfNSSep < length(qname))
{
@@ -161,7 +162,7 @@
const XalanDOMString& qname,
const PrefixResolver& theResolver)
{
- const unsigned int indexOfNSSep = indexOf(qname, ':');
+ const unsigned int indexOfNSSep = indexOf(qname, XalanUnicode::charColon);
const unsigned int theLength = length(qname);
if(indexOfNSSep < theLength)
1.8 +1 -1 xml-xalan/c/src/XPath/XLocator.hpp
Index: XLocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XLocator.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XLocator.hpp 2000/08/15 19:43:19 1.7
+++ XLocator.hpp 2000/09/05 02:24:50 1.8
@@ -93,7 +93,7 @@
/**
* Execute a location path. Normally, this method simply moves past the
- * OP_LOCATIONPATH and it's length member, and calls the Step function,
+ * OP_LOCATIONPATH and its length member, and calls the Step function,
* which will recursively process the rest of the location path, and then
* wraps the resulting node list in an XNodeSet object.
*
1.18 +5 -1 xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp
Index: XPathEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XPathEnvSupportDefault.cpp 2000/08/31 19:43:03 1.17
+++ XPathEnvSupportDefault.cpp 2000/09/05 02:24:50 1.18
@@ -71,6 +71,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include "SimpleNodeLocator.hpp"
#include "XObject.hpp"
#include "XObjectFactory.hpp"
@@ -468,7 +472,7 @@
if(length(theNamespace) > 0)
{
theFunctionName += theNamespace;
- theFunctionName += XALAN_STATIC_UCODE_STRING(":");
+ theFunctionName += DOMServices::s_XMLNamespaceSeparatorString;
}
theFunctionName += functionName;
1.21 +195 -129 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XPathProcessorImpl.cpp 2000/08/31 19:43:05 1.20
+++ XPathProcessorImpl.cpp 2000/09/05 02:24:50 1.21
@@ -68,6 +68,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
#include "PrefixResolver.hpp"
#include "XPathEnvSupport.hpp"
#include "XPathExecutionContext.hpp"
@@ -185,7 +189,7 @@
switch(c)
{
- case '\"':
+ case XalanUnicode::charQuoteMark:
{
if(startSubstring != -1)
{
@@ -206,9 +210,9 @@
startSubstring = i;
- for(++i; i < nChars && (c = charAt(pat, i)) != '\"'; ++i);
+ for(++i; i < nChars && (c = charAt(pat, i)) != XalanUnicode::charQuoteMark; ++i);
- if(c == '\"')
+ if(c == XalanUnicode::charQuoteMark)
{
addToTokenQueue(substring(pat, startSubstring, i + 1));
startSubstring = -1;
@@ -220,7 +224,7 @@
}
break;
- case '\'':
+ case XalanUnicode::charApostrophe:
{
if(startSubstring != -1)
{
@@ -240,9 +244,9 @@
startSubstring = i;
- for(++i; i < nChars && (c = charAt(pat, i)) != '\''; ++i);
+ for(++i; i < nChars && (c = charAt(pat, i)) != XalanUnicode::charApostrophe; ++i);
- if(c == '\'')
+ if(c == XalanUnicode::charApostrophe)
{
addToTokenQueue(substring(pat, startSubstring, i + 1));
startSubstring = -1;
@@ -254,10 +258,10 @@
}
break;
- case 0x0A:
- case 0x0D:
- case ' ':
- case '\t':
+ case XalanUnicode::charLF:
+ case XalanUnicode::charCR:
+ case XalanUnicode::charSpace:
+ case XalanUnicode::charHTab:
{
if(startSubstring != -1)
{
@@ -279,13 +283,13 @@
}
break;
- case '@':
+ case XalanUnicode::charCommercialAt:
isAttrName = true;
// fall-through on purpose
- case '-':
+ case XalanUnicode::charHyphenMinus:
{
- if('-' == c)
+ if(XalanUnicode::charHyphenMinus == c)
{
if(!(isNum || startSubstring == -1))
{
@@ -297,22 +301,22 @@
}
// fall-through on purpose
- case '(':
- case '[':
- case ')':
- case ']':
- case '|':
- case '/':
- case '*':
- case '+':
- case '=':
- case ',':
- case '\\': // Unused at the moment
- case '^': // Unused at the moment
- case '!': // Unused at the moment
- case '$':
- case '<':
- case '>':
+ case XalanUnicode::charLeftParenthesis:
+ case XalanUnicode::charLeftSquareBracket:
+ case XalanUnicode::charRightParenthesis:
+ case XalanUnicode::charRightSquareBracket:
+ case XalanUnicode::charVerticalLine:
+ case XalanUnicode::charSolidus:
+ case XalanUnicode::charAsterisk:
+ case XalanUnicode::charPlusSign:
+ case XalanUnicode::charEqualsSign:
+ case XalanUnicode::charComma:
+ case XalanUnicode::charReverseSolidus: // Unused at the moment
+ case XalanUnicode::charCircumflexAccent: // Unused at the moment
+ case XalanUnicode::charExclamationMark: // Unused at the moment
+ case XalanUnicode::charDollarSign:
+ case XalanUnicode::charLessThanSign:
+ case XalanUnicode::charGreaterThanSign:
{
if(startSubstring != -1)
{
@@ -331,11 +335,11 @@
startSubstring = -1;
}
- else if('/' == c && isStartOfPat == true)
+ else if(XalanUnicode::charSolidus == c && isStartOfPat == true)
{
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
}
- else if('*' == c)
+ else if(XalanUnicode::charAsterisk == c)
{
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
isAttrName = false;
@@ -343,7 +347,7 @@
if(0 == nesting)
{
- if('|' == c)
+ if(XalanUnicode::charVerticalLine == c)
{
if(0 != targetStrings)
{
@@ -354,11 +358,11 @@
}
}
- if(')' == c || ']' == c)
+ if(XalanUnicode::charRightParenthesis == c || XalanUnicode::charRightSquareBracket == c)
{
nesting--;
}
- else if('(' == c || '[' == c)
+ else if(XalanUnicode::charLeftParenthesis == c || XalanUnicode::charLeftSquareBracket == c)
{
nesting++;
}
@@ -367,7 +371,7 @@
}
break;
- case ':':
+ case XalanUnicode::charColon:
{
if(posOfNSSep == i - 1)
{
@@ -477,7 +481,7 @@
resetTokenMark(tokPos + 1);
- if(lookahead('(', 1) == true)
+ if(lookahead(XalanUnicode::charLeftParenthesis, 1) == true)
{
const int tok = getKeywordToken(m_token);
@@ -514,14 +518,14 @@
}
else
{
- if(tokenIs('@') == true)
+ if(tokenIs(XalanUnicode::charCommercialAt) == true)
{
tokPos++;
resetTokenMark(tokPos + 1);
}
- if(lookahead(':', 1) == true)
+ if(lookahead(XalanUnicode::charColon, 1) == true)
{
tokPos += 2;
}
@@ -564,7 +568,7 @@
{
addToTokenQueue(uName);
- addToTokenQueue(XALAN_STATIC_UCODE_STRING(":"));
+ addToTokenQueue(DOMServices::s_XMLNamespaceSeparatorString);
const XalanDOMString s = substring(pat, posOfNSSep + 1, posOfScan);
@@ -578,7 +582,7 @@
// error(XalanDOMString("Could not locate namespace for prefix: ") + prefix);
addToTokenQueue(prefix);
- addToTokenQueue(XALAN_STATIC_UCODE_STRING(":"));
+ addToTokenQueue(DOMServices::s_XMLNamespaceSeparatorString);
const XalanDOMString s = substring(pat, posOfNSSep + 1, posOfScan);
@@ -705,9 +709,9 @@
const XalanDOMString tok =
getTokenRelative(-(n + 1));
- const XalanDOMChar c0 = length(tok) == 0 ? '|' : charAt(tok, 0);
+ const XalanDOMChar c0 = length(tok) == 0 ? XalanUnicode::charVerticalLine : charAt(tok, 0);
- return c0 == '|' ? false : true;
+ return c0 == XalanUnicode::charVerticalLine ? false : true;
}
@@ -942,7 +946,7 @@
AndExpr();
- if(tokenIs(XALAN_STATIC_UCODE_STRING("or")) == true)
+ if(tokenIs(s_orString) == true)
{
nextToken();
@@ -965,7 +969,7 @@
EqualityExpr();
- if(tokenIs(XALAN_STATIC_UCODE_STRING("and")) == true)
+ if(tokenIs(s_andString) == true)
{
nextToken();
@@ -993,14 +997,14 @@
XPathExpression::eOpCodes theOpCode =
XPathExpression::eENDOP;
- if(tokenIs('!') && lookahead('=', 1))
+ if(tokenIs(XalanUnicode::charExclamationMark) && lookahead(XalanUnicode::charEqualsSign, 1))
{
nextToken();
nextToken();
theOpCode = XPathExpression::eOP_NOTEQUALS;
}
- else if(tokenIs('='))
+ else if(tokenIs(XalanUnicode::charEqualsSign))
{
nextToken();
@@ -1060,11 +1064,11 @@
XPathExpression::eOpCodes theOpCode =
XPathExpression::eENDOP;
- if(tokenIs('<') == true)
+ if(tokenIs(XalanUnicode::charLessThanSign) == true)
{
nextToken();
- if(tokenIs('=') == true)
+ if(tokenIs(XalanUnicode::charEqualsSign) == true)
{
nextToken();
@@ -1075,11 +1079,11 @@
theOpCode = XPathExpression::eOP_LT;
}
}
- else if(tokenIs('>') == true)
+ else if(tokenIs(XalanUnicode::charGreaterThanSign) == true)
{
nextToken();
- if(tokenIs('=') == true)
+ if(tokenIs(XalanUnicode::charEqualsSign) == true)
{
nextToken();
@@ -1145,11 +1149,11 @@
XPathExpression::eOpCodes theOpCode =
XPathExpression::eENDOP;
- if(tokenIs('+') == true)
+ if(tokenIs(XalanUnicode::charPlusSign) == true)
{
theOpCode = XPathExpression::eOP_PLUS;
}
- else if(tokenIs('-') == true)
+ else if(tokenIs(XalanUnicode::charHyphenMinus) == true)
{
theOpCode = XPathExpression::eOP_MINUS;
}
@@ -1210,19 +1214,19 @@
XPathExpression::eOpCodes theOpCode =
XPathExpression::eENDOP;
- if(tokenIs('*') == true)
+ if(tokenIs(XalanUnicode::charAsterisk) == true)
{
theOpCode = XPathExpression::eOP_MULT;
}
- else if(tokenIs(XALAN_STATIC_UCODE_STRING("div")) == true)
+ else if(tokenIs(s_divString) == true)
{
theOpCode = XPathExpression::eOP_DIV;
}
- else if(tokenIs(XALAN_STATIC_UCODE_STRING("mod")) == true)
+ else if(tokenIs(s_modString) == true)
{
theOpCode = XPathExpression::eOP_MOD;
}
- else if(tokenIs(XALAN_STATIC_UCODE_STRING("quo")) == true)
+ else if(tokenIs(s_quoString) == true)
{
theOpCode = XPathExpression::eOP_QUO;
}
@@ -1276,7 +1280,7 @@
bool isNeg = false;
- if(m_tokenChar == '-')
+ if(m_tokenChar == XalanUnicode::charHyphenMinus)
{
nextToken();
@@ -1362,7 +1366,7 @@
{
PathExpr();
- if(tokenIs('|') == true)
+ if(tokenIs(XalanUnicode::charVerticalLine) == true)
{
if(false == foundUnion)
{
@@ -1401,7 +1405,7 @@
FilterExpr();
- if(tokenIs('/') == true)
+ if(tokenIs(XalanUnicode::charSolidus) == true)
{
nextToken();
@@ -1426,21 +1430,21 @@
const int opPos = m_expression->opCodeMapLength();
- // const bool isFunc = lookahead('(', 1);
+ // const bool isFunc = lookahead(XalanUnicode::charLeftParenthesis, 1);
PrimaryExpr();
- if(tokenIs('[') == true)
+ if(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
m_expression->insertOpCode(XPathExpression::eOP_LOCATIONPATH,
opPos);
- while(tokenIs('[') == true)
+ while(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
Predicate();
}
- if(tokenIs('/') == true)
+ if(tokenIs(XalanUnicode::charSolidus) == true)
{
nextToken();
@@ -1455,7 +1459,7 @@
}
/*
- if(tokenIs('[') == true)
+ if(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
Predicate();
@@ -1474,7 +1478,7 @@
const int opPos = m_expression->opCodeMapLength();
- if(m_tokenChar == '\'' || m_tokenChar == '"')
+ if(m_tokenChar == XalanUnicode::charApostrophe || m_tokenChar == XalanUnicode::charQuoteMark)
{
m_expression->appendOpCode(XPathExpression::eOP_LITERAL);
@@ -1483,7 +1487,7 @@
m_expression->updateOpCodeLength(XPathExpression::eOP_LITERAL,
opPos);
}
- else if(m_tokenChar == '$')
+ else if(m_tokenChar == XalanUnicode::charDollarSign)
{
nextToken(); // consume '$'
@@ -1494,7 +1498,7 @@
m_expression->updateOpCodeLength(XPathExpression::eOP_VARIABLE,
opPos);
}
- else if(m_tokenChar == '(')
+ else if(m_tokenChar == XalanUnicode::charLeftParenthesis)
{
nextToken();
@@ -1502,12 +1506,14 @@
Expr();
- consumeExpected(')');
+ consumeExpected(XalanUnicode::charRightParenthesis);
m_expression->updateOpCodeLength(XPathExpression::eOP_GROUP,
opPos);
}
- else if(('.' == m_tokenChar && m_token.length() > 1 && isDigit(charAt(m_token, 1)) == true)
+ else if((XalanUnicode::charFullStop == m_tokenChar &&
+ m_token.length() > 1 &&
+ isDigit(charAt(m_token, 1)) == true)
|| isDigit(m_tokenChar) == true)
{
m_expression->appendOpCode(XPathExpression::eOP_NUMBERLIT);
@@ -1517,8 +1523,8 @@
m_expression->updateOpCodeLength(XPathExpression::eOP_NUMBERLIT,
opPos);
}
- else if(lookahead('(', 1) == true ||
- (lookahead(':', 1) == true && lookahead('(', 3) == true))
+ else if(lookahead(XalanUnicode::charLeftParenthesis, 1) == true ||
+ (lookahead(XalanUnicode::charColon, 1) == true && lookahead(XalanUnicode::charLeftParenthesis, 3) == true))
{
FunctionCall();
}
@@ -1552,11 +1558,11 @@
{
int argCount = 0;
- consumeExpected('(');
+ consumeExpected(XalanUnicode::charLeftParenthesis);
- while(tokenIs(')') == false)
+ while(tokenIs(XalanUnicode::charRightParenthesis) == false)
{
- if(tokenIs(',') == true)
+ if(tokenIs(XalanUnicode::charComma) == true)
{
error("Found ',' but no preceding argument!");
}
@@ -1565,19 +1571,19 @@
++argCount;
- if(tokenIs(')') == false)
+ if(tokenIs(XalanUnicode::charRightParenthesis) == false)
{
- consumeExpected(',');
+ consumeExpected(XalanUnicode::charComma);
- if(tokenIs(')') == true)
+ if(tokenIs(XalanUnicode::charRightParenthesis) == true)
{
error("Found ',' but no following argument!");
}
}
}
- consumeExpected(')');
+ consumeExpected(XalanUnicode::charRightParenthesis);
return argCount;
}
@@ -1590,7 +1596,7 @@
const int opPos = m_expression->opCodeMapLength();
- if(lookahead(':', 1) == true)
+ if(lookahead(XalanUnicode::charColon, 1) == true)
{
m_expression->appendOpCode(XPathExpression::eOP_EXTFUNCTION);
@@ -1600,7 +1606,7 @@
nextToken();
- consumeExpected(':');
+ consumeExpected(XalanUnicode::charColon);
theArgs[1] = m_expression->getTokenPosition() - 1;
@@ -1681,7 +1687,7 @@
m_expression->appendOpCode(XPathExpression::eOP_LOCATIONPATH);
- if(tokenIs('/') == true)
+ if(tokenIs(XalanUnicode::charSolidus) == true)
{
const int newOpPos = m_expression->opCodeMapLength();
@@ -1720,7 +1726,7 @@
{
Step();
- while(tokenIs('/') == true)
+ while(tokenIs(XalanUnicode::charSolidus) == true)
{
nextToken();
@@ -1735,11 +1741,11 @@
{
const int opPos = m_expression->opCodeMapLength();
- if(tokenIs(XALAN_STATIC_UCODE_STRING(".")) == true)
+ if(tokenIs(s_dotString) == true)
{
nextToken();
- if(tokenIs('[') == true)
+ if(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
error("'..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead.");
}
@@ -1754,7 +1760,7 @@
m_expression->appendOpCode(XPathExpression::eNODETYPE_NODE);
}
- else if(tokenIs(XALAN_STATIC_UCODE_STRING("..")) == true)
+ else if(tokenIs(s_dotDotString) == true)
{
nextToken();
@@ -1772,7 +1778,7 @@
{
Basis();
- while(tokenIs('[') == true)
+ while(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
Predicate();
}
@@ -1795,14 +1801,14 @@
int axisType = 0;
// The next blocks guarantee that a FROM_XXX will be added.
- if(lookahead(XALAN_STATIC_UCODE_STRING("::"), 1) == true)
+ if(lookahead(s_axisString, 1) == true)
{
axisType = AxisName();
nextToken();
nextToken();
}
- else if(tokenIs('@') == true)
+ else if(tokenIs(XalanUnicode::charCommercialAt) == true)
{
axisType = XPathExpression::eFROM_ATTRIBUTES;
@@ -1810,7 +1816,7 @@
nextToken();
}
- else if(tokenIs('/') == true)
+ else if(tokenIs(XalanUnicode::charSolidus) == true)
{
axisType = XPathExpression::eFROM_DESCENDANTS_OR_SELF;
@@ -1818,7 +1824,7 @@
// which translate to 'descendant-or-self::node()/attribute::foo'.
// notice I leave the '/' on the queue, so the next will be processed
// by a regular step pattern.
- // if(lookahead('@', 1) == true || lookahead("::", 2) == true)
+ // if(lookahead(XalanUnicode::charCommercialAt, 1) == true || lookahead("::", 2) == true)
{
XPathExpression::OpCodeMapValueVectorType theArgs(1);
@@ -1885,7 +1891,7 @@
assert(m_xpath != 0);
assert(m_expression != 0);
- if(lookahead('(', 1) == true)
+ if(lookahead(XalanUnicode::charLeftParenthesis, 1) == true)
{
NodeTypesMapType::const_iterator i =
s_nodeTypes.find(m_token);
@@ -1901,17 +1907,17 @@
m_expression->appendOpCode((*i).second);
- consumeExpected('(');
+ consumeExpected(XalanUnicode::charLeftParenthesis);
if(XPathExpression::eNODETYPE_PI == (*i).second)
{
- if(tokenIs(')') == false)
+ if(tokenIs(XalanUnicode::charRightParenthesis) == false)
{
Literal();
}
}
- consumeExpected(')');
+ consumeExpected(XalanUnicode::charRightParenthesis);
}
}
else
@@ -1919,9 +1925,9 @@
// Assume name of attribute or element.
m_expression->appendOpCode(XPathExpression::eNODENAME);
- if(lookahead(':', 1) == true)
+ if(lookahead(XalanUnicode::charColon, 1) == true)
{
- if(tokenIs('*') == true)
+ if(tokenIs(XalanUnicode::charAsterisk) == true)
{
m_expression->appendOpCode(XPathExpression::eELEMWILDCARD);
}
@@ -1947,14 +1953,14 @@
nextToken();
- consumeExpected(':');
+ consumeExpected(XalanUnicode::charColon);
}
else
{
m_expression->appendOpCode(XPathExpression::eEMPTY);
}
- if(tokenIs('*') == true)
+ if(tokenIs(XalanUnicode::charAsterisk) == true)
{
m_expression->appendOpCode(XPathExpression::eELEMWILDCARD);
}
@@ -1972,13 +1978,13 @@
void
XPathProcessorImpl::Predicate()
{
- if(tokenIs('[') == true)
+ if(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
nextToken();
PredicateExpr();
- consumeExpected(']');
+ consumeExpected(XalanUnicode::charRightSquareBracket);
}
}
@@ -2015,7 +2021,7 @@
nextToken();
- consumeExpected(':');
+ consumeExpected(XalanUnicode::charColon);
m_expression->pushCurrentTokenOnOpCodeMap();
@@ -2050,8 +2056,8 @@
const XalanDOMChar c0 = m_tokenChar;
const XalanDOMChar cX = charAt(m_token, last);
- if((c0 == '\"' && cX == '\"') ||
- (c0 == '\'' && cX == '\''))
+ if((c0 == XalanUnicode::charQuoteMark && cX == XalanUnicode::charQuoteMark) ||
+ (c0 == XalanUnicode::charApostrophe && cX == XalanUnicode::charApostrophe))
{
const XalanDOMString theArgument = substring(m_token, 1, last);
@@ -2094,7 +2100,7 @@
{
LocationPathPattern();
- if(tokenIs('|') == true)
+ if(tokenIs(XalanUnicode::charVerticalLine) == true)
{
nextToken();
}
@@ -2117,15 +2123,15 @@
m_expression->appendOpCode(XPathExpression::eOP_LOCATIONPATHPATTERN);
- // These token FUNC_KEY_STRING should not be here, as it is really
+ // These token s_functionKeyString should not be here, as it is really
// part of the XSLT standard, and not the XPATH standard.
- if(lookahead('(', 1) == true &&
- tokenIs(FUNC_ID_STRING) == true ||
- tokenIs(FUNC_KEY_STRING) == true)
+ if(lookahead(XalanUnicode::charLeftParenthesis, 1) == true &&
+ tokenIs(s_functionIDString) == true ||
+ tokenIs(s_functionKeyString) == true)
{
IdKeyPattern();
- if(tokenIs('/') == true && lookahead('/', 1) == true)
+ if(tokenIs(XalanUnicode::charSolidus) == true && lookahead(XalanUnicode::charSolidus, 1) == true)
{
const int newOpPos = m_expression->opCodeMapLength();
@@ -2144,7 +2150,7 @@
nextToken();
}
}
- else if(tokenIs('/') == true)
+ else if(tokenIs(XalanUnicode::charSolidus) == true)
{
const int newOpPos = m_expression->opCodeMapLength();
@@ -2153,7 +2159,7 @@
// Tell how long the step is without the predicate
theArgs[0] = 4;
- if(lookahead('/', 1) == true)
+ if(lookahead(XalanUnicode::charSolidus, 1) == true)
{
m_expression->appendOpCode(XPathExpression::eMATCH_ANY_ANCESTOR_WITH_PREDICATE,
theArgs);
@@ -2171,7 +2177,7 @@
nextToken();
}
- if(!tokenIs('|') == true && length(m_token) != 0)
+ if(!tokenIs(XalanUnicode::charVerticalLine) == true && length(m_token) != 0)
{
RelativePathPattern();
}
@@ -2198,7 +2204,7 @@
{
StepPattern();
- while(tokenIs('/') == true)
+ while(tokenIs(XalanUnicode::charSolidus) == true)
{
nextToken();
@@ -2229,7 +2235,7 @@
int matchTypePos = -1;
// The next blocks guarantee that a MATCH_XXX will be added.
- if(tokenIs('@') == true)
+ if(tokenIs(XalanUnicode::charCommercialAt) == true)
{
axisType = XPathExpression::eMATCH_ATTRIBUTE;
@@ -2237,17 +2243,17 @@
nextToken();
}
- else if(lookahead(XALAN_STATIC_UCODE_STRING("::"), 1) == true)
+ else if(lookahead(s_axisString, 1) == true)
{
// $$$ To Do: Perhaps these strings should be in the
// axis table?
- if(tokenIs(XALAN_STATIC_UCODE_STRING("attribute")) == true)
+ if(tokenIs(s_attributeString) == true)
{
axisType = XPathExpression::eMATCH_ATTRIBUTE;
m_expression->appendOpCode(XPathExpression::eMATCH_ATTRIBUTE);
}
- else if(tokenIs(XALAN_STATIC_UCODE_STRING("child")) == true)
+ else if(tokenIs(s_childString) == true)
{
axisType = XPathExpression::eMATCH_IMMEDIATE_ANCESTOR;
@@ -2261,7 +2267,7 @@
nextToken();
nextToken();
}
- else if(tokenIs('/') == true)
+ else if(tokenIs(XalanUnicode::charSolidus) == true)
{
axisType = XPathExpression::eMATCH_ANY_ANCESTOR;
@@ -2271,7 +2277,7 @@
}
else
{
- if(tokenIs('/') == true)
+ if(tokenIs(XalanUnicode::charSolidus) == true)
{
nextToken();
}
@@ -2291,12 +2297,12 @@
m_expression->updateOpCodeLengthAfterNodeTest(opPos);
- while(tokenIs('[') == true)
+ while(tokenIs(XalanUnicode::charLeftSquareBracket) == true)
{
Predicate();
}
- if(matchTypePos > -1 && tokenIs('/') == true && lookahead('/', 1) == true)
+ if(matchTypePos > -1 && tokenIs(XalanUnicode::charSolidus) == true && lookahead(XalanUnicode::charSolidus, 1) == true)
{
assert(m_expression->opCodeMapLength() > matchTypePos);
@@ -2389,18 +2395,58 @@
}
+
+static XalanDOMString s_functionIDString;
+
+static XalanDOMString s_functionKeyString;
+
+static XalanDOMString s_orString;
+
+static XalanDOMString s_andString;
+
+static XalanDOMString s_divString;
+
+static XalanDOMString s_modString;
+
+static XalanDOMString s_quoString;
+
+static XalanDOMString s_dotString;
+
+static XalanDOMString s_dotDotString;
-static XalanDOMString FUNC_ID_STRING;
+static XalanDOMString s_axisString;
-static XalanDOMString FUNC_KEY_STRING;
+static XalanDOMString s_attributeString;
+static XalanDOMString s_childString;
-const XalanDOMString& XPathProcessorImpl::FUNC_ID_STRING = ::FUNC_ID_STRING;
+const XalanDOMString& XPathProcessorImpl::s_functionIDString = ::s_functionIDString;
+
// This shouldn't really be here, since it's not part of the XPath standard,
// but rather a part ofthe XSLT standard.
-const XalanDOMString& XPathProcessorImpl::FUNC_KEY_STRING = ::FUNC_KEY_STRING;
+const XalanDOMString& XPathProcessorImpl::s_functionKeyString = ::s_functionKeyString;
+
+const XalanDOMString& XPathProcessorImpl::s_orString = ::s_orString;
+
+const XalanDOMString& XPathProcessorImpl::s_andString = ::s_andString;
+
+const XalanDOMString& XPathProcessorImpl::s_divString = ::s_divString;
+
+const XalanDOMString& XPathProcessorImpl::s_modString = ::s_modString;
+
+const XalanDOMString& XPathProcessorImpl::s_quoString = ::s_quoString;
+
+const XalanDOMString& XPathProcessorImpl::s_dotString = ::s_dotString;
+
+const XalanDOMString& XPathProcessorImpl::s_dotDotString = ::s_dotDotString;
+
+const XalanDOMString& XPathProcessorImpl::s_axisString = ::s_axisString;
+
+const XalanDOMString& XPathProcessorImpl::s_attributeString = ::s_attributeString;
+
+const XalanDOMString& XPathProcessorImpl::s_childString = ::s_childString;
static XPathProcessorImpl::KeywordsMapType s_keywords;
@@ -2425,8 +2471,18 @@
XPathProcessorImpl::initializeAxisNamesTable(::s_axisNames);
XPathProcessorImpl::initializeNodeTypesTable(::s_nodeTypes);
- ::FUNC_ID_STRING = XALAN_STATIC_UCODE_STRING("id");
- ::FUNC_KEY_STRING = XALAN_STATIC_UCODE_STRING("key");
+ ::s_functionIDString = XALAN_STATIC_UCODE_STRING("id");
+ ::s_functionKeyString = XALAN_STATIC_UCODE_STRING("key");
+ ::s_orString = XALAN_STATIC_UCODE_STRING("or");
+ ::s_andString = XALAN_STATIC_UCODE_STRING("and");
+ ::s_divString = XALAN_STATIC_UCODE_STRING("div");
+ ::s_modString = XALAN_STATIC_UCODE_STRING("mod");
+ ::s_quoString = XALAN_STATIC_UCODE_STRING("quo");
+ ::s_dotString = XALAN_STATIC_UCODE_STRING(".");
+ ::s_dotDotString = XALAN_STATIC_UCODE_STRING("..");
+ ::s_axisString = XALAN_STATIC_UCODE_STRING("::");
+ ::s_attributeString = XALAN_STATIC_UCODE_STRING("attribute");
+ ::s_childString = XALAN_STATIC_UCODE_STRING("child");
}
@@ -2439,6 +2495,16 @@
AxisNamesMapType().swap(::s_axisNames);
NodeTypesMapType().swap(::s_nodeTypes);
- clear(::FUNC_ID_STRING);
- clear(::FUNC_KEY_STRING);
+ clear(::s_functionIDString);
+ clear(::s_functionKeyString);
+ clear(::s_orString);
+ clear(::s_andString);
+ clear(::s_divString);
+ clear(::s_modString);
+ clear(::s_quoString);
+ clear(::s_dotString);
+ clear(::s_dotDotString);
+ clear(::s_axisString);
+ clear(::s_attributeString);
+ clear(::s_childString);
}
1.10 +22 -2 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XPathProcessorImpl.hpp 2000/08/31 19:43:05 1.9
+++ XPathProcessorImpl.hpp 2000/09/05 02:24:51 1.10
@@ -815,12 +815,32 @@
// This shouldn't really be here, since it duplicates a string that is part
// of the information that is maintained by the class XPathFunctionTable,
// but this is a reasonable optimization.
- static const XalanDOMString& FUNC_ID_STRING;
+ static const XalanDOMString& s_functionIDString;
// This shouldn't really be here, since it's not part of the XPath standard,
// but rather a part ofthe XSLT standard.
- static const XalanDOMString& FUNC_KEY_STRING;
+ static const XalanDOMString& s_functionKeyString;
+
+ static const XalanDOMString& s_orString;
+
+ static const XalanDOMString& s_andString;
+
+ static const XalanDOMString& s_divString;
+
+ static const XalanDOMString& s_modString;
+
+ static const XalanDOMString& s_quoString;
+
+ static const XalanDOMString& s_dotString;
+
+ static const XalanDOMString& s_dotDotString;
+
+ static const XalanDOMString& s_axisString;
+
+ static const XalanDOMString& s_attributeString;
+
+ static const XalanDOMString& s_childString;
/**
* Map of keyword names to token values.
1.7 +40 -12 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AVT.cpp 2000/06/23 14:30:14 1.6
+++ AVT.cpp 2000/09/05 02:24:52 1.7
@@ -65,6 +65,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
#include <PlatformSupport/STLHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -74,6 +75,33 @@
+static const XalanDOMChar theTokenDelimiterCharacters[] =
+{
+ XalanUnicode::charLeftCurlyBracket,
+ XalanUnicode::charRightCurlyBracket,
+ XalanUnicode::charApostrophe,
+ XalanUnicode::charQuoteMark,
+ 0
+};
+
+
+
+static const XalanDOMChar theLeftCurlyBracketString[] =
+{
+ XalanUnicode::charLeftCurlyBracket,
+ 0
+};
+
+
+
+static const XalanDOMChar theRightCurlyBracketString[] =
+{
+ XalanUnicode::charRightCurlyBracket,
+ 0
+};
+
+
+
/**
* Construct an AVT by parsing the string, and either
* constructing a vector of AVTParts, or simply hold
@@ -90,7 +118,7 @@
m_simpleString(),
m_pcType(type)
{
- StringTokenizer tokenizer(stringedValue, XALAN_STATIC_UCODE_STRING("{}\"\'"), true);
+ StringTokenizer tokenizer(stringedValue, theTokenDelimiterCharacters, true);
const unsigned int nTokens = tokenizer.countTokens();
@@ -127,11 +155,11 @@
switch(theChar)
{
- case('{'):
+ case(XalanUnicode::charLeftCurlyBracket):
{
// Attribute Value Template start
lookahead = tokenizer.nextToken();
- if(equals(lookahead, XALAN_STATIC_UCODE_STRING("{")))
+ if(equals(lookahead, theLeftCurlyBracketString))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
@@ -151,19 +179,19 @@
clear(exprBuffer);
- while(length(lookahead) > 0 && !equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
+ while(length(lookahead) > 0 && !equals(lookahead, theRightCurlyBracketString))
{
if(length(lookahead) == 1)
{
switch(charAt(lookahead, 0))
{
- case '\'':
- case '\"':
+ case XalanUnicode::charApostrophe:
+ case XalanUnicode::charQuoteMark:
{
// String start
append(exprBuffer, lookahead);
- const XalanDOMString quote = lookahead;
+ const XalanDOMString quote = lookahead;
// Consume stuff 'till next quote
lookahead = tokenizer.nextToken();
@@ -179,7 +207,7 @@
break;
}
- case '{':
+ case XalanUnicode::charLeftCurlyBracket:
{
// What's another curly doing here?
error = "Error: Can not have \"{\" within expression.";
@@ -201,7 +229,7 @@
lookahead = tokenizer.nextToken();
} // end while(!equals(lookahead, "}"))
- assert(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")));
+ assert(equals(lookahead, theRightCurlyBracketString));
// Proper close of attribute template. Evaluate the
// expression.
@@ -220,11 +248,11 @@
}
break;
}
- case('}'):
+ case(XalanUnicode::charRightCurlyBracket):
{
lookahead = tokenizer.nextToken();
- if(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
+ if(equals(lookahead, theRightCurlyBracketString))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
@@ -236,7 +264,7 @@
// Illegal, I think...
constructionContext.warn("Found \"}\" but no attribute template open!");
- append(buffer, XALAN_STATIC_UCODE_STRING("}"));
+ append(buffer, theRightCurlyBracketString);
// leave the lookahead to be processed by the next round.
}
break;
1.10 +70 -1 xml-xalan/c/src/XSLT/Constants.cpp
Index: Constants.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Constants.cpp 2000/08/31 19:43:08 1.9
+++ Constants.cpp 2000/09/05 02:24:52 1.10
@@ -75,6 +75,7 @@
static XalanDOMString ATTRNAME_CLASSID;
static XalanDOMString ATTRNAME_CODEBASE;
static XalanDOMString ATTRNAME_CODETYPE;
+static XalanDOMString ATTRNAME_COMPONENTS;
static XalanDOMString ATTRNAME_CONDITION;
static XalanDOMString ATTRNAME_COPYTYPE;
static XalanDOMString ATTRNAME_COUNT;
@@ -93,6 +94,7 @@
static XalanDOMString ATTRNAME_EXTENSIONELEMENTPREFIXES;
static XalanDOMString ATTRNAME_FORMAT;
static XalanDOMString ATTRNAME_FROM;
+static XalanDOMString ATTRNAME_FUNCTIONS;
static XalanDOMString ATTRNAME_GROUPINGSEPARATOR;
static XalanDOMString ATTRNAME_GROUPINGSIZE;
static XalanDOMString ATTRNAME_HREF;
@@ -127,12 +129,15 @@
static XalanDOMString ATTRNAME_PATTERNSEPARATOR;
static XalanDOMString ATTRNAME_PERCENT;
static XalanDOMString ATTRNAME_PERMILLE;
+static XalanDOMString ATTRNAME_PREFIX;
static XalanDOMString ATTRNAME_PRIORITY;
static XalanDOMString ATTRNAME_REFID;
static XalanDOMString ATTRNAME_RESULTNS;
static XalanDOMString ATTRNAME_RESULT_PREFIX;
+static XalanDOMString ATTRNAME_SCRIPT;
static XalanDOMString ATTRNAME_SELECT;
static XalanDOMString ATTRNAME_SEQUENCESRC;
+static XalanDOMString ATTRNAME_SRC;
static XalanDOMString ATTRNAME_STYLE;
static XalanDOMString ATTRNAME_STYLESHEET_PREFIX;
static XalanDOMString ATTRNAME_TERMINATE;
@@ -148,6 +153,8 @@
static XalanDOMString ATTRNAME_XMLSPACE;
static XalanDOMString ATTRNAME_ZERODIGIT;
+static XalanDOMString ATTRTYPE_CDATA;
+
static XalanDOMString ATTRVAL_ALPHABETIC;
static XalanDOMString ATTRVAL_ANCESTOR;
static XalanDOMString ATTRVAL_ANY;
@@ -155,7 +162,9 @@
static XalanDOMString ATTRVAL_CASEORDER_UPPER;
static XalanDOMString ATTRVAL_DATATYPE_NUMBER;
static XalanDOMString ATTRVAL_DATATYPE_TEXT;
+static XalanDOMString ATTRVAL_DEFAULT;
static XalanDOMString ATTRVAL_DEFAULT_PREFIX;
+static XalanDOMString ATTRVAL_DEFAULT_TEXT_RULE;
static XalanDOMString ATTRVAL_ID;
static XalanDOMString ATTRVAL_INFINITY;
static XalanDOMString ATTRVAL_MULTI;
@@ -169,15 +178,20 @@
static XalanDOMString ATTRVAL_OUTPUT_METHOD_XML;
static XalanDOMString ATTRVAL_PARENT;
static XalanDOMString ATTRVAL_PRESERVE;
+static XalanDOMString ATTRVAL_SIMPLE;
static XalanDOMString ATTRVAL_SINGLE;
static XalanDOMString ATTRVAL_STRIP;
static XalanDOMString ATTRVAL_THIS;
static XalanDOMString ATTRVAL_YES;
+
static XalanDOMString DEFAULT_DECIMAL_FORMAT;
+static XalanDOMString DEFAULT_WHITESPACE_SEPARATOR_STRING;
+
static XalanDOMString ELEMNAME_ANCHOR_STRING;
static XalanDOMString ELEMNAME_ANY_STRING;
static XalanDOMString ELEMNAME_APPLY_IMPORTS_STRING;
static XalanDOMString ELEMNAME_APPLY_TEMPLATES_STRING;
+static XalanDOMString ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING;
static XalanDOMString ELEMNAME_ARG_STRING;
static XalanDOMString ELEMNAME_ATTRIBUTESET_STRING;
static XalanDOMString ELEMNAME_ATTRIBUTE_STRING;
@@ -233,16 +247,20 @@
static XalanDOMString ELEMNAME_TARGETPI_STRING;
static XalanDOMString ELEMNAME_TARGETTEXT_STRING;
static XalanDOMString ELEMNAME_TEMPLATE_STRING;
+static XalanDOMString ELEMNAME_TEMPLATE_WITH_PREFIX_STRING;
static XalanDOMString ELEMNAME_TEXT_STRING;
static XalanDOMString ELEMNAME_TRANSFORM_STRING;
static XalanDOMString ELEMNAME_URL_STRING;
static XalanDOMString ELEMNAME_USE_STRING;
static XalanDOMString ELEMNAME_VALUEOF_STRING;
+static XalanDOMString ELEMNAME_VALUEOF_WITH_PREFIX_STRING;
static XalanDOMString ELEMNAME_VARIABLE_STRING;
static XalanDOMString ELEMNAME_WHEN_STRING;
static XalanDOMString ELEMNAME_WITHPARAM_STRING;
+
static XalanDOMString PSEUDONAME_ANY;
static XalanDOMString PSEUDONAME_COMMENT;
+static XalanDOMString PSEUDONAME_NODE;
static XalanDOMString PSEUDONAME_OTHER;
static XalanDOMString PSEUDONAME_PI;
static XalanDOMString PSEUDONAME_ROOT;
@@ -260,6 +278,7 @@
const XalanDOMString& Constants::ATTRNAME_CLASSID = ::ATTRNAME_CLASSID;
const XalanDOMString& Constants::ATTRNAME_CODEBASE = ::ATTRNAME_CODEBASE;
const XalanDOMString& Constants::ATTRNAME_CODETYPE = ::ATTRNAME_CODETYPE;
+const XalanDOMString& Constants::ATTRNAME_COMPONENTS = ::ATTRNAME_COMPONENTS;
const XalanDOMString& Constants::ATTRNAME_CONDITION = ::ATTRNAME_CONDITION;
const XalanDOMString& Constants::ATTRNAME_COPYTYPE = ::ATTRNAME_COPYTYPE;
const XalanDOMString& Constants::ATTRNAME_COUNT = ::ATTRNAME_COUNT;
@@ -278,6 +297,7 @@
const XalanDOMString& Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES = ::ATTRNAME_EXTENSIONELEMENTPREFIXES;
const XalanDOMString& Constants::ATTRNAME_FORMAT = ::ATTRNAME_FORMAT;
const XalanDOMString& Constants::ATTRNAME_FROM = ::ATTRNAME_FROM;
+const XalanDOMString& Constants::ATTRNAME_FUNCTIONS = ::ATTRNAME_FUNCTIONS;
const XalanDOMString& Constants::ATTRNAME_GROUPINGSEPARATOR = ::ATTRNAME_GROUPINGSEPARATOR;
const XalanDOMString& Constants::ATTRNAME_GROUPINGSIZE = ::ATTRNAME_GROUPINGSIZE;
const XalanDOMString& Constants::ATTRNAME_HREF = ::ATTRNAME_HREF;
@@ -312,12 +332,15 @@
const XalanDOMString& Constants::ATTRNAME_PATTERNSEPARATOR = ::ATTRNAME_PATTERNSEPARATOR;
const XalanDOMString& Constants::ATTRNAME_PERCENT = ::ATTRNAME_PERCENT;
const XalanDOMString& Constants::ATTRNAME_PERMILLE = ::ATTRNAME_PERMILLE;
+const XalanDOMString& Constants::ATTRNAME_PREFIX = ::ATTRNAME_PREFIX;
const XalanDOMString& Constants::ATTRNAME_PRIORITY = ::ATTRNAME_PRIORITY;
const XalanDOMString& Constants::ATTRNAME_REFID = ::ATTRNAME_REFID;
const XalanDOMString& Constants::ATTRNAME_RESULTNS = ::ATTRNAME_RESULTNS;
const XalanDOMString& Constants::ATTRNAME_RESULT_PREFIX = ::ATTRNAME_RESULT_PREFIX;
+const XalanDOMString& Constants::ATTRNAME_SCRIPT = ::ATTRNAME_SCRIPT;
const XalanDOMString& Constants::ATTRNAME_SELECT = ::ATTRNAME_SELECT;
const XalanDOMString& Constants::ATTRNAME_SEQUENCESRC = ::ATTRNAME_SEQUENCESRC;
+const XalanDOMString& Constants::ATTRNAME_SRC = ::ATTRNAME_SRC;
const XalanDOMString& Constants::ATTRNAME_STYLE = ::ATTRNAME_STYLE;
const XalanDOMString& Constants::ATTRNAME_STYLESHEET_PREFIX = ::ATTRNAME_STYLESHEET_PREFIX;
const XalanDOMString& Constants::ATTRNAME_TERMINATE = ::ATTRNAME_TERMINATE;
@@ -332,6 +355,9 @@
const XalanDOMString& Constants::ATTRNAME_XMLNSDEF = ::ATTRNAME_XMLNSDEF;
const XalanDOMString& Constants::ATTRNAME_XMLSPACE = ::ATTRNAME_XMLSPACE;
const XalanDOMString& Constants::ATTRNAME_ZERODIGIT = ::ATTRNAME_ZERODIGIT;
+
+const XalanDOMString& Constants::ATTRTYPE_CDATA = ::ATTRTYPE_CDATA;
+
const XalanDOMString& Constants::ATTRVAL_ALPHABETIC = ::ATTRVAL_ALPHABETIC;
const XalanDOMString& Constants::ATTRVAL_ANCESTOR = ::ATTRVAL_ANCESTOR;
const XalanDOMString& Constants::ATTRVAL_ANY = ::ATTRVAL_ANY;
@@ -339,7 +365,9 @@
const XalanDOMString& Constants::ATTRVAL_CASEORDER_UPPER = ::ATTRVAL_CASEORDER_UPPER;
const XalanDOMString& Constants::ATTRVAL_DATATYPE_NUMBER = ::ATTRVAL_DATATYPE_NUMBER;
const XalanDOMString& Constants::ATTRVAL_DATATYPE_TEXT = ::ATTRVAL_DATATYPE_TEXT;
+const XalanDOMString& Constants::ATTRVAL_DEFAULT = ::ATTRVAL_DEFAULT;
const XalanDOMString& Constants::ATTRVAL_DEFAULT_PREFIX = ::ATTRVAL_DEFAULT_PREFIX;
+const XalanDOMString& Constants::ATTRVAL_DEFAULT_TEXT_RULE = ::ATTRVAL_DEFAULT_TEXT_RULE;
const XalanDOMString& Constants::ATTRVAL_ID = ::ATTRVAL_ID;
const XalanDOMString& Constants::ATTRVAL_INFINITY = ::ATTRVAL_INFINITY;
const XalanDOMString& Constants::ATTRVAL_MULTI = ::ATTRVAL_MULTI;
@@ -353,15 +381,20 @@
const XalanDOMString& Constants::ATTRVAL_OUTPUT_METHOD_XML = ::ATTRVAL_OUTPUT_METHOD_XML;
const XalanDOMString& Constants::ATTRVAL_PARENT = ::ATTRVAL_PARENT;
const XalanDOMString& Constants::ATTRVAL_PRESERVE = ::ATTRVAL_PRESERVE;
+const XalanDOMString& Constants::ATTRVAL_SIMPLE = ::ATTRVAL_SIMPLE;
const XalanDOMString& Constants::ATTRVAL_SINGLE = ::ATTRVAL_SINGLE;
const XalanDOMString& Constants::ATTRVAL_STRIP = ::ATTRVAL_STRIP;
const XalanDOMString& Constants::ATTRVAL_THIS = ::ATTRVAL_THIS;
const XalanDOMString& Constants::ATTRVAL_YES = ::ATTRVAL_YES;
+
const XalanDOMString& Constants::DEFAULT_DECIMAL_FORMAT = ::DEFAULT_DECIMAL_FORMAT;
+const XalanDOMString& Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING = ::DEFAULT_WHITESPACE_SEPARATOR_STRING;
+
const XalanDOMString& Constants::ELEMNAME_ANCHOR_STRING = ::ELEMNAME_ANCHOR_STRING;
const XalanDOMString& Constants::ELEMNAME_ANY_STRING = ::ELEMNAME_ANY_STRING;
const XalanDOMString& Constants::ELEMNAME_APPLY_IMPORTS_STRING = ::ELEMNAME_APPLY_IMPORTS_STRING;
const XalanDOMString& Constants::ELEMNAME_APPLY_TEMPLATES_STRING = ::ELEMNAME_APPLY_TEMPLATES_STRING;
+const XalanDOMString& Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING = ::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING;
const XalanDOMString& Constants::ELEMNAME_ARG_STRING = ::ELEMNAME_ARG_STRING;
const XalanDOMString& Constants::ELEMNAME_ATTRIBUTESET_STRING = ::ELEMNAME_ATTRIBUTESET_STRING;
const XalanDOMString& Constants::ELEMNAME_ATTRIBUTE_STRING = ::ELEMNAME_ATTRIBUTE_STRING;
@@ -417,14 +450,17 @@
const XalanDOMString& Constants::ELEMNAME_TARGETPI_STRING = ::ELEMNAME_TARGETPI_STRING;
const XalanDOMString& Constants::ELEMNAME_TARGETTEXT_STRING = ::ELEMNAME_TARGETTEXT_STRING;
const XalanDOMString& Constants::ELEMNAME_TEMPLATE_STRING = ::ELEMNAME_TEMPLATE_STRING;
+const XalanDOMString& Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING = ::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING;
const XalanDOMString& Constants::ELEMNAME_TEXT_STRING = ::ELEMNAME_TEXT_STRING;
const XalanDOMString& Constants::ELEMNAME_TRANSFORM_STRING = ::ELEMNAME_TRANSFORM_STRING;
const XalanDOMString& Constants::ELEMNAME_URL_STRING = ::ELEMNAME_URL_STRING;
const XalanDOMString& Constants::ELEMNAME_USE_STRING = ::ELEMNAME_USE_STRING;
const XalanDOMString& Constants::ELEMNAME_VALUEOF_STRING = ::ELEMNAME_VALUEOF_STRING;
+const XalanDOMString& Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING = ::ELEMNAME_VALUEOF_WITH_PREFIX_STRING;
const XalanDOMString& Constants::ELEMNAME_VARIABLE_STRING = ::ELEMNAME_VARIABLE_STRING;
const XalanDOMString& Constants::ELEMNAME_WHEN_STRING = ::ELEMNAME_WHEN_STRING;
const XalanDOMString& Constants::ELEMNAME_WITHPARAM_STRING = ::ELEMNAME_WITHPARAM_STRING;
+
const XalanDOMString& Constants::PSEUDONAME_ANY = ::PSEUDONAME_ANY;
const XalanDOMString& Constants::PSEUDONAME_COMMENT = ::PSEUDONAME_COMMENT;
const XalanDOMString& Constants::PSEUDONAME_OTHER = ::PSEUDONAME_OTHER;
@@ -447,6 +483,7 @@
::ATTRNAME_CLASSID = XALAN_STATIC_UCODE_STRING("classid");
::ATTRNAME_CODEBASE = XALAN_STATIC_UCODE_STRING("codebase");
::ATTRNAME_CODETYPE = XALAN_STATIC_UCODE_STRING("type");
+ ::ATTRNAME_COMPONENTS = XALAN_STATIC_UCODE_STRING("component");
::ATTRNAME_CONDITION = XALAN_STATIC_UCODE_STRING("condition");
::ATTRNAME_COPYTYPE = XALAN_STATIC_UCODE_STRING("copy-type");
::ATTRNAME_COUNT = XALAN_STATIC_UCODE_STRING("count");
@@ -465,6 +502,7 @@
::ATTRNAME_EXTENSIONELEMENTPREFIXES = XALAN_STATIC_UCODE_STRING("extension-element-prefixes");
::ATTRNAME_FORMAT = XALAN_STATIC_UCODE_STRING("format");
::ATTRNAME_FROM = XALAN_STATIC_UCODE_STRING("from");
+ ::ATTRNAME_FUNCTIONS = XALAN_STATIC_UCODE_STRING("functions");
::ATTRNAME_GROUPINGSEPARATOR = XALAN_STATIC_UCODE_STRING("grouping-separator");
::ATTRNAME_GROUPINGSIZE = XALAN_STATIC_UCODE_STRING("grouping-size");
::ATTRNAME_HREF = XALAN_STATIC_UCODE_STRING("href");
@@ -499,12 +537,15 @@
::ATTRNAME_PATTERNSEPARATOR = XALAN_STATIC_UCODE_STRING("pattern-separator");
::ATTRNAME_PERCENT = XALAN_STATIC_UCODE_STRING("percent");
::ATTRNAME_PERMILLE = XALAN_STATIC_UCODE_STRING("per-mille");
+ ::ATTRNAME_PREFIX = XALAN_STATIC_UCODE_STRING("prefix");
::ATTRNAME_PRIORITY = XALAN_STATIC_UCODE_STRING("priority");
::ATTRNAME_REFID = XALAN_STATIC_UCODE_STRING("refID");
::ATTRNAME_RESULTNS = XALAN_STATIC_UCODE_STRING("result-ns");
::ATTRNAME_RESULT_PREFIX = XALAN_STATIC_UCODE_STRING("result-prefix");
+ ::ATTRNAME_SCRIPT = XALAN_STATIC_UCODE_STRING("script");
::ATTRNAME_SELECT = XALAN_STATIC_UCODE_STRING("select");
::ATTRNAME_SEQUENCESRC = XALAN_STATIC_UCODE_STRING("sequence-src");
+ ::ATTRNAME_SRC = XALAN_STATIC_UCODE_STRING("src");
::ATTRNAME_STYLE = XALAN_STATIC_UCODE_STRING("style");
::ATTRNAME_STYLESHEET_PREFIX = XALAN_STATIC_UCODE_STRING("stylesheet-prefix");
::ATTRNAME_TERMINATE = XALAN_STATIC_UCODE_STRING("terminate");
@@ -520,6 +561,8 @@
::ATTRNAME_XMLSPACE = XALAN_STATIC_UCODE_STRING("xml:space");
::ATTRNAME_ZERODIGIT = XALAN_STATIC_UCODE_STRING("zero-digit");
+ ::ATTRTYPE_CDATA = XALAN_STATIC_UCODE_STRING("CDATA");
+
::ATTRVAL_ALPHABETIC = XALAN_STATIC_UCODE_STRING("alphabetic");
::ATTRVAL_ANCESTOR = XALAN_STATIC_UCODE_STRING("ancestor");
::ATTRVAL_ANY = XALAN_STATIC_UCODE_STRING("any");
@@ -527,7 +570,9 @@
::ATTRVAL_CASEORDER_UPPER = XALAN_STATIC_UCODE_STRING("upper-first");
::ATTRVAL_DATATYPE_NUMBER = XALAN_STATIC_UCODE_STRING("number");
::ATTRVAL_DATATYPE_TEXT = XALAN_STATIC_UCODE_STRING("text");
+ ::ATTRVAL_DEFAULT = XALAN_STATIC_UCODE_STRING("default");
::ATTRVAL_DEFAULT_PREFIX = XALAN_STATIC_UCODE_STRING("#default");
+ ::ATTRVAL_DEFAULT_TEXT_RULE = XALAN_STATIC_UCODE_STRING("text() | @*");
::ATTRVAL_ID = XALAN_STATIC_UCODE_STRING("id");
::ATTRVAL_INFINITY = XALAN_STATIC_UCODE_STRING("Infinity");
::ATTRVAL_MULTI = XALAN_STATIC_UCODE_STRING("multiple");
@@ -541,15 +586,20 @@
::ATTRVAL_OUTPUT_METHOD_XML = XALAN_STATIC_UCODE_STRING("xml");
::ATTRVAL_PARENT = XALAN_STATIC_UCODE_STRING("..");
::ATTRVAL_PRESERVE = XALAN_STATIC_UCODE_STRING("preserve");
+ ::ATTRVAL_SIMPLE = XALAN_STATIC_UCODE_STRING("simple");
::ATTRVAL_SINGLE = XALAN_STATIC_UCODE_STRING("single");
::ATTRVAL_STRIP = XALAN_STATIC_UCODE_STRING("strip");
::ATTRVAL_THIS = XALAN_STATIC_UCODE_STRING(".");
::ATTRVAL_YES = XALAN_STATIC_UCODE_STRING("yes");
+
::DEFAULT_DECIMAL_FORMAT = XALAN_STATIC_UCODE_STRING("#default");
+ ::DEFAULT_WHITESPACE_SEPARATOR_STRING = XALAN_STATIC_UCODE_STRING(" \t\n\r");
+
::ELEMNAME_ANCHOR_STRING = XALAN_STATIC_UCODE_STRING("anchor");
::ELEMNAME_ANY_STRING = XALAN_STATIC_UCODE_STRING("any");
::ELEMNAME_APPLY_IMPORTS_STRING = XALAN_STATIC_UCODE_STRING("apply-imports");
::ELEMNAME_APPLY_TEMPLATES_STRING = XALAN_STATIC_UCODE_STRING("apply-templates");
+ ::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING = XALAN_STATIC_UCODE_STRING("xsl:apply-templates");
::ELEMNAME_ARG_STRING = XALAN_STATIC_UCODE_STRING("arg");
::ELEMNAME_ATTRIBUTESET_STRING = XALAN_STATIC_UCODE_STRING("attribute-set");
::ELEMNAME_ATTRIBUTE_STRING = XALAN_STATIC_UCODE_STRING("attribute");
@@ -605,16 +655,20 @@
::ELEMNAME_TARGETPI_STRING = XALAN_STATIC_UCODE_STRING("target-pi");
::ELEMNAME_TARGETTEXT_STRING = XALAN_STATIC_UCODE_STRING("target-text");
::ELEMNAME_TEMPLATE_STRING = XALAN_STATIC_UCODE_STRING("template");
+ ::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING = XALAN_STATIC_UCODE_STRING("xsl:template");
::ELEMNAME_TEXT_STRING = XALAN_STATIC_UCODE_STRING("text");
::ELEMNAME_TRANSFORM_STRING = XALAN_STATIC_UCODE_STRING("transform");
::ELEMNAME_URL_STRING = XALAN_STATIC_UCODE_STRING("uri");
::ELEMNAME_USE_STRING = XALAN_STATIC_UCODE_STRING("use");
::ELEMNAME_VALUEOF_STRING = XALAN_STATIC_UCODE_STRING("value-of");
+ ::ELEMNAME_VALUEOF_WITH_PREFIX_STRING = XALAN_STATIC_UCODE_STRING("xsl:value-of");
::ELEMNAME_VARIABLE_STRING = XALAN_STATIC_UCODE_STRING("variable");
::ELEMNAME_WHEN_STRING = XALAN_STATIC_UCODE_STRING("when");
::ELEMNAME_WITHPARAM_STRING = XALAN_STATIC_UCODE_STRING("with-param");
+
::PSEUDONAME_ANY = XALAN_STATIC_UCODE_STRING("*");
::PSEUDONAME_COMMENT = XALAN_STATIC_UCODE_STRING("#comment");
+ ::PSEUDONAME_NODE = XALAN_STATIC_UCODE_STRING("node()");
::PSEUDONAME_OTHER = XALAN_STATIC_UCODE_STRING("*");
::PSEUDONAME_PI = XALAN_STATIC_UCODE_STRING("#pi");
::PSEUDONAME_ROOT = XALAN_STATIC_UCODE_STRING("/");
@@ -623,7 +677,6 @@
-
void
Constants::terminate()
{
@@ -637,6 +690,7 @@
clear(::ATTRNAME_CLASSID);
clear(::ATTRNAME_CODEBASE);
clear(::ATTRNAME_CODETYPE);
+ clear(::ATTRNAME_COMPONENTS);
clear(::ATTRNAME_CONDITION);
clear(::ATTRNAME_COPYTYPE);
clear(::ATTRNAME_COUNT);
@@ -655,6 +709,7 @@
clear(::ATTRNAME_EXTENSIONELEMENTPREFIXES);
clear(::ATTRNAME_FORMAT);
clear(::ATTRNAME_FROM);
+ clear(::ATTRNAME_FUNCTIONS);
clear(::ATTRNAME_GROUPINGSEPARATOR);
clear(::ATTRNAME_GROUPINGSIZE);
clear(::ATTRNAME_HREF);
@@ -689,12 +744,15 @@
clear(::ATTRNAME_PATTERNSEPARATOR);
clear(::ATTRNAME_PERCENT);
clear(::ATTRNAME_PERMILLE);
+ clear(::ATTRNAME_PREFIX);
clear(::ATTRNAME_PRIORITY);
clear(::ATTRNAME_REFID);
clear(::ATTRNAME_RESULTNS);
clear(::ATTRNAME_RESULT_PREFIX);
+ clear(::ATTRNAME_SCRIPT);
clear(::ATTRNAME_SELECT);
clear(::ATTRNAME_SEQUENCESRC);
+ clear(::ATTRNAME_SRC);
clear(::ATTRNAME_STYLE);
clear(::ATTRNAME_STYLESHEET_PREFIX);
clear(::ATTRNAME_TERMINATE);
@@ -717,7 +775,9 @@
clear(::ATTRVAL_CASEORDER_UPPER);
clear(::ATTRVAL_DATATYPE_NUMBER);
clear(::ATTRVAL_DATATYPE_TEXT);
+ clear(::ATTRVAL_DEFAULT);
clear(::ATTRVAL_DEFAULT_PREFIX);
+ clear(::ATTRVAL_DEFAULT_TEXT_RULE);
clear(::ATTRVAL_ID);
clear(::ATTRVAL_INFINITY);
clear(::ATTRVAL_MULTI);
@@ -731,15 +791,20 @@
clear(::ATTRVAL_OUTPUT_METHOD_XML);
clear(::ATTRVAL_PARENT);
clear(::ATTRVAL_PRESERVE);
+ clear(::ATTRVAL_SIMPLE);
clear(::ATTRVAL_SINGLE);
clear(::ATTRVAL_STRIP);
clear(::ATTRVAL_THIS);
clear(::ATTRVAL_YES);
+
clear(::DEFAULT_DECIMAL_FORMAT);
+ clear(::DEFAULT_WHITESPACE_SEPARATOR_STRING);
+
clear(::ELEMNAME_ANCHOR_STRING);
clear(::ELEMNAME_ANY_STRING);
clear(::ELEMNAME_APPLY_IMPORTS_STRING);
clear(::ELEMNAME_APPLY_TEMPLATES_STRING);
+ clear(::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING);
clear(::ELEMNAME_ARG_STRING);
clear(::ELEMNAME_ATTRIBUTESET_STRING);
clear(::ELEMNAME_ATTRIBUTE_STRING);
@@ -795,16 +860,20 @@
clear(::ELEMNAME_TARGETPI_STRING);
clear(::ELEMNAME_TARGETTEXT_STRING);
clear(::ELEMNAME_TEMPLATE_STRING);
+ clear(::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING);
clear(::ELEMNAME_TEXT_STRING);
clear(::ELEMNAME_TRANSFORM_STRING);
clear(::ELEMNAME_URL_STRING);
clear(::ELEMNAME_USE_STRING);
clear(::ELEMNAME_VALUEOF_STRING);
+ clear(::ELEMNAME_VALUEOF_WITH_PREFIX_STRING);
clear(::ELEMNAME_VARIABLE_STRING);
clear(::ELEMNAME_WHEN_STRING);
clear(::ELEMNAME_WITHPARAM_STRING);
+
clear(::PSEUDONAME_ANY);
clear(::PSEUDONAME_COMMENT);
+ clear(::PSEUDONAME_NODE);
clear(::PSEUDONAME_OTHER);
clear(::PSEUDONAME_PI);
clear(::PSEUDONAME_ROOT);
1.12 +23 -4 xml-xalan/c/src/XSLT/Constants.hpp
Index: Constants.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Constants.hpp 2000/08/31 19:43:09 1.11
+++ Constants.hpp 2000/09/05 02:24:52 1.12
@@ -195,6 +195,7 @@
static const XalanDOMString& ELEMNAME_ANY_STRING; // pattern-by-example support
static const XalanDOMString& ELEMNAME_APPLY_IMPORTS_STRING;
static const XalanDOMString& ELEMNAME_APPLY_TEMPLATES_STRING;
+ static const XalanDOMString& ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING;
static const XalanDOMString& ELEMNAME_ARG_STRING;
static const XalanDOMString& ELEMNAME_ATTRIBUTESET_STRING;
static const XalanDOMString& ELEMNAME_ATTRIBUTE_STRING; // pattern-by-example support
@@ -244,11 +245,13 @@
static const XalanDOMString& ELEMNAME_TARGETPI_STRING;
static const XalanDOMString& ELEMNAME_TARGETTEXT_STRING;
static const XalanDOMString& ELEMNAME_TEMPLATE_STRING;
+ static const XalanDOMString& ELEMNAME_TEMPLATE_WITH_PREFIX_STRING;
static const XalanDOMString& ELEMNAME_TEXT_STRING;
static const XalanDOMString& ELEMNAME_TRANSFORM_STRING;
static const XalanDOMString& ELEMNAME_URL_STRING; // pattern-by-example support
static const XalanDOMString& ELEMNAME_USE_STRING;
static const XalanDOMString& ELEMNAME_VALUEOF_STRING;
+ static const XalanDOMString& ELEMNAME_VALUEOF_WITH_PREFIX_STRING;
static const XalanDOMString& ELEMNAME_VARIABLE_STRING;
static const XalanDOMString& ELEMNAME_WHEN_STRING;
static const XalanDOMString& ELEMNAME_COMPONENT_STRING;
@@ -268,6 +271,7 @@
static const XalanDOMString& ATTRNAME_ATTRIBUTE_SET;
static const XalanDOMString& ATTRNAME_CASEORDER;
static const XalanDOMString& ATTRNAME_CLASS;
+ static const XalanDOMString& ATTRNAME_COMPONENTS;
static const XalanDOMString& ATTRNAME_CONDITION;
static const XalanDOMString& ATTRNAME_COPYTYPE;
static const XalanDOMString& ATTRNAME_COUNT;
@@ -285,6 +289,7 @@
static const XalanDOMString& ATTRNAME_EXTENSIONELEMENTPREFIXES;
static const XalanDOMString& ATTRNAME_FORMAT;
static const XalanDOMString& ATTRNAME_FROM;
+ static const XalanDOMString& ATTRNAME_FUNCTIONS;
static const XalanDOMString& ATTRNAME_GROUPINGSEPARATOR;
static const XalanDOMString& ATTRNAME_GROUPINGSIZE;
static const XalanDOMString& ATTRNAME_HREF;
@@ -307,12 +312,15 @@
static const XalanDOMString& ATTRNAME_PATTERNSEPARATOR;
static const XalanDOMString& ATTRNAME_PERCENT;
static const XalanDOMString& ATTRNAME_PERMILLE;
+ static const XalanDOMString& ATTRNAME_PREFIX;
static const XalanDOMString& ATTRNAME_PRIORITY;
static const XalanDOMString& ATTRNAME_REFID;
static const XalanDOMString& ATTRNAME_RESULTNS;
static const XalanDOMString& ATTRNAME_RESULT_PREFIX;
+ static const XalanDOMString& ATTRNAME_SCRIPT;
static const XalanDOMString& ATTRNAME_SELECT;
static const XalanDOMString& ATTRNAME_SEQUENCESRC;
+ static const XalanDOMString& ATTRNAME_SRC;
static const XalanDOMString& ATTRNAME_STYLE;
static const XalanDOMString& ATTRNAME_TERMINATE;
static const XalanDOMString& ATTRNAME_TEST;
@@ -336,6 +344,8 @@
static const XalanDOMString& ATTRNAME_CODEBASE;
static const XalanDOMString& ATTRNAME_METHOD;
+ static const XalanDOMString& ATTRTYPE_CDATA;
+
// For space-att
static const XalanDOMString& ATTRVAL_PRESERVE;
static const XalanDOMString& ATTRVAL_STRIP;
@@ -389,10 +399,16 @@
static const XalanDOMString& ATTRVAL_INFINITY;
static const XalanDOMString& ATTRVAL_NAN;
+ static const XalanDOMString& ATTRVAL_SIMPLE;
+
// Name of default for xsl:decimal-format element
- static const XalanDOMString& DEFAULT_DECIMAL_FORMAT;
+ static const XalanDOMString& DEFAULT_DECIMAL_FORMAT;
+ // Default whitespace separator string for StringTokenizer.
+ static const XalanDOMString& DEFAULT_WHITESPACE_SEPARATOR_STRING;
+ // Value for default text rule
+ static const XalanDOMString& ATTRVAL_DEFAULT_TEXT_RULE;
enum eNumberLevel
{
/*
@@ -405,6 +421,8 @@
MAX_MULTI_COUNTING_DEPTH = 32
};
+ static const XalanDOMString& ATTRVAL_DEFAULT;
+
// For Stylesheet-prefix and result-prefix in xsl:namespace-alias
static const XalanDOMString& ATTRVAL_DEFAULT_PREFIX;
@@ -485,11 +503,12 @@
// These are used mainly for keys in the pattern lookup table,
// for those nodes that don't have unique lookup values
static const XalanDOMString& PSEUDONAME_ANY;
- static const XalanDOMString& PSEUDONAME_ROOT;
- static const XalanDOMString& PSEUDONAME_TEXT;
static const XalanDOMString& PSEUDONAME_COMMENT;
- static const XalanDOMString& PSEUDONAME_PI;
+ static const XalanDOMString& PSEUDONAME_NODE;
static const XalanDOMString& PSEUDONAME_OTHER;
+ static const XalanDOMString& PSEUDONAME_PI;
+ static const XalanDOMString& PSEUDONAME_ROOT;
+ static const XalanDOMString& PSEUDONAME_TEXT;
};
1.9 +11 -6 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemAttribute.cpp 2000/08/31 21:44:07 1.8
+++ ElemAttribute.cpp 2000/09/05 02:24:52 1.9
@@ -63,6 +63,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -167,7 +168,7 @@
const unsigned int origAttrNameLength = length(origAttrName);
- unsigned int indexOfNSSep = origAttrNameLength;
+ unsigned int indexOfNSSep = 0;
XalanDOMString attrNameSpace;
@@ -175,27 +176,31 @@
{
m_pNamespaceAVT->evaluate(attrNameSpace, sourceNode, *this, executionContext);
- if(!isEmpty(attrNameSpace))
+ if(isEmpty(attrNameSpace))
{
+ indexOfNSSep = origAttrNameLength;
+ }
+ else
+ {
XalanDOMString prefix = executionContext.getResultPrefixForNamespace(attrNameSpace);
if(isEmpty(prefix))
{
prefix = executionContext.getUniqueNameSpaceValue();
- XalanDOMString nsDecl = XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator) + prefix;
+ const XalanDOMString nsDecl = XalanDOMString(DOMServices::s_XMLNamespaceWithSeparator) + prefix;
executionContext.addResultAttribute(nsDecl, attrNameSpace);
}
- indexOfNSSep = indexOf(origAttrName, ':');
+ indexOfNSSep = indexOf(origAttrName, XalanUnicode::charColon);
if(indexOfNSSep < origAttrNameLength)
{
attrName = substring(attrName, indexOfNSSep + 1);
}
- attrName = prefix + XalanDOMString(XALAN_STATIC_UCODE_STRING(":")) + attrName;
+ attrName = prefix + DOMServices::s_XMLNamespaceSeparatorString + attrName;
}
}
// Note we are using original attribute name for these tests.
@@ -203,7 +208,7 @@
&& !equals(origAttrName, DOMServices::s_XMLNamespace))
{
// make sure that if a prefix is specified on the attribute name, it is valid
- indexOfNSSep = indexOf(origAttrName, ':');
+ indexOfNSSep = indexOf(origAttrName, XalanUnicode::charColon);
if(indexOfNSSep < origAttrNameLength)
{
1.9 +5 -2 xml-xalan/c/src/XSLT/ElemElement.cpp
Index: ElemElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemElement.cpp 2000/08/28 01:19:40 1.8
+++ ElemElement.cpp 2000/09/05 02:24:52 1.9
@@ -172,8 +172,11 @@
m_nameAVT->evaluate(elemName, sourceNode, *this, executionContext);
bool isIllegalAttribute = false;
+
unsigned int len = length(elemName);
- const unsigned int indexOfNSSep = indexOf(elemName, ':');
+
+ const unsigned int indexOfNSSep = indexOf(elemName, XalanUnicode::charColon);
+
const bool haveNamespace = indexOfNSSep == len ? false : true;
XalanDOMString ns;
@@ -237,7 +240,7 @@
elemName = substring(elemName, indexOfNSSep + 1);
}
- elemName = prefix + XALAN_STATIC_UCODE_STRING(":") + elemName;
+ elemName = prefix + DOMServices::s_XMLNamespaceSeparatorString + elemName;
}
}
1.20 +4 -4 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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ElemLiteralResult.cpp 2000/08/28 01:19:40 1.19
+++ ElemLiteralResult.cpp 2000/09/05 02:24:52 1.20
@@ -113,7 +113,7 @@
const XalanDOMChar* const aname = atts.getName(i);
bool needToProcess = true;
- const unsigned int indexOfNSSep = indexOf(aname, ':');
+ const unsigned int indexOfNSSep = indexOf(aname, XalanUnicode::charColon);
XalanDOMString prefix;
@@ -123,7 +123,7 @@
if(!equals(prefix, DOMServices::s_XMLNamespace))
{
- XalanDOMString ns = getNamespaceForPrefix(prefix);
+ const XalanDOMString ns = getNamespaceForPrefix(prefix);
if(equals(ns, stylesheetTree.getXSLTNamespaceURI()))
{
@@ -202,7 +202,7 @@
const XalanDOMString& theElementName = getElementName();
assert(length(theElementName) > 0);
- const unsigned int indexOfNSSep = indexOf(theElementName, ':');
+ const unsigned int indexOfNSSep = indexOf(theElementName, XalanUnicode::charColon);
const XalanDOMString thePrefix = indexOfNSSep < length(theElementName) ?
substring(theElementName, 0, indexOfNSSep) : XalanDOMString();
@@ -295,7 +295,7 @@
if(isAttrOK == false)
{
- unsigned int indexOfNSSep = indexOf(attrName, ':');
+ const unsigned int indexOfNSSep = indexOf(attrName, XalanUnicode::charColon);
if(indexOfNSSep < length(attrName))
{
1.23 +85 -13 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ElemNumber.cpp 2000/08/31 19:43:09 1.22
+++ ElemNumber.cpp 2000/09/05 02:24:52 1.23
@@ -69,6 +69,7 @@
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/XalanAutoPtr.hpp>
#include <PlatformSupport/XalanNumberFormat.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -290,7 +291,9 @@
break;
}
}
+
XalanNode* const prevSibling = contextCopy->getPreviousSibling();
+
if(prevSibling == 0)
{
contextCopy = executionContext.getParentOfNode(*contextCopy);
@@ -647,7 +650,7 @@
XalanNode* contextNode) const
{
const IntArrayType::size_type nNumbers = theList.size();
- XalanDOMChar numberType('1');
+ XalanDOMChar numberType(XalanUnicode::charDigit_1);
int numberWidth = 1;
XalanDOMString formattedNumber;
@@ -749,18 +752,22 @@
switch(numberType)
{
- case 'A':
+ case XalanUnicode::charLetter_A:
formattedNumber += int2alphaCount(listElement, s_alphaCountTable);
break;
- case 'a':
+
+ case XalanUnicode::charLetter_a:
formattedNumber += toLowerCase(int2alphaCount(listElement, s_alphaCountTable));
break;
- case 'I':
+
+ case XalanUnicode::charLetter_I:
formattedNumber += long2roman(listElement, true);
break;
- case 'i':
+
+ case XalanUnicode::charLetter_i:
formattedNumber += toLowerCase(long2roman(listElement, true));
break;
+
case 0x3042:
case 0x3044:
case 0x30A2:
@@ -799,21 +806,31 @@
return formattedNumber;
}
-XalanDOMString ElemNumber::int2singlealphaCount(int val,
+
+
+XalanDOMString
+ElemNumber::int2singlealphaCount(
+ int val,
const XalanDOMString& table)
{
const int radix = length(table);
// TODO: throw error on out of range input
if (val > radix)
+ {
return XalanDOMString(XALAN_STATIC_UCODE_STRING("#E(") +
LongToDOMString(val) +
XALAN_STATIC_UCODE_STRING(")"));
+ }
else
- return XalanDOMString(charAt(table, val-1));
+ {
+ return XalanDOMString(charAt(table, val - 1));
+ }
}
+
+
XalanDOMString
ElemNumber::int2alphaCount(
int val,
@@ -1172,12 +1189,68 @@
}
+
+static const XalanDOMChar alphaCountTable[] =
+{
+ XalanUnicode::charLetter_Z,
+ XalanUnicode::charLetter_A,
+ XalanUnicode::charLetter_B,
+ XalanUnicode::charLetter_C,
+ XalanUnicode::charLetter_D,
+ XalanUnicode::charLetter_E,
+ XalanUnicode::charLetter_F,
+ XalanUnicode::charLetter_G,
+ XalanUnicode::charLetter_H,
+ XalanUnicode::charLetter_I,
+ XalanUnicode::charLetter_J,
+ XalanUnicode::charLetter_K,
+ XalanUnicode::charLetter_L,
+ XalanUnicode::charLetter_M,
+ XalanUnicode::charLetter_N,
+ XalanUnicode::charLetter_O,
+ XalanUnicode::charLetter_P,
+ XalanUnicode::charLetter_Q,
+ XalanUnicode::charLetter_R,
+ XalanUnicode::charLetter_S,
+ XalanUnicode::charLetter_T,
+ XalanUnicode::charLetter_U,
+ XalanUnicode::charLetter_V,
+ XalanUnicode::charLetter_W,
+ XalanUnicode::charLetter_X,
+ XalanUnicode::charLetter_Y,
+ 0
+};
+
-const XalanDOMChar elalphaCountTable[] =
+
+static const XalanDOMChar elalphaCountTable[] =
{
- 0x03c9, 0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,
- 0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c2,0x03c3,0x03c4,
- 0x03c5,0x03c6,0x03c7,0x03c8,0
+ 0x03c9,
+ 0x03b1,
+ 0x03b2,
+ 0x03b3,
+ 0x03b4,
+ 0x03b5,
+ 0x03b6,
+ 0x03b7,
+ 0x03b8,
+ 0x03b9,
+ 0x03ba,
+ 0x03bb,
+ 0x03bc,
+ 0x03bd,
+ 0x03be,
+ 0x03bf,
+ 0x03c0,
+ 0x03c1,
+ 0x03c2,
+ 0x03c3,
+ 0x03c4,
+ 0x03c5,
+ 0x03c6,
+ 0x03c7,
+ 0x03c8,
+ 0
};
@@ -1202,7 +1275,7 @@
void
ElemNumber::initialize()
{
- ::s_alphaCountTable = XALAN_STATIC_UCODE_STRING("ZABCDEFGHIJKLMNOPQRSTUVWXY");
+ ::s_alphaCountTable = alphaCountTable;
::s_elalphaCountTable = elalphaCountTable;
@@ -1216,7 +1289,6 @@
::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")));
}
-
1.32 +16 -10 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.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ElemTemplateElement.cpp 2000/08/28 01:19:40 1.31
+++ ElemTemplateElement.cpp 2000/09/05 02:24:52 1.32
@@ -75,6 +75,7 @@
#include <PlatformSupport/AttributeListImpl.hpp>
#include <PlatformSupport/DOMStringPrintWriter.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -200,11 +201,11 @@
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")) == true)
+ if(equals(spaceVal, Constants::ATTRVAL_DEFAULT) == true)
{
m_defaultSpace = true;
}
- else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")) == true)
+ else if(equals(spaceVal, Constants::ATTRVAL_PRESERVE) == true)
{
m_defaultSpace = false;
}
@@ -222,17 +223,17 @@
const AttributeList& atts,
int which)
{
- const bool isSpaceAttr = equals(aname, XALAN_STATIC_UCODE_STRING("xml:space"));
+ const bool isSpaceAttr = equals(aname, Constants::ATTRNAME_XMLSPACE);
if(isSpaceAttr == true)
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")))
+ if(equals(spaceVal, Constants::ATTRVAL_DEFAULT))
{
m_defaultSpace = true;
}
- else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")) == true)
+ else if(equals(spaceVal, Constants::ATTRVAL_PRESERVE) == true)
{
m_defaultSpace = false;
}
@@ -252,20 +253,25 @@
{
const unsigned int len = length(s);
- XalanDOMChar c = charAt(s,0);
+ XalanDOMChar c = charAt(s, 0);
- if(!(isLetterOrDigit(c) || (c == '_')))
+ if(!(isLetterOrDigit(c) || (c == XalanUnicode::charLowLine)))
return false;
if(len > 0)
{
for(unsigned int i = 1; i < len; i++)
{
- c = charAt(s,i);
+ c = charAt(s, i);
- if(!(isLetterOrDigit(c) || (c == '_') || (c == '-') || (c == '.')))
+ if(!(isLetterOrDigit(c) ||
+ c == XalanUnicode::charLowLine ||
+ c == XalanUnicode::charHyphenMinus ||
+ c == XalanUnicode::charFullStop))
+ {
return false;
- }
+ }
+ }
}
return true;
1.5 +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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemTextLiteral.cpp 2000/08/22 20:21:21 1.4
+++ ElemTextLiteral.cpp 2000/09/05 02:24:53 1.5
@@ -84,7 +84,7 @@
bool disableOutputEscaping) :
ElemTemplateElement(constructionContext,
stylesheetTree,
- XALAN_STATIC_UCODE_STRING("#text"),
+ Constants::PSEUDONAME_TEXT,
lineNumber,
columnNumber,
Constants::ELEMNAME_TEXTLITERALRESULT),
1.11 +1 -1 xml-xalan/c/src/XSLT/ElemValueOf.cpp
Index: ElemValueOf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ElemValueOf.cpp 2000/08/10 18:43:05 1.10
+++ ElemValueOf.cpp 2000/09/05 02:24:53 1.11
@@ -113,7 +113,7 @@
const XalanDOMChar* const avalue = atts.getValue(i);
assert(avalue != 0);
- if (avalue[0] == '.' && avalue[1] == 0)
+ if (avalue[0] == XalanUnicode::charFullStop && avalue[1] == 0)
{
m_isDot = true;
}
1.14 +3 -3 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FunctionDocument.cpp 2000/08/22 20:21:22 1.13
+++ FunctionDocument.cpp 2000/09/05 02:24:53 1.14
@@ -260,11 +260,11 @@
// will still work, but confusion may result.
const unsigned int theLength = length(ref);
- const unsigned int indexOfColon = indexOf(ref, ':');
- unsigned int indexOfSlash = indexOf(ref, '/');
+ const unsigned int indexOfColon = indexOf(ref, XalanUnicode::charColon);
+ unsigned int indexOfSlash = indexOf(ref, XalanUnicode::charSolidus);
#if defined(WIN32)
- const unsigned int indexOfBackSlash = indexOf(ref, '\\');
+ const unsigned int indexOfBackSlash = indexOf(ref, XalanUnicode::charReverseSolidus);
if(indexOfBackSlash > indexOfSlash && indexOfBackSlash < theLength)
{
1.4 +1 -1 xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp
Index: FunctionElementAvailable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionElementAvailable.cpp 2000/06/01 14:21:40 1.3
+++ FunctionElementAvailable.cpp 2000/09/05 02:24:53 1.4
@@ -99,7 +99,7 @@
const XalanDOMString fullName = args[0]->str();
const unsigned int nameLength = length(fullName);
- const unsigned int indexOfNSSep = indexOf(fullName, ':');
+ const unsigned int indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
const XalanDOMString prefix = indexOfNSSep < nameLength ? substring(fullName, 0, indexOfNSSep) : XalanDOMString();
1.4 +1 -1 xml-xalan/c/src/XSLT/FunctionFunctionAvailable.cpp
Index: FunctionFunctionAvailable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionFunctionAvailable.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionFunctionAvailable.cpp 2000/06/01 14:21:40 1.3
+++ FunctionFunctionAvailable.cpp 2000/09/05 02:24:53 1.4
@@ -97,7 +97,7 @@
const XalanDOMString fullName = args[0]->str();
const unsigned int nameLength = length(fullName);
- const unsigned int indexOfNSSep = indexOf(fullName, ':');
+ const unsigned int indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
const XalanDOMString prefix = indexOfNSSep < nameLength ? substring(fullName, 0, indexOfNSSep) : XalanDOMString();
1.7 +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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FunctionSystemProperty.cpp 2000/08/31 19:43:10 1.6
+++ FunctionSystemProperty.cpp 2000/09/05 02:24:53 1.7
@@ -104,7 +104,7 @@
const XalanDOMString fullName = args[0]->str();
const unsigned int fullNameLength = length(fullName);
- const unsigned int indexOfNSSep = indexOf(fullName,':');
+ const unsigned int indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
bool fNumberResult = false;
@@ -134,11 +134,11 @@
}
else if(equals(propName, XALAN_STATIC_UCODE_STRING("vendor-url")))
{
- result = XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt");
+ result = XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xalan-c/index.html");
}
else
{
- executionContext.warn("XSL Property not supported: "+fullName);
+ executionContext.warn("XSL Property not supported: " + fullName);
}
}
else
1.3 +46 -12 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamespacesHandler.cpp 2000/08/29 22:19:04 1.2
+++ NamespacesHandler.cpp 2000/09/05 02:24:53 1.3
@@ -82,10 +82,6 @@
-const XalanDOMString NamespacesHandler::s_dummyEmptyString;
-
-
-
NamespacesHandler::NamespacesHandler() :
m_excludedResultPrefixes(),
m_namespaceDeclarations(),
@@ -238,8 +234,7 @@
{
StringTokenizer tokenizer(
theValue,
- XALAN_STATIC_UCODE_STRING(" \t\n\r"),
- false);
+ Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
while(tokenizer.hasMoreTokens() == true)
{
@@ -276,8 +271,7 @@
{
StringTokenizer tokenizer(
theValue,
- XALAN_STATIC_UCODE_STRING(" \t\n\r"),
- false);
+ Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
while(tokenizer.hasMoreTokens() == true)
{
@@ -323,7 +317,7 @@
// Figure out the prefix of the owning element, to make sure we
// don't exclude it's prefix.
- const unsigned int indexOfNSSep = indexOf(theElementName, ':');
+ const unsigned int indexOfNSSep = indexOf(theElementName, XalanUnicode::charColon);
const XalanDOMString thePrefix = indexOfNSSep < length(theElementName) ?
substring(theElementName, 0, indexOfNSSep) : XalanDOMString();
@@ -366,9 +360,9 @@
// These are commone namespaces that are always excluded...
if(equals(theURI, theXSLTNamespaceURI)
|| m_extensionNamespaceURIs.find(theURI) != m_extensionNamespaceURIs.end()
- || equals(theURI, XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt"))
- || equals(theURI, XALAN_STATIC_UCODE_STRING("http://xsl.lotus.com/"))
- || equals(theURI, XALAN_STATIC_UCODE_STRING("http://xsl.lotus.com")))
+ || equals(theURI, s_ApacheXSLTNamespaceURI)
+ || equals(theURI, s_LotusXSLTNamespaceURIWithSeparator)
+ || equals(theURI, s_LotusXSLTNamespaceURI))
{
return true;
}
@@ -712,4 +706,44 @@
}
}
}
+}
+
+
+
+static XalanDOMString s_ApacheXSLTNamespaceURI;
+
+static XalanDOMString s_LotusXSLTNamespaceURI;
+
+static XalanDOMString s_LotusXSLTNamespaceURIWithSeparator;
+
+
+const XalanDOMString& NamespacesHandler::s_ApacheXSLTNamespaceURI =
+ ::s_ApacheXSLTNamespaceURI;
+
+const XalanDOMString& NamespacesHandler::s_LotusXSLTNamespaceURI =
+ ::s_LotusXSLTNamespaceURI;
+
+const XalanDOMString& NamespacesHandler::s_LotusXSLTNamespaceURIWithSeparator =
+ ::s_LotusXSLTNamespaceURIWithSeparator;
+
+const XalanDOMString NamespacesHandler::s_dummyEmptyString;
+
+
+
+void
+NamespacesHandler::initialize()
+{
+ ::s_ApacheXSLTNamespaceURI = XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt");
+ ::s_LotusXSLTNamespaceURI = XALAN_STATIC_UCODE_STRING("http://xsl.lotus.com");
+ ::s_LotusXSLTNamespaceURIWithSeparator = XALAN_STATIC_UCODE_STRING("http://xsl.lotus.com/");
+}
+
+
+
+void
+NamespacesHandler::terminate()
+{
+ ::clear(::s_ApacheXSLTNamespaceURI);
+ ::clear(::s_LotusXSLTNamespaceURI);
+ ::clear(::s_LotusXSLTNamespaceURIWithSeparator);
}
1.3 +23 -0 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NamespacesHandler.hpp 2000/08/29 19:10:32 1.2
+++ NamespacesHandler.hpp 2000/09/05 02:24:53 1.3
@@ -91,6 +91,29 @@
{
public:
+ /**
+ * Perform static initialization. See class XSLTInit.
+ */
+ static void
+ initialize();
+
+ /**
+ * Perform static shut down. See class XSLTInit.
+ */
+ static void
+ terminate();
+
+
+ /* Some static strings for various namespace URIs...
+ *
+ */
+ static const XalanDOMString& s_ApacheXSLTNamespaceURI;
+
+ static const XalanDOMString& s_LotusXSLTNamespaceURI;
+
+ static const XalanDOMString& s_LotusXSLTNamespaceURIWithSeparator;
+
+
class NameSpaceExtended : public NameSpace
{
public:
1.35 +8 -6 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.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- Stylesheet.cpp 2000/08/28 01:19:41 1.34
+++ Stylesheet.cpp 2000/09/05 02:24:53 1.35
@@ -373,7 +373,7 @@
{
// Others are OK if their prefix has been
// bound to a non-null Namespace URI other than XSLT's
- const unsigned int indexOfNSSep = indexOf(attrName, ':');
+ const unsigned int indexOfNSSep = indexOf(attrName, XalanUnicode::charColon);
if(indexOfNSSep < length(attrName))
{
@@ -396,7 +396,7 @@
XalanDOMString
Stylesheet::getNamespaceFromStack(const XalanDOMString& nodeName) const
{
- const unsigned int indexOfNSSep = indexOf(nodeName, ':');
+ const unsigned int indexOfNSSep = indexOf(nodeName, XalanUnicode::charColon);
const XalanDOMString prefix =
indexOfNSSep < length(nodeName) ?
@@ -497,7 +497,7 @@
if (length(theNamespace) != 0)
{
theMessage += theNamespace;
- theMessage += ":";
+ theMessage += DOMServices::s_XMLNamespaceSeparatorString;
}
theMessage += theName.getLocalPart();
@@ -778,7 +778,7 @@
// We also have to consider wildcard matches.
if(theCurrentEntry == theTableEnd &&
equals(matchPat->getTargetString(),
- XALAN_STATIC_UCODE_STRING("*")) == false
+ Constants::PSEUDONAME_ANY) == false
&& (XalanNode::ELEMENT_NODE == targetNodeType ||
XalanNode::ATTRIBUTE_NODE == targetNodeType ||
XalanNode::PROCESSING_INSTRUCTION_NODE == targetNodeType)
@@ -788,7 +788,7 @@
assert(usedWildcard==false); // Should only be here once ??
usedWildcard = true;
const PatternTableMapType::const_iterator theTableIterator =
- m_patternTable.find(XALAN_STATIC_UCODE_STRING("*"));
+ m_patternTable.find(Constants::PSEUDONAME_ANY);
assert(m_patternTable.size());
if (theTableIterator != m_patternTable.end())
@@ -986,13 +986,15 @@
}
else if(tryWildCard == true)
{
- i = m_patternTable.find(XALAN_STATIC_UCODE_STRING("*"));
+ i = m_patternTable.find(Constants::PSEUDONAME_ANY);
+
if (i != m_patternTable.end())
{
theMatchList = &(*i).second;
assert(theMatchList != 0);
}
}
+
return theMatchList;
}
1.34 +2 -2 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.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- StylesheetExecutionContextDefault.cpp 2000/08/31 19:43:11 1.33
+++ StylesheetExecutionContextDefault.cpp 2000/09/05 02:24:53 1.34
@@ -431,13 +431,13 @@
// enhance XPath so that we can tell if str would match
// the XPath, once the namespace is resolved, but it may
// not be worth it...
- const unsigned int index = indexOf(str, ':');
+ const unsigned int index = indexOf(str, XalanUnicode::charColon);
const unsigned int len = length(str);
// If we found a ':' before the end of the string, and
// it's by itself (:: would indicate an axis), don't
// try to cache the XPath...
- if (index < len - 1 && (charAt(str, index + 1) != ':'))
+ if (index < len - 1 && (charAt(str, index + 1) != XalanUnicode::charColon))
{
theResult = m_xsltProcessor.createMatchPattern(str, resolver);
}
1.42 +26 -28 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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- StylesheetHandler.cpp 2000/08/28 21:49:25 1.41
+++ StylesheetHandler.cpp 2000/09/05 02:24:53 1.42
@@ -235,17 +235,17 @@
const AttributeList& atts,
int which)
{
- const bool isSpaceAttr = equals(aname, XALAN_STATIC_UCODE_STRING("xml:space"));
+ const bool isSpaceAttr = equals(aname, Constants::ATTRNAME_XMLSPACE);
if(isSpaceAttr)
{
const XalanDOMChar* const spaceVal = atts.getValue(which);
- if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("default")))
+ if(equals(spaceVal, Constants::ATTRVAL_DEFAULT))
{
m_stylesheet.setDefaultSpaceProcessing(true);
}
- else if(equals(spaceVal, XALAN_STATIC_UCODE_STRING("preserve")))
+ else if(equals(spaceVal, Constants::ATTRVAL_PRESERVE))
{
m_stylesheet.setDefaultSpaceProcessing(false);
}
@@ -291,7 +291,7 @@
const XalanDOMString ns = m_stylesheet.getNamespaceFromStack(name);
const unsigned int nameLength = length(name);
- const unsigned int index = indexOf(name,':');
+ const unsigned int index = indexOf(name, XalanUnicode::charColon);
const XalanDOMString localName = index == nameLength ? XalanDOMString(name) : substring(name, index + 1);
@@ -372,7 +372,7 @@
case Constants::ELEMNAME_PRESERVESPACE:
case Constants::ELEMNAME_STRIPSPACE:
{
- // $$$ ToDo: We should separate this out into a separate function.
+ // $$$ ToDo: We should move this code into a separate function.
ElemEmpty nsNode(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
const unsigned int nAttrs = atts.getLength();
@@ -388,7 +388,7 @@
foundIt = true;
StringTokenizer tokenizer(atts.getValue(i),
- XALAN_STATIC_UCODE_STRING(" \t\n\r"));
+ Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
while(tokenizer.hasMoreTokens())
{
@@ -538,7 +538,7 @@
{
const XalanDOMChar* const aname = atts.getName(i);
- if(equals(aname, XALAN_STATIC_UCODE_STRING("result-ns")))
+ if(equals(aname, Constants::ATTRNAME_RESULTNS))
{
throw SAXException("result-ns no longer supported! Use xsl:output instead.");
}
@@ -553,8 +553,7 @@
else if(equals(aname, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
{
StringTokenizer tokenizer(atts.getValue(i),
- XALAN_STATIC_UCODE_STRING(" \t\n\r"),
- false);
+ Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
while(tokenizer.hasMoreTokens() == true)
{
@@ -567,15 +566,15 @@
m_stylesheet.addExtensionNamespace(extns, nsh);
}
}
- else if(equals(aname, XALAN_STATIC_UCODE_STRING("id")))
+ else if(equals(aname, Constants::ATTRNAME_ID))
{
//
}
- else if(equals(aname, XALAN_STATIC_UCODE_STRING("indent-result")))
+ else if(equals(aname, Constants::ATTRNAME_INDENTRESULT))
{
throw SAXException("indent-result no longer supported! Use xsl:output instead.");
}
- else if(equals(aname, XALAN_STATIC_UCODE_STRING("version")))
+ else if(equals(aname, Constants::ATTRNAME_VERSION))
{
const XalanDOMChar* const versionStr = atts.getValue(i);
@@ -870,7 +869,7 @@
// BEGIN SANJIVA CODE
else if (!m_inTemplate && startsWith(ns, m_constructionContext.getXalanXSLNameSpaceURL()))
{
- if (equals(localName, XALAN_STATIC_UCODE_STRING("component")))
+ if (equals(localName, Constants::ATTRNAME_COMPONENTS))
{
XalanDOMString prefix;
XalanDOMString elements;
@@ -882,17 +881,17 @@
{
const XalanDOMChar* const aname = atts.getName (i);
- if (equals(aname, XALAN_STATIC_UCODE_STRING("prefix")))
+ if (equals(aname, Constants::ATTRNAME_PREFIX))
{
- prefix = atts.getValue (i);
+ prefix = atts.getValue(i);
}
- else if (equals(aname, XALAN_STATIC_UCODE_STRING("elements")))
+ else if (equals(aname, Constants::ATTRNAME_ELEMENTS))
{
- elements = atts.getValue (i);
+ elements = atts.getValue(i);
}
- else if (equals(aname, XALAN_STATIC_UCODE_STRING("functions")))
+ else if (equals(aname, Constants::ATTRNAME_FUNCTIONS))
{
- functions = atts.getValue (i);
+ functions = atts.getValue(i);
}
else if(!isAttrOK(aname, atts, i))
{
@@ -932,27 +931,26 @@
m_pLXSLTExtensionNSH = nsh; // hang on to it for processing
// endElement on lxslt:script
}
- else if (equals(localName, XALAN_STATIC_UCODE_STRING("script")))
+ else if (equals(localName, Constants::ATTRNAME_SCRIPT))
{
// process this in end element so that I can see whether I had
// a body as well. The default pushing logic will save the
// attributes for me. The body will be accumulated into the
// following string buffer
m_inLXSLTScript = true;
- m_LXSLTScriptBody = XalanDOMString();
+ clear(m_LXSLTScriptBody);
const int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; i++)
{
-
const XalanDOMChar* const aname = atts.getName(i);
- if (equals(aname, XALAN_STATIC_UCODE_STRING("lang")))
+ if (equals(aname, Constants::ATTRNAME_LANG))
{
m_LXSLTScriptLang = atts.getValue (i);
}
- else if (equals(aname, XALAN_STATIC_UCODE_STRING("src")))
+ else if (equals(aname, Constants::ATTRNAME_SRC))
{
m_LXSLTScriptSrcURL = atts.getValue (i);
}
@@ -1078,13 +1076,13 @@
AttributeListImpl templateAttrs;
- templateAttrs.addAttribute(c_wstr(XALAN_STATIC_UCODE_STRING("name")),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
- c_wstr(XALAN_STATIC_UCODE_STRING("simple")));
+ templateAttrs.addAttribute(c_wstr(Constants::ATTRNAME_NAME),
+ c_wstr(Constants::ATTRTYPE_CDATA),
+ c_wstr(Constants::ATTRVAL_SIMPLE));
m_pTemplate = new ElemTemplate(m_constructionContext,
m_stylesheet,
- XALAN_STATIC_UCODE_STRING("xsl:template"),
+ Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
templateAttrs,
lineNumber,
columnNumber);
1.23 +14 -16 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- StylesheetRoot.cpp 2000/08/14 20:11:50 1.22
+++ StylesheetRoot.cpp 2000/09/05 02:24:53 1.23
@@ -505,15 +505,13 @@
AttributeListImpl attrs;
- const XalanDOMString xslPrefix(XALAN_STATIC_UCODE_STRING("xsl:"));
-
attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
- c_wstr(XALAN_STATIC_UCODE_STRING("*")));
+ c_wstr(Constants::ATTRTYPE_CDATA),
+ c_wstr(Constants::PSEUDONAME_ANY));
m_defaultRule = new ElemTemplate(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
@@ -523,7 +521,7 @@
ElemApplyTemplates* childrenElement
= new ElemApplyTemplates(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
+ Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
@@ -535,25 +533,25 @@
attrs.clear();
attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
- c_wstr(XALAN_STATIC_UCODE_STRING("text() | @*")));
+ c_wstr(Constants::ATTRTYPE_CDATA),
+ c_wstr(Constants::ATTRVAL_DEFAULT_TEXT_RULE));
m_defaultTextRule = new ElemTemplate(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
attrs.clear();
attrs.addAttribute(c_wstr(Constants::ATTRNAME_SELECT),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
- c_wstr(XALAN_STATIC_UCODE_STRING(".")));
+ c_wstr(Constants::ATTRTYPE_CDATA),
+ c_wstr(Constants::ATTRVAL_THIS));
ElemValueOf* elemValueOf =
new ElemValueOf(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_VALUEOF_STRING,
+ Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
@@ -564,13 +562,13 @@
attrs.clear();
attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
- c_wstr(XALAN_STATIC_UCODE_STRING("/")));
+ c_wstr(Constants::ATTRTYPE_CDATA),
+ c_wstr(Constants::PSEUDONAME_ROOT));
m_defaultRootRule =
new ElemTemplate(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING,
+ Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
@@ -580,7 +578,7 @@
childrenElement =
new ElemApplyTemplates(constructionContext,
*this,
- xslPrefix + Constants::ELEMNAME_APPLY_TEMPLATES_STRING,
+ Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING,
attrs,
lineNumber,
columnNumber);
1.5 +1 -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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TraceListenerDefault.cpp 2000/08/22 20:21:30 1.4
+++ TraceListenerDefault.cpp 2000/09/05 02:24:53 1.5
@@ -172,7 +172,7 @@
if (isEmpty(theNamespace) == false)
{
m_printWriter.print(theNamespace);
- m_printWriter.print(':');
+ m_printWriter.print(XalanUnicode::charColon);
}
m_printWriter.print(theName.getLocalPart());
1.62 +115 -108 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.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- XSLTEngineImpl.cpp 2000/08/31 19:43:11 1.61
+++ XSLTEngineImpl.cpp 2000/09/05 02:24:53 1.62
@@ -89,6 +89,7 @@
#include <PlatformSupport/PrintWriter.hpp>
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -196,10 +197,6 @@
-/**
- * Reset the state. This needs to be called after a process() call
- * is invoked, if the processor is to be used again.
- */
void
XSLTEngineImpl::reset()
{
@@ -388,7 +385,7 @@
Stylesheet* prevStylesheet = 0;
while(!hrefs.empty())
{
- const XMLCh* const pxch = inputSource.getSystemId();
+ const XalanDOMChar* const pxch = inputSource.getSystemId();
const XalanDOMString sysid(pxch);
const XalanDOMString& ref = hrefs.back();
@@ -605,21 +602,10 @@
sourceTree = theDocument;
}
// catch(Exception e)
- // @@ Fix later
+ // $$$ ToDo: Fix this!!!
catch(...)
{
- /*
- java:
- // Unwrap exception
- if((e instanceof SAXException) && (null != ((SAXException)e).getException()))
- {
- // ((SAXException)e).getException().printStackTrace();
- e = ((SAXException)e).getException();
- }
- sourceTree = null; // shutup compiler
- error("Could not parse "+xmlIdentifier+" document!", e);
- */
- error("Could not parse "+xmlIdentifier+" document!");
+ error("Could not parse " + xmlIdentifier + " document!");
}
}
@@ -635,7 +621,7 @@
XalanDocument* docToRegister)
{
- XalanDocument* doc =
+ XalanDocument* doc =
m_xpathEnvSupport.getSourceDocument(urlString);
if(doc == 0)
@@ -678,7 +664,7 @@
const XalanDOMString localXSLURLString = clone(trim(xslURLString));
- const unsigned int fragIndex = indexOf(localXSLURLString, '#');
+ const unsigned int fragIndex = indexOf(localXSLURLString, XalanUnicode::charNumberSign);
const XalanDocument* stylesheetDoc = 0;
@@ -1194,6 +1180,7 @@
}
+
void
XSLTEngineImpl::problem(
const XalanDOMString& msg,
@@ -1205,16 +1192,21 @@
const Locator* const locator = getLocatorFromStack();
- const XMLCh* id = (0 == locator) ?
+ const XalanDOMChar* id = (0 == locator) ?
0 : (0 == locator->getPublicId()) ?
locator->getPublicId() : locator->getSystemId();
+
const bool shouldThrow =
- m_problemListener->problem(ProblemListener::eXSLPROCESSOR,
- classification,
- styleNode, sourceNode, msg,
- id,
- (0 == locator) ? 0: locator->getLineNumber(),
- (0 == locator) ? 0: locator->getColumnNumber());
+ m_problemListener->problem(
+ ProblemListener::eXSLPROCESSOR,
+ classification,
+ styleNode,
+ sourceNode,
+ msg,
+ id,
+ (0 == locator) ? 0: locator->getLineNumber(),
+ (0 == locator) ? 0: locator->getColumnNumber());
+
if(shouldThrow == true)
{
throw XSLTProcessorException(msg);
@@ -1260,7 +1252,7 @@
clock_t
-XSLTEngineImpl::popDuration(const void* key) const
+XSLTEngineImpl::popDuration(const void* key) const
{
clock_t clockTicksDuration = 0;
@@ -1448,13 +1440,11 @@
const XalanDOMString& prefix,
const XalanDOMString& namespaceVal)
{
-
const NameSpace ns(prefix, namespaceVal);
if (m_resultNameSpaces.size() == 0)
{
- NamespaceVectorType nsVector;
- nsVector.push_back(ns);
+ NamespaceVectorType nsVector(1, ns);
m_resultNameSpaces.push_back(nsVector);
}
@@ -1466,10 +1456,7 @@
// new vector containing only this namespace
if(isEmpty(nsOnStack.front().getURI()))
{
- NamespaceVectorType nsVector;
- nsVector.push_back(ns);
-
- nsOnStack = nsVector;
+ nsOnStack.front() = ns;
}
// Otherwise, add the namespace at the end of the last vector
else
@@ -1491,7 +1478,8 @@
if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix == true)
{
- const XalanDOMString p = isPrefix == true ? substring(aname, 6) : XalanDOMString();
+ const XalanDOMString p = isPrefix == true ? substring(aname, 6) : XalanDOMString();
+
addResultNamespaceDecl(p, value);
}
@@ -1501,16 +1489,16 @@
{
attList.addAttribute(
c_wstr(aname),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(Constants::ATTRTYPE_CDATA),
c_wstr(value));
}
else
{
- const XMLCh theDummy = 0;
+ const XalanDOMChar theDummy = 0;
attList.addAttribute(
c_wstr(aname),
- c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
+ c_wstr(Constants::ATTRTYPE_CDATA),
&theDummy);
}
@@ -1553,8 +1541,7 @@
{
if (m_flistener->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
{
- // Yuck!!! Ugly hack to switch to HTML on-the-fly. You can
- // blame this ridiculous crap on the XSLT Working Group...
+ // Yuck!!! Ugly hack to switch to HTML on-the-fly.
FormatterToXML* const theFormatter =
#if defined(XALAN_OLD_STYLE_CASTS)
(FormatterToXML*)m_flistener;
@@ -2209,7 +2196,7 @@
XalanDOMString elemNS;
XalanDOMString elemLocalName;
- const unsigned int indexOfNSSep = indexOf(elementName, ':');
+ const unsigned int indexOfNSSep = indexOf(elementName, XalanUnicode::charColon);
if(indexOfNSSep == length(elementName))
{
@@ -2258,7 +2245,7 @@
XalanDOMString elemNS;
XalanDOMString elemLocalName;
- const unsigned int indexOfNSSep = indexOf(elementName, ':');
+ const unsigned int indexOfNSSep = indexOf(elementName, XalanUnicode::charColon);
if(indexOfNSSep < length(elementName))
{
@@ -2340,7 +2327,7 @@
if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix)
{
- const unsigned int index = indexOf(aname, ':');
+ const unsigned int index = indexOf(aname, XalanUnicode::charColon);
assert(index < length(aname));
const XalanDOMString namespaceOfPrefix = attr->getNodeValue();
@@ -2533,6 +2520,35 @@
+static const XalanDOMChar theTokenDelimiterCharacters[] =
+{
+ XalanUnicode::charLeftCurlyBracket,
+ XalanUnicode::charRightCurlyBracket,
+ XalanUnicode::charApostrophe,
+ XalanUnicode::charQuoteMark,
+ 0
+};
+
+
+
+static const XalanDOMChar theLeftCurlyBracketString[] =
+{
+ XalanUnicode::charLeftCurlyBracket,
+ 0
+};
+
+
+
+static const XalanDOMChar theRightCurlyBracketString[] =
+{
+ XalanUnicode::charRightCurlyBracket,
+ 0
+};
+
+
+
+// $$$ ToDo: Get rid of this!!! See ElemPI, ElemSort, etc. These have strings instead of
+// AVT instances...
XalanDOMString
XSLTEngineImpl::evaluateAttrVal(
XalanNode* contextNode,
@@ -2542,7 +2558,7 @@
{
XalanDOMString expressedValue;
- StringTokenizer tokenizer(stringedValue, XALAN_STATIC_UCODE_STRING("{}\"\'"), true);
+ StringTokenizer tokenizer(stringedValue, theTokenDelimiterCharacters, true);
const unsigned int nTokens = tokenizer.countTokens();
@@ -2570,18 +2586,18 @@
{
switch(charAt(t, 0))
{
- case('\"'):
- case('\''):
+ case XalanUnicode::charApostrophe:
+ case XalanUnicode::charQuoteMark:
{
// just keep on going, since we're not in an attribute template
append(buffer, t);
break;
}
- case('{'):
+ case(XalanUnicode::charLeftCurlyBracket):
{
// Attr template start
lookahead = tokenizer.nextToken();
- if(equals(lookahead, XALAN_STATIC_UCODE_STRING("{")))
+ if(equals(lookahead, theLeftCurlyBracketString))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
@@ -2589,7 +2605,8 @@
break; // from switch
}
/*
- else if(equals(lookahead, "\"") || equals(lookahead, "\'"))
+ else if(equals(lookahead, XalanUnicode::charQuoteMar) ||
+ equals(lookahead, XalanUnicode::charApostrophe))
{
// Error. Expressions can not begin with quotes.
error = "Expressions can not begin with quotes.";
@@ -2600,15 +2617,15 @@
{
XalanDOMString expression = lookahead; // Probably should make into StringBuffer
- while(0 != length(lookahead) && !equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
+ while(0 != length(lookahead) && !equals(lookahead, theRightCurlyBracketString))
{
lookahead = tokenizer.nextToken();
if(length(lookahead) == 1)
{
switch(charAt(lookahead, 0))
{
- case '\'':
- case '\"':
+ case XalanUnicode::charApostrophe:
+ case XalanUnicode::charQuoteMark:
{
// String start
expression += lookahead;
@@ -2623,13 +2640,13 @@
expression += lookahead;
break;
}
- case '{':
+ case XalanUnicode::charLeftCurlyBracket:
{
// What's another curly doing here?
error = "Error: Can not have \"{\" within expression.";
break;
}
- case '}':
+ case XalanUnicode::charRightCurlyBracket:
{
// Proper close of attribute template.
// Evaluate the expression.
@@ -2664,10 +2681,10 @@
}
break;
}
- case('}'):
+ case(XalanUnicode::charRightCurlyBracket):
{
lookahead = tokenizer.nextToken();
- if(equals(lookahead, XALAN_STATIC_UCODE_STRING("}")))
+ if(equals(lookahead, theRightCurlyBracketString))
{
// Double curlys mean escape to show curly
append(buffer, lookahead);
@@ -2677,7 +2694,7 @@
{
// Illegal, I think...
warn("Found \"}\" but no attribute template open!");
- append(buffer, XALAN_STATIC_UCODE_STRING("}"));
+ append(buffer, theRightCurlyBracketString);
// leave the lookahead to be processed by the next round.
}
break;
@@ -2849,30 +2866,7 @@
#else
static_cast<const XalanElement*>(parent);
#endif
- /*
- const XalanAttr* const attr =
- parentElem->getAttributeNode(XALAN_STATIC_UCODE_STRING("xml:space"));
-
- if(0 != attr)
- {
- const XalanDOMString xmlSpaceVal = attr->getValue();
- if(equals(xmlSpaceVal, XALAN_STATIC_UCODE_STRING("preserve")))
- {
- strip = false;
- }
- else if(equals(xmlSpaceVal, XALAN_STATIC_UCODE_STRING("default")))
- {
- strip = true;
- }
- else
- {
- error("xml:space in the source XML has an illegal value: " + xmlSpaceVal);
- }
- break;
- }
- */
-
double highPreserveScore = XPath::s_MatchScoreNone;
double highStripScore = XPath::s_MatchScoreNone;
@@ -2959,18 +2953,17 @@
bool trimTail,
bool doublePunctuationSpaces)
{
- const XMLCh* const theStringData = c_wstr(string);
+ const XalanDOMChar* const theStringData = c_wstr(string);
-#if defined(XALAN_NO_NAMESPACES)
- typedef vector<XMLCh> XMLChVectorType;
-#else
- typedef std::vector<XMLCh> XMLChVectorType;
-#endif
- XMLChVectorType buf(theStringData,
- theStringData + length(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)
@@ -2982,25 +2975,32 @@
}
/* replace S to ' '. and ' '+ -> single ' '. */
- unsigned int d = s;
- bool pres = false;
+ unsigned int d = s;
+
+ bool pres = false;
+
for ( ; s < len; ++s)
{
- const XMLCh c = buf[s];
+ const XalanDOMChar c = buf[s];
if (isSpace(c) == true)
{
if (!pres)
{
- if (' ' != c)
+ if (XalanUnicode::charSpace != c)
{
edit = true;
}
- buf[d++] = ' ';
+
+ buf[d++] = XalanUnicode::charSpace;
+
if(doublePunctuationSpaces == true && (s != 0))
{
- const XMLCh prevChar = buf[s-1];
- if(!((prevChar == '.') || (prevChar == '!') || (prevChar == '?')))
+ const XalanDOMChar prevChar = buf[s - 1];
+
+ if(!(prevChar == XalanUnicode::charFullStop ||
+ prevChar == XalanUnicode::charExclamationMark ||
+ prevChar == XalanUnicode::charQuestionMark))
{
pres = true;
}
@@ -3023,14 +3023,15 @@
}
}
- if (trimTail == true && 1 <= d && ' ' == buf[d-1])
+ if (trimTail == true && 1 <= d && XalanUnicode::charSpace == buf[d - 1])
{
edit = true;
d --;
}
+
+ XalanDOMCharVectorType::const_iterator start = buf.begin();
- XMLChVectorType::const_iterator start = buf.begin();
- if (trimHead == true && 0 < d && ' ' == buf[0])
+ if (trimHead == true && 0 < d && XalanUnicode::charSpace == buf[0])
{
edit = true;
start++;
@@ -3048,6 +3049,7 @@
// 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);
}
}
@@ -3066,17 +3068,13 @@
const int nSrcChars = src.length();
-#if !defined(XALAN_NO_NAMESPACES)
- using std::vector;
-#endif
+ XalanDOMCharVectorType sb;
- vector<XMLCh> sb;
+ XalanDOMChar prevChar = 0;
- XMLCh prevChar = 0x00;
-
for(int i = 0; i < nSrcChars; i++)
{
- const XMLCh c = charAt(src, i);
+ const XalanDOMChar c = charAt(src, i);
if(0x0A == c)
{
@@ -3125,9 +3123,9 @@
((XSLTEngineImpl*)this)->m_uniqueNSValue++;
- return XALAN_STATIC_UCODE_STRING("ns") + UnsignedLongToDOMString(temp);
+ return s_uniqueNamespacePrefix + UnsignedLongToDOMString(temp);
#else
- return XALAN_STATIC_UCODE_STRING("ns") + UnsignedLongToDOMString(m_uniqueNSValue++);
+ return s_uniqueNamespacePrefix + UnsignedLongToDOMString(m_uniqueNSValue++);
#endif
}
@@ -3530,6 +3528,8 @@
static XalanDOMString s_XSLT4JNameSpaceURL;
+static XalanDOMString s_uniqueNamespacePrefix;
+
static XSLTEngineImpl::AttributeKeysMapType s_attributeKeys;
static XSLTEngineImpl::ElementKeysMapType s_elementKeys;
@@ -3544,6 +3544,9 @@
const XalanDOMString& XSLTEngineImpl::s_XSLT4JNameSpaceURL = ::s_XSLT4JNameSpaceURL;
+const XalanDOMString& XSLTEngineImpl::s_uniqueNamespacePrefix = ::s_uniqueNamespacePrefix;
+
+
/**
* Control if the xsl:variable is resolved early or
* late. Resolving the xsl:variable
@@ -3574,6 +3577,8 @@
::s_XSLT4JNameSpaceURL = XALAN_STATIC_UCODE_STRING("http://xml.apache.org/xslt");
+ ::s_uniqueNamespacePrefix = XALAN_STATIC_UCODE_STRING("ns");
+
installFunctions();
initializeAttributeKeysTable(::s_attributeKeys);
@@ -3595,6 +3600,8 @@
AttributeKeysMapType().swap(::s_attributeKeys);
uninstallFunctions();
+
+ clear(::s_uniqueNamespacePrefix);
clear(::s_XSLT4JNameSpaceURL);
1.47 +4 -0 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.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- XSLTEngineImpl.hpp 2000/08/31 19:43:11 1.46
+++ XSLTEngineImpl.hpp 2000/09/05 02:24:54 1.47
@@ -1452,6 +1452,10 @@
*/
static const XalanDOMString& s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt"
+ /**
+ * Prefix to use when generating unique namespaces.
+ */
+ static const XalanDOMString& s_uniqueNamespacePrefix;
/**
* Map that can look up XSLT4J extensions element IDs via name.
1.2 +7 -2 xml-xalan/c/src/XSLT/XSLTInit.cpp
Index: XSLTInit.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInit.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLTInit.cpp 2000/08/31 19:43:12 1.1
+++ XSLTInit.cpp 2000/09/05 02:24:54 1.2
@@ -61,6 +61,7 @@
#include "Constants.hpp"
#include "ElemNumber.hpp"
+#include "NamespacesHandler.hpp"
#include "XSLTEngineImpl.hpp"
@@ -100,9 +101,11 @@
void
XSLTInit::initialize()
{
+ Constants::initialize();
+
ElemNumber::initialize();
- Constants::initialize();
+ NamespacesHandler::initialize();
XSLTEngineImpl::initialize();
}
@@ -114,7 +117,9 @@
{
XSLTEngineImpl::terminate();
- Constants::terminate();
+ NamespacesHandler::terminate();
ElemNumber::terminate();
+
+ Constants::terminate();
}
1.2 +6 -2 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesDOMSupport.cpp 2000/08/10 18:03:35 1.1
+++ XercesDOMSupport.cpp 2000/09/05 02:24:56 1.2
@@ -69,6 +69,10 @@
+#include <DOMSupport/DOMServices.hpp>
+
+
+
XercesDOMSupport::XercesDOMSupport() :
DOMSupport()
{
@@ -102,7 +106,7 @@
{
const XalanDOMString theNamespace = getNamespaceOfNode(elem);
- return 0 != length(theNamespace) ? theNamespace + XALAN_STATIC_UCODE_STRING(":") + elem.getLocalName()
+ return 0 != length(theNamespace) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + elem.getLocalName()
: elem.getLocalName();
}
@@ -113,6 +117,6 @@
{
const XalanDOMString theNamespace = getNamespaceOfNode(attr);
- return 0 != length(theNamespace) ? theNamespace + XALAN_STATIC_UCODE_STRING(":") + attr.getLocalName()
+ return 0 != length(theNamespace) ? theNamespace + DOMServices::s_XMLNamespaceSeparatorString + attr.getLocalName()
: attr.getLocalName();
}
1.17 +16 -1 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XercesParserLiaison.cpp 2000/08/31 19:43:19 1.16
+++ XercesParserLiaison.cpp 2000/09/05 02:24:56 1.17
@@ -73,6 +73,7 @@
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/XalanAutoPtr.hpp>
+#include <PlatformSupport/XalanUnicode.hpp>
@@ -84,9 +85,23 @@
+static const XalanDOMChar theDefaultSpecialCharacters[] =
+{
+ XalanUnicode::charLessThanSign,
+ XalanUnicode::charGreaterThanSign,
+ XalanUnicode::charAmpersand,
+ XalanUnicode::charApostrophe,
+ XalanUnicode::charQuoteMark,
+ XalanUnicode::charCR,
+ XalanUnicode::charLF,
+ 0
+};
+
+
+
XercesParserLiaison::XercesParserLiaison(DOMSupport& theSupport) :
m_DOMSupport(theSupport),
- m_specialCharacters(XALAN_STATIC_UCODE_STRING("<>&\"\'\r\n")),
+ m_specialCharacters(theDefaultSpecialCharacters),
m_indent(-1),
m_shouldExpandEntityRefs(false),
m_useValidation(false),
1.13 +3 -3 xml-xalan/c/src/XercesPlatformSupport/XercesDOMPrintWriter.cpp
Index: XercesDOMPrintWriter.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesPlatformSupport/XercesDOMPrintWriter.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XercesDOMPrintWriter.cpp 2000/08/15 19:42:41 1.12
+++ XercesDOMPrintWriter.cpp 2000/09/05 02:24:57 1.13
@@ -203,11 +203,11 @@
{
if (b == true)
{
- print(XALAN_STATIC_UCODE_STRING("true"));
+ print(s_trueString);
}
else
{
- print(XALAN_STATIC_UCODE_STRING("false"));
+ print(s_falseString);
}
}
#endif
@@ -284,7 +284,7 @@
void
XercesDOMPrintWriter::println()
{
- m_OutputStream.write(c_wstr(XALAN_STATIC_UCODE_STRING("\n")));
+ m_OutputStream.write(c_wstr(s_newlineString));
flush();
}
1.8 +1 -0 xml-xalan/c/src/XercesPlatformSupport/XercesTextOutputStream.cpp
Index: XercesTextOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesPlatformSupport/XercesTextOutputStream.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XercesTextOutputStream.cpp 2000/08/22 20:20:15 1.7
+++ XercesTextOutputStream.cpp 2000/09/05 02:24:57 1.8
@@ -69,6 +69,7 @@
XercesTextOutputStream::XercesTextOutputStream(BufferType::size_type theBufferSize) :
+ TextOutputStream(),
m_buffer(),
m_bufferSize(0)
{