5 Replies Latest reply on Jul 27, 2009 8:35 AM by vpxav

    Error #1085: The element type "elements" must be terminated by the matching end-tag "</elements>"." faultCode="Client.CouldNotDecode"

    vpxav Level 1

      Hello everyone,

      I'm using an httpservice with a php script and resultformat "e4x".

      When I call my script directly in my browser, I receive a well formatted XML file (I think so as I can even see the closing tag </elements>).

      But, in my application, the debugger gives me the error saying that the end-tag is not there...

      Can you please help me?

      Here's the script:

      <?php
      //Set no caching
      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);
      header("Pragma: no-cache"); 
      header("Content-Type: text/xml");
      // Connect to MySQL database
      require_once('database/ConnectDB.php');
      mysql_select_db($database_ConnectDB, $ConnectDB);

      function DisplayElements($zone_id){
          $query = "
                  SELECT
                      element.element_id, element.name, element.description, element.zone_id, actval
                      FROM element
                      LEFT JOIN elm_motor USING (element_id)
                      LEFT JOIN modregister USING (element_id)
                      LEFT JOIN module USING (module_id)
                      WHERE element.type_sw_id = 602
                      AND module.status >= 128 AND element.zone_id = $zone_id
                      GROUP BY element.element_id ORDER BY name
                  ";
              $result = mysql_query($query) or die(mysql_error());
          while($data=mysql_fetch_assoc($result)){
              echo '<element id="'.$data['element_id'].'" name="'.$data['name'].'" description="'.$data['description'].'" zone_id="'.$data['zone_id'].'" actval="'.$data['actval'].'" prefval="'.$data['prefval'].'"/>';
          }
      }
      $zone_id = $_POST["zone_id"];
      echo '<elements>';
      DisplayElements($zone_id);
      echo '</elements>';

      ?>

      Thank you very much,

      a beginner...