PHP XML DOM save issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bel
Forum Newbie
Posts: 6
Joined: Wed Jan 19, 2011 10:04 pm

PHP XML DOM save issue

Post by Bel »

This issue is so simple that i cannot resolve it!

Simply all i wish to do at this point is take a xml file that was generated by word and duplicate it. At a later date i will manipulate the xml but for now i cannot even open and save the file!
The XML comes out corrupt is the problem and crashes word upon opening.
The saved XML is valid and scanning it i cannot find the issue.

Is there something im missing about php xml dom?

Code: Select all



    //Altering document XML file
    $xmlDoc = new DOMDocument();
    $xmlDoc->load( 'quotation/'.$_SESSION['account'].'/introduction.xml');
    $xmlDoc->preserveWhiteSpace = false;

    $xmlDoc->save('quotation/'.$_SESSION['account'].'/introduction_copy.xml');
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: PHP XML DOM save issue

Post by cpetercarter »

Have you looked at the xml file in a hex editor (which shows the hex value of every byte in the file)? It is possible that Word has added 'left-to-right' markings or some other non-visible markings to the file. In fact, creating an xml document in a word-processor is a bad idea. Use a proper text editor.
Post Reply