Friday, 14 October 2016

Remove new line or space between tags in xml

$xml = '<Pages>
<Page Name="test">
<controls><test>this is a test.</test></controls>
<page Name="User">
echo $xml;

$re = '/(?<=\>)(\r?\n)|(\r?\n)(?=\<\/)/';
$substring = '';

$xml = preg_replace($re, $substring, $xml);

echo "The result of the substitution is ".$xml;


  1. Thanks for sharing the information.Impressive and i would like to share this with my friends
    Indian Cyber Army’s most awaited internship is live now. Summer Internship 2018 on “ Ethical hacking” and book your seats before it runs out.Candidates have to get themselves registered to be a part of this Internship program. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization.As career in ethical hacking is most in demand.

  2. Get to know about career in Ethical Hacking. Career Overview, Salary, Key skills and Education needed. Get how to Become Ethical Hacker guidelines ...

  3. In this age of Technology advancement, computer and information technology have not only brought convenience to citizens in modern life but also for policemen & various Government officials of the nation to fight cybercrime through various modus operandi. Indian Cyber Army has been dedicated in fighting cyber crime, striving to maintain law and order in cyberspace so as to ensure that everyone remains digitally safe.Read more:- Information Security