Question : Create blank tag in xml with no  single "open and close" tag


I am working in Java

I use to create a Node in Xml element by code

Document xmlDoc // is a xml document

Node node = xmlDoc.getDocumentElement();
Element element = xmlDoc.createElement("Attachments");

Above code creates Attachments node in my XML document like below
<Attachments />

For some reason I need to create a Element like below

<Attachments />

I mean I donot wanted single "open and close" tag in one line

I know both are syntatically correct. But I need to fix in my code to get an blank node in XML like below
<Attachments />

Can you please help me in this


Answer : Create blank tag in xml with no  single "open and close" tag

OOPS.. I must be really sleepy.. To sum it up:

You have to use addcslashes - note the C in between. In this function, you can give the list of characters to be escaped.
So, addcslashes($str, "\x00\n\r\'\"\x1a"); is equivalent to  mysql_real_escape_string($str); since the latter escapes only the characters listed in the former.
Here is the correct link:
Random Solutions  
programming4us programming4us