jdonohue 00/03/20 09:33:51
Modified: c/src/XMLSupport FormatterToHTML.cpp FormatterToHTML.hpp
Log:
Added startDocument method
Revision Changes Path
1.9 +39 -6 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FormatterToHTML.cpp 2000/03/16 20:48:58 1.8
+++ FormatterToHTML.cpp 2000/03/20 17:33:51 1.9
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
/**
- * $Id: FormatterToHTML.cpp,v 1.8 2000/03/16 20:48:58 jdonohue Exp $
+ * $Id: FormatterToHTML.cpp,v 1.9 2000/03/20 17:33:51 jdonohue Exp $
*
* $State: Exp $
*
@@ -130,6 +130,40 @@
}
+void
+FormatterToHTML::startDocument()
+{
+ m_needToOutputDocTypeDecl = true;
+ m_startNewLine = false;
+
+ if(true == m_needToOutputDocTypeDecl)
+ {
+ // Output the header if either the System or Public attributes
are
+ // specified
+ if((! isEmpty(m_doctypeSystem)) || (! isEmpty(m_doctypePublic)))
+ {
+ m_writer.write("<!DOCTYPE HTML");
+ if(! isEmpty(m_doctypePublic))
+ {
+ m_writer.write(" PUBLIC \"");
+ m_writer.write(m_doctypePublic);
+ m_writer.write("\"");
+ }
+ if(! isEmpty(m_doctypeSystem))
+ {
+ if(isEmpty(m_doctypePublic))
+ m_writer.write(" SYSTEM \"");
+ else
+ m_writer.write(" \"");
+ m_writer.write(m_doctypeSystem);
+ m_writer.write("\"");
+ }
+ m_writer.write(">");
+ m_writer.write(m_lineSep);
+ }
+ }
+ m_needToOutputDocTypeDecl = false;
+}
void
FormatterToHTML::endDocument()
@@ -194,8 +228,9 @@
// element is a non-block element, then do not indent.
m_doIndent =
((s_nonblockelems.end() != s_nonblockelems.find(toUpperCase(theName)))
||
- ((! isEmpty(m_currentElementName)) &&
- (s_nonblockelems.end() !=
s_nonblockelems.find(toUpperCase(m_currentElementName)))))
+ ((! isEmpty(m_currentElementName) &&
+ (s_nonblockelems.end() !=
+ s_nonblockelems.find(toUpperCase(m_currentElementName))))))
? false : true;
m_currentElementName = name;
@@ -243,12 +278,10 @@
m_currentIndent -= m_indent;
// name = name.toUpperCase();
const bool hasChildNodes = childNodesWereAdded();
- bool isWhitespaceSensitive
- = (s_nonblockelems.end() != s_nonblockelems.find(toUpperCase(name)));
if (hasChildNodes == true)
{
- if (shouldIndent() == true && ! isWhitespaceSensitive)
+ if (shouldIndent() == true)
indent(m_writer, m_currentIndent);
m_writer.write("</");
m_writer.write(name);
1.4 +4 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FormatterToHTML.hpp 2000/03/07 20:22:38 1.3
+++ FormatterToHTML.hpp 2000/03/20 17:33:51 1.4
@@ -58,7 +58,7 @@
#define FORMATTERTOHTML_HEADER_GUARD_1357924680
/**
- * $Id: FormatterToHTML.hpp,v 1.3 2000/03/07 20:22:38 jdonohue Exp $
+ * $Id: FormatterToHTML.hpp,v 1.4 2000/03/20 17:33:51 jdonohue Exp $
*
* $State: Exp $
*
@@ -131,6 +131,9 @@
// These methods are inherited from DocumentHandler ...
+
+ virtual void
+ startDocument();
virtual void
endDocument();