svn: /web/doc-editor/trunk/php/ ExtJsController.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sun, 05 Jun 2011 19:49:44 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=311841

Log:
Only check xml when we save .xml file

Changed paths:
    U   web/doc-editor/trunk/php/ExtJsController.php

Modified: web/doc-editor/trunk/php/ExtJsController.php
===================================================================
--- web/doc-editor/trunk/php/ExtJsController.php	2011-06-05 19:37:07 UTC (rev 311840)
+++ web/doc-editor/trunk/php/ExtJsController.php	2011-06-05 19:49:44 UTC (rev 311841)
@@ -861,18 +861,19 @@
         // Replace &nbsp; by space
         $fileContent = str_replace("&nbsp;", "", $fileContent);

-        // We check the Xml consistence
-        $xmlError = $tx->checkForError($fileContent);
-
-        if( $xmlError != 'no_error' ) {
-            return JsonResponseBuilder::failure(
-                    array(
-                        'XmlError' => $xmlError
-                    )
-            );
+        // We check the Xml consistence only for .xml file
+        if( substr($fileName, -3) == 'xml' ) {
+            $xmlError = $tx->checkForError($fileContent);
+
+            if( $xmlError != 'no_error' ) {
+                return JsonResponseBuilder::failure(
+                        array(
+                            'XmlError' => $xmlError
+                        )
+                );
+            }
         }

-
         // Get file object
         $file = new File($fileLang, $filePath.$fileName);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.