Fixed xml sym:name problem.

**** SPECIAL CAUTION TO DEVELOPERS ****
The strings that represent attribute key names like "name",
"sym:name", "type", and so forth are extensively shared to save
memory.  If a key name is modified for some reason (which is not
recommended), be aware that those change may affect thousands of parse
tree nodes.  Moreover, changes to a key name will break the hashing
algorithm used to perform attribute lookup.

Bottom line: don't modify hash table key strings.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4618 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-03-23 14:13:34 +00:00
parent cbfec5e059
commit 3851e222d0
1 changed files with 8 additions and 4 deletions

View File

@ -178,21 +178,25 @@ public:
print_indent(0);
if (DohIsString(Getattr(obj,k)))
{
String *ck = NewString(k);
o = Str(Getattr(obj,k));
Replaceall( k, ":", "_" );
Replaceall( ck, ":", "_" );
/* Do first to avoid aliasing errors. */
Replaceall( o, "&", "&" );
Replaceall( o, "<", "&lt;" );
Replaceall( o, "\"", "&quot;" );
Replaceall( o, "\\", "\\\\" );
Printf(out,"<attribute name=\"%s\" value=\"%s\" id=\"%ld\" addr=\"%x\" />\n", k, o, ++id, o );
Printf(out,"<attribute name=\"%s\" value=\"%s\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
Delete(o);
Delete(ck);
}
else
{
o = Getattr(obj,k);
Replaceall( k, ":", "_" );
Printf(out,"<attribute name=\"%s\" value=\"%x\" id=\"%ld\" addr=\"%x\" />\n", k, o, ++id, o );
String *ck = NewString(k);
Replaceall( ck, ":", "_" );
Printf(out,"<attribute name=\"%s\" value=\"%x\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
Delete(ck);
}
}
k = Nextkey(obj);