Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


XML file tobe open in notepad in correct format like xml format

XML file tobe open in notepad in correct format like xml format

XML file tobe open in notepad in correct format like xml format

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 -
[code php]
$xmlString = '
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"



$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->formatOutput = TRUE;
//Save XML as a file

//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

RE: XML file tobe open in notepad in correct format like xml format

This is most likely more of a PHP issue, rather than an XML issue. However, you might try placing
$dom->formatOutput = TRUE;
before you load the document. But...I also think (but certainly do not know for sure) that the loaded XML will not be pretty-printed. formatOutput (again, I think) only affects elements that are added programatically.

(I also think that you need to learn how to use the markup tools available on this site to protect characters that have special meaning in XML/HTML. I think some of your posted code doesn't make too much sense, probably because your

CODE --> Tek-Tips

[code php] 
is not being recognized. Use the "Preview" button to review before submitting. Notice that the code in your post doesn't look like this...)

Tom Morrison

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close