[sword-svn] r3719 - in trunk: include src/utilfuns
scribe at crosswire.org
scribe at crosswire.org
Sat Apr 18 20:19:53 MST 2020
Author: scribe
Date: 2020-04-18 20:19:53 -0700 (Sat, 18 Apr 2020)
New Revision: 3719
Modified:
trunk/include/utilxml.h
trunk/src/utilfuns/utilxml.cpp
Log:
added setEndTag to XMLTag
Modified: trunk/include/utilxml.h
===================================================================
--- trunk/include/utilxml.h 2020-04-13 15:43:43 UTC (rev 3718)
+++ trunk/include/utilxml.h 2020-04-19 03:19:53 UTC (rev 3719)
@@ -75,6 +75,13 @@
* otherwise, we return if we're a simple XML end </tag>.
*/
bool isEndTag(const char *eID = 0) const;
+ inline void setEndTag(bool value) {
+ if (!parsed)
+ parse();
+ endTag = value;
+ if (value)
+ empty = false;
+ }
const StringList getAttributeNames() const;
int getAttributePartCount(const char *attribName, char partSplit = '|') const;
Modified: trunk/src/utilfuns/utilxml.cpp
===================================================================
--- trunk/src/utilfuns/utilxml.cpp 2020-04-13 15:43:43 UTC (rev 3718)
+++ trunk/src/utilfuns/utilxml.cpp 2020-04-19 03:19:53 UTC (rev 3719)
@@ -291,13 +291,16 @@
tag.append('/');
tag.append(getName());
- for (StringPairMap::iterator it = attributes.begin(); it != attributes.end(); it++) {
- //tag.appendFormatted(" %s=\"%s\"", it->first.c_str(), it->second.c_str());
- tag.append(' ');
- tag.append(it->first.c_str());
- tag.append((strchr(it->second.c_str(), '\"')) ? "=\'" : "=\"");
- tag.append(it->second.c_str());
- tag.append((strchr(it->second.c_str(), '\"'))? '\'' : '\"');
+
+ if (!isEndTag()) {
+ for (StringPairMap::iterator it = attributes.begin(); it != attributes.end(); it++) {
+ //tag.appendFormatted(" %s=\"%s\"", it->first.c_str(), it->second.c_str());
+ tag.append(' ');
+ tag.append(it->first.c_str());
+ tag.append((strchr(it->second.c_str(), '\"')) ? "=\'" : "=\"");
+ tag.append(it->second.c_str());
+ tag.append((strchr(it->second.c_str(), '\"'))? '\'' : '\"');
+ }
}
if (isEmpty())
More information about the sword-cvs
mailing list