I am usi开发者_StackOverflow社区ng XMLWriter to create an XML output of my MySQL Database, and I would like to know how I could prevent this happening <hello></hello>
by doing this <hello>nil</hello>
So basically replace "" with "nil".
<hello></hello>
is proper for indicating an empty node in XML; the other way is <hello />
. Replacing with nil
means it's no longer an empty node; it's a node with the text content nil
.
If you do that replacement, you're changing the meaning of the data in the XML. This is a terrible idea.
精彩评论