You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/07/18 08:16:05 UTC
cvs commit: xml-axis/c/src/common BasicTypeSerializer.cpp
susantha 2003/07/17 23:16:05
Modified: c/src/common BasicTypeSerializer.cpp
Log:
converting special XML charactors to entity references when serializing is done
Revision Changes Path
1.5 +64 -1 xml-axis/c/src/common/BasicTypeSerializer.cpp
Index: BasicTypeSerializer.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/BasicTypeSerializer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasicTypeSerializer.cpp 18 Jul 2003 05:29:10 -0000 1.4
+++ BasicTypeSerializer.cpp 18 Jul 2003 06:16:05 -0000 1.5
@@ -73,6 +73,7 @@
char BasicTypeSerializer::m_Buf[64];
XSDTYPE BasicTypeSerializer::m_Type;
string BasicTypeSerializer::m_sSZ = "";
+string BasicTypeSerializer::m_AuxStr = "";
BasicTypeSerializer::BasicTypeSerializer()
{
@@ -142,5 +143,67 @@
string& BasicTypeSerializer::GetEntityReferenced(const string &str)
{
- return str;
+ int pos;
+ //replace "&" with "&" if any
+ m_AuxStr = str;
+ pos = 0;
+ while (true)
+ {
+ pos = m_AuxStr.find('&', pos);
+ if (pos < m_AuxStr.length())
+ {
+ m_AuxStr = m_AuxStr.replace(pos, 1, "&");
+ }
+ else break;
+ pos++;
+ }
+ //replace "<" with "<" if any
+ pos = 0;
+ while (true)
+ {
+ pos = m_AuxStr.find('<', pos);
+ if (pos < m_AuxStr.length())
+ {
+ m_AuxStr = m_AuxStr.replace(pos, 1, "<");
+ }
+ else break;
+ pos++;
+ }
+ //replace ">" with ">" if any
+ pos = 0;
+ while (true)
+ {
+ pos = m_AuxStr.find('>', pos);
+ if (pos < m_AuxStr.length())
+ {
+ m_AuxStr = m_AuxStr.replace(pos, 1, ">");
+ }
+ else break;
+ pos++;
+ }
+ //replace "'" with "'" if any
+ pos = 0;
+ while (true)
+ {
+ pos = m_AuxStr.find('\'', pos);
+ if (pos < m_AuxStr.length())
+ {
+ m_AuxStr = m_AuxStr.replace(pos, 1, "'");
+ }
+ else break;
+ pos++;
+ }
+ //replace """ with """ if any
+ pos = 0;
+ while (true)
+ {
+ pos = m_AuxStr.find('"', pos);
+ if (pos < m_AuxStr.length())
+ {
+ m_AuxStr = m_AuxStr.replace(pos, 1, """);
+ }
+ else break;
+ pos++;
+ }
+ return m_AuxStr;
}