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...@apache.org on 2005/12/17 07:13:40 UTC
svn commit: r357309 - in /xalan/c/trunk/src/xalanc/XMLSupport:
FormatterToHTML.cpp FormatterToHTML.hpp XalanHTMLElementsProperties.hpp
Author: dbertoni
Date: Fri Dec 16 22:13:37 2005
New Revision: 357309
URL: http://svn.apache.org/viewcvs?rev=357309&view=rev
Log:
Fixes for XALANC-591.
Modified:
xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp
xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp
xalan/c/trunk/src/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp
Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp?rev=357309&r1=357308&r2=357309&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.cpp Fri Dec 16 22:13:37 2005
@@ -14,10 +14,6 @@
* limitations under the License.
*/
- /**
- * @author David N. Bertoni <da...@lotus.com>
- */
-
// Class header file.
@@ -102,6 +98,8 @@
m_shouldWriteXMLHeader = false;
}
+
+
FormatterToHTML*
FormatterToHTML::create(
MemoryManagerType& theManager,
@@ -138,6 +136,8 @@
return theResult;
}
+
+
FormatterToHTML::~FormatterToHTML()
{
}
@@ -170,21 +170,17 @@
initAttrCharsMap();
#if defined(XALAN_STRICT_ANSI_HEADERS)
- std::memset(m_charsMap, 0, sizeof(m_charsMap));
-#else
- memset(m_charsMap, 0, sizeof(m_charsMap));
+ using std::memset;
#endif
+ memset(m_charsMap, 0, sizeof(m_charsMap));
+
m_charsMap[XalanUnicode::charLF] = 'S';
m_charsMap[XalanUnicode::charLessThanSign] = 'S';
m_charsMap[XalanUnicode::charGreaterThanSign] = 'S';
m_charsMap[XalanUnicode::charAmpersand] = 'S';
-#if defined(XALAN_STRICT_ANSI_HEADERS)
- std::memset(m_charsMap, 'S', 10);
-#else
memset(m_charsMap, 'S', 10);
-#endif
m_charsMap[0x0A] = 'S';
m_charsMap[0x0D] = 'S';
@@ -265,9 +261,14 @@
void
FormatterToHTML::endDocument()
{
+ assert(m_isRawStack.empty() == true);
+ assert(m_inScriptElemStack.empty() == false);
+ assert(m_hasNamespaceStack.empty() == true);
+ assert(m_elementPropertiesStack.empty() == true);
assert(m_elementLevel == 0);
m_inScriptElemStack.pop_back();
+ assert(m_inScriptElemStack.empty() == true);
FormatterToXML::endDocument();
}
@@ -285,11 +286,14 @@
}
else
{
- writeParentTagEnd();
+ writeParentTagEnd();
const XalanHTMLElementsProperties::ElementProperties& elemProperties =
XalanHTMLElementsProperties::find(name);
assert(elemProperties.null() == false);
+ assert(
+ length(elemProperties.getName()) == 0 ||
+ compareIgnoreCaseASCII(name, elemProperties.getName()) == 0);
// Push a copy onto the stack for endElement(). Don't worry --
// the copy is cheap!
@@ -392,7 +396,7 @@
{
m_currentIndent -= m_indent;
- const bool hasChildNodes = childNodesWereAdded();
+ const bool hasChildNodes = childNodesWereAdded();
assert(m_isRawStack.empty() == false);
assert(m_inScriptElemStack.empty() == false);
@@ -404,6 +408,9 @@
const XalanHTMLElementsProperties::ElementProperties elemProperties =
m_elementPropertiesStack.back();
assert(elemProperties.null() == false);
+ assert(
+ length(elemProperties.getName()) == 0 ||
+ compareIgnoreCaseASCII(name, elemProperties.getName()) == 0);
m_elementPropertiesStack.pop_back();
@@ -1098,58 +1105,63 @@
bool
-FormatterToHTML::popHasNamespace()
+FormatterToHTML::doPopHasNamespace()
{
- if (m_hasNamespaceStack.empty() == true)
- {
- return false;
- }
- else
- {
- const bool theValue = m_hasNamespaceStack.back();
+ assert(m_prefixResolver != 0);
- m_hasNamespaceStack.pop_back();
+ assert(m_hasNamespaceStack.empty() == false);
+
+ const bool theValue = m_hasNamespaceStack.back();
+
+ m_hasNamespaceStack.pop_back();
- return theValue;
- }
+ return theValue;
}
bool
-FormatterToHTML::pushHasNamespace(const XalanDOMChar* theElementName)
+FormatterToHTML::doPushHasNamespace(const XalanDOMChar* theElementName)
{
+ assert(m_prefixResolver != 0);
+
bool fHasNamespace = false;
- if (m_prefixResolver != 0)
- {
- const XalanDOMString::size_type theLength = length(theElementName);
- const XalanDOMString::size_type theColonIndex = indexOf(theElementName, XalanUnicode::charColon);
+ const XalanDOMString::size_type theLength =
+ length(theElementName);
- const XalanDOMString* thePrefix = &s_emptyString;
+ const XalanDOMString::size_type theColonIndex =
+ indexOf(
+ theElementName,
+ XalanUnicode::charColon);
- if (theColonIndex < theLength)
- {
- substring(theElementName, m_stringBuffer, 0, theColonIndex);
+ const XalanDOMString* thePrefix = &s_emptyString;
- thePrefix = &m_stringBuffer;
- }
+ if (theColonIndex < theLength)
+ {
+ substring(
+ theElementName,
+ m_stringBuffer,
+ 0,
+ theColonIndex);
- assert(thePrefix != 0);
+ thePrefix = &m_stringBuffer;
+ }
- // Check for the namespace...
- const XalanDOMString* const theNamespace =
- m_prefixResolver->getNamespaceForPrefix(*thePrefix);
+ assert(thePrefix != 0);
- if (theNamespace != 0 && length(*theNamespace) != 0)
- {
- m_hasNamespaceStack.push_back(true);
+ // Check for the namespace...
+ const XalanDOMString* const theNamespace =
+ m_prefixResolver->getNamespaceForPrefix(*thePrefix);
- fHasNamespace = true;
- }
+ if (theNamespace != 0 && theNamespace->length() != 0)
+ {
+ fHasNamespace = true;
+ }
- clear(m_stringBuffer);
- }
+ m_stringBuffer.clear();
+
+ m_hasNamespaceStack.push_back(fHasNamespace);
return fHasNamespace;
}
Modified: xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp?rev=357309&r1=357308&r2=357309&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/FormatterToHTML.hpp Fri Dec 16 22:13:37 2005
@@ -270,12 +270,28 @@
accumHexNumber(XalanDOMChar theChar);
bool
- popHasNamespace();
+ popHasNamespace()
+ {
+ return m_prefixResolver == 0 ?
+ false :
+ doPopHasNamespace();
+ }
bool
- pushHasNamespace(const XalanDOMChar* theElementName);
+ pushHasNamespace(const XalanDOMChar* theElementName)
+ {
+ return m_prefixResolver == 0 ?
+ false :
+ doPushHasNamespace(theElementName);
+ }
- // Data members...
+ bool
+ doPopHasNamespace();
+
+ bool
+ doPushHasNamespace(const XalanDOMChar* theElementName);
+
+ // Data members...
XalanDOMString m_currentElementName;
bool m_inBlockElem;
Modified: xalan/c/trunk/src/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp?rev=357309&r1=357308&r2=357309&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp Fri Dec 16 22:13:37 2005
@@ -144,7 +144,7 @@
};
/**
- * This class acts as a proxy for and InternalElementProperties
+ * This class acts as a proxy for an InternalElementProperties
* instance.
*/
class XALAN_XMLSUPPORT_EXPORT ElementProperties
@@ -215,6 +215,17 @@
{
return m_properties->isAttribute(theAttributeName, theFlags);
}
+
+ /**
+ * Get the name of the element.
+ *
+ * @return The name of the element.
+ */
+ const XalanDOMChar*
+ getName() const
+ {
+ return m_properties->m_name;
+ }
private:
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org