dbertoni 00/05/15 08:52:50
Modified: c/src/XMLSupport FormatterToXML.hpp FormatterToXML.cpp
FormatterToHTML.hpp FormatterToHTML.cpp
Log:
Fixed bug in special character processing. Made attribute preparation more
efficient.
Revision Changes Path
1.10 +8 -3 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FormatterToXML.hpp 2000/04/20 16:41:41 1.9
+++ FormatterToXML.hpp 2000/05/15 15:52:47 1.10
@@ -273,8 +273,8 @@
*/
void
processAttribute(
- const XalanDOMString& name,
- const XalanDOMString& value);
+ const XalanDOMChar* name,
+ const XalanDOMChar* value);
/**
* Returns the specified <var>string</var> after substituting
<VAR>specials</VAR>,
@@ -288,7 +288,7 @@
*/
static XalanDOMString
prepAttrString(
- const XalanDOMString& string,
+ const XalanDOMChar* string,
const XalanDOMString& specials,
const XalanDOMString& encoding);
@@ -360,6 +360,11 @@
* The character encoding. Not currently used.
*/
XalanDOMString m_encoding;
+
+ /**
+ * Test for standalone part of header.
+ */
+ const XalanDOMString m_standalone;
/**
* Tell if the next text should be raw.
1.17 +22 -11 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- FormatterToXML.cpp 2000/05/08 17:23:59 1.16
+++ FormatterToXML.cpp 2000/05/15 15:52:48 1.17
@@ -75,7 +75,7 @@
-static XalanDOMString
theDefaultAttrSpecialChars(XALAN_STATIC_UCODE_STRING("<>&\"\'\r\n"));
+static XalanDOMString
theDefaultAttrSpecialChars(XALAN_STATIC_UCODE_STRING("<>&\"\r\n"));
const XalanDOMString FormatterToXML::DEFAULT_MIME_ENCODING =
XALAN_STATIC_UCODE_STRING("UTF-8");
@@ -99,7 +99,7 @@
const XalanDOMString& doctypeSystem,
const XalanDOMString& doctypePublic,
bool xmlDecl,
- const XalanDOMString& /* standalone */) :
+ const XalanDOMString& standalone) :
FormatterListener(),
m_attrSpecialChars(theDefaultAttrSpecialChars),
m_currentIndent(0),
@@ -108,6 +108,7 @@
m_doIndent(doIndent),
m_elemStack(),
m_encoding(encoding),
+ m_standalone(standalone),
m_escapeCData(false),
m_indent(indent),
m_ispreserve(false),
@@ -211,6 +212,13 @@
m_writer.write(version);
m_writer.write(XALAN_STATIC_UCODE_STRING("\"
encoding=\""));
m_writer.write(encoding);
+
+ if (length(m_standalone) != 0)
+ {
+ m_writer.write(XALAN_STATIC_UCODE_STRING("\"
standalone=\""));
+ m_writer.write(m_standalone);
+ }
+
m_writer.write(XALAN_STATIC_UCODE_STRING("\"?>"));
m_writer.write(m_lineSep);
}
@@ -803,8 +811,8 @@
void
FormatterToXML::processAttribute(
- const XalanDOMString& name,
- const XalanDOMString& value)
+ const XalanDOMChar* name,
+ const XalanDOMChar* value)
{
try
{
@@ -824,11 +832,12 @@
XalanDOMString
FormatterToXML::prepAttrString(
- const XalanDOMString& string,
+ const XalanDOMChar* string,
const XalanDOMString& specials,
const XalanDOMString& /* encoding */)
{
const unsigned int theLength = length(string);
+ const unsigned int theSpecialsLength = length(specials);
// we'll do the work into a buffer pre-allocated to
// twice the size of the original string, giving some
@@ -849,17 +858,18 @@
{
const XalanDOMChar ch = charAt(string, i);
- const int chNum =
static_cast<int>(ch);
+ const int chNum = ch;
const unsigned int index = indexOf(specials, ch);
- if (index < length(specials))
+ if (index < theSpecialsLength)
{
vec.push_back('&');
vec.push_back('#');
const DOMString ds = LongToDOMString(ch);
+ const unsigned int dsLen = length(ds);
const XMLCh* pb = c_wstr(ds);
- for(int k = 0; k < length(ds); k++)
+ for(unsigned int k = 0; k < dsLen; k++)
vec.push_back(*pb++);
vec.push_back(';');
}
@@ -897,8 +907,9 @@
vec.push_back('x');
const XalanDOMString num = LongToHexDOMString(next);
+ const unsigned int numLength = length(num);
- for (unsigned int k=0; k < length(num); k++)
+ for (unsigned int k=0; k < numLength; k++)
vec.push_back(charAt(num, k));
vec.push_back(';');
@@ -986,9 +997,9 @@
const XalanDOMString& s,
int pos)
{
- const int l = length(s);
+ const unsigned int l = length(s);
m_charBuf[pos++] = '&';
- for(int i = 0; i < l; i++)
+ for(unsigned int i = 0; i < l; i++)
{
m_charBuf[pos++] = charAt(s, i);
}
1.7 +3 -3 xml-xalan/c/src/XMLSupport/FormatterToHTML.hpp
Index: FormatterToHTML.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToHTML.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FormatterToHTML.hpp 2000/04/12 19:40:49 1.6
+++ FormatterToHTML.hpp 2000/05/15 15:52:49 1.7
@@ -58,7 +58,7 @@
#define FORMATTERTOHTML_HEADER_GUARD_1357924680
/**
- * $Id: FormatterToHTML.hpp,v 1.6 2000/04/12 19:40:49 jdonohue Exp $
+ * $Id: FormatterToHTML.hpp,v 1.7 2000/05/15 15:52:49 dbertoni Exp $
*
* $State: Exp $
*
@@ -240,8 +240,8 @@
*/
virtual void
processAttribute(
- const XalanDOMString& name,
- const XalanDOMString& value);
+ const XalanDOMChar* name,
+ const XalanDOMChar* value);
/**
* Returns the specified <var>string</var> after substituting non ASCII
characters,
1.16 +3 -3 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FormatterToHTML.cpp 2000/04/20 16:41:41 1.15
+++ FormatterToHTML.cpp 2000/05/15 15:52:49 1.16
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
/**
- * $Id: FormatterToHTML.cpp,v 1.15 2000/04/20 16:41:41 dbertoni Exp $
+ * $Id: FormatterToHTML.cpp,v 1.16 2000/05/15 15:52:49 dbertoni Exp $
*
* $State: Exp $
*
@@ -564,8 +564,8 @@
void
FormatterToHTML::processAttribute(
- const XalanDOMString& name,
- const XalanDOMString& value)
+ const XalanDOMChar* name,
+ const XalanDOMChar* value)
{
try
{