Fix a .pmx file whose XML is corrupted

From pmusers
Jump to: navigation, search

If an error occurs while exporting a process, the error will be written at the start of .pmx file which is generated.

When trying to import the process file, the following error message will be displayed:

FixCorruptedPmxFile ErrorMessage.png

Warning: DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 2 in /opt/processmaker/workflow/engine/src/ProcessMaker/Importer/Xmlimporter.php on line 35

Fatal error: Call to a member function getAttribute() or null in /opt/processmaker/workflow/engin/src/ProcessMaker/Importer/Xmlimporter.php on line 39

This error message indicates that the XML has been corrupted by the HTML error which was added to the start of the .pmx file.

To get around this problem, open the .pmx file with a plain text editor (like Geany) and change the start of the file from:

<br />
<b>Warning</b>:  file_get_contents(/opt/processmaker/shared/sites/workflow/xmlForms/3998213725ce4ff038751b2063175762/9787764195ceb99861e9099000603606.xml): failed to open stream: No such file or directory in <b>/opt/processmaker/workflow/engine/src/ProcessMaker/Project/Workflow.php</b> on line <b>1177</b><br />
<br />
<b>Warning</b>:  file_get_contents(/opt/processmaker/shared/sites/workflow/xmlForms/3998213725ce4ff038751b2063175762/6559481215ceb969ed48539042581624.xml): failed to open stream: No such file or directory in <b>/opt/processmaker/workflow/engine/src/ProcessMaker/Project/Workflow.php</b> on line <b>1177</b><br />
<?xml version="1.0" encoding="utf-8"?>

To:

<?xml version="1.0" encoding="utf-8"?>

Now it should be possible to import the .pmx file into ProcessMaker.