harish pathak
Programmer
Hi Guys,
We have a requirement to download the internal table data as XML file.
I am generating a XML file (welcome.xml) through PHP. The PHP code is as -
Able to download the XML file in correct format, but when opened in NOTEPAD we are getting the complete tags of the XML in a single line.
We need the notepad file also to look like the format of the XML file when opened.
Please answer is there any solution for this (XML file should be in XML format when opened in Notepad)
Please reply as soon as possible.
Thanks in advance.
Harish Pathak
We have a requirement to download the internal table data as XML file.
I am generating a XML file (welcome.xml) through PHP. The PHP code is as -
PHP:
<?php
$xmlString = '<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL]
xmlns:image="[URL unfurl="true"]http://www.google.com/schemas/sitemap-image/1.1"[/URL]
xsi:schemaLocation="[URL unfurl="true"]http://www.sitemaps.org/schemas/sitemap/0.9[/URL] [URL unfurl="true"]http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"[/URL]
xmlns="[URL unfurl="true"]http://www.sitemaps.org/schemas/sitemap/0.9">[/URL]
<url>
<loc>[URL unfurl="true"]http://www.codexworld.com</loc>[/URL]
<lastmod>2016-07-04T07:46:18+00:00</lastmod>
<changefreq>always</changefreq>
<priority>1.00</priority>
</url>
</urlset>';
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($xmlString);
$dom->formatOutput = TRUE;
//Save XML as a file
$dom->save('test/welcome.xml');
//View XML document
echo $dom->saveXml();
?>
Able to download the XML file in correct format, but when opened in NOTEPAD we are getting the complete tags of the XML in a single line.
We need the notepad file also to look like the format of the XML file when opened.
Please answer is there any solution for this (XML file should be in XML format when opened in Notepad)
Please reply as soon as possible.
Thanks in advance.
Harish Pathak