Re: Re: Error with DOMDocument in php's functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mauricio Muriel wrote:
> Hi Shawn,
>
> Thanks for your time, this is the complete code of the function (in
> fact the complete code in: xml_match.php file)
>
> <?php
>
> function xml_match($columns,$text,&$result)
> {$debug=true;
>  echo "Starting  XML Module";
>     if ($debug)
>        {echo "<br /><strong>Starting XML match</strong><br />";
>        }
>
>  $text = preg_replace ("%\>[\n\t\r\ ]+%",">",$text);
>
>  $doc = new DOMDocument();
>  if ($debug)
>     {echo "Created DOMDoc<br />\n";
>      print_r($doc);
>      echo "<br />\n";
>     }
>  $doc->loadXML($text);
>  
>  if ($debug)
>     {echo "loaded XML<br />\n";
>      print_r($doc);
>      echo "<br />\n";
>     }
>  $arrRet = array('x');
>  $totalHouses=0;
>  $lastInd=0;
>
>
>  if ($debug)
>     {print_r($doc);
>     }
>
>  $indTotalEle = 0;//Total elements
>     
>  //=============================================================================
>  //Defines the "root" tag of the houses
>  //=============================================================================
>  $dataNode = '';//It is the node for the "actual" node.
>  $baseNode = '';//It is a reference to the "base" node, It is used to have
>
>  
>  if ($debug)
>     {echo "Doc node: ".$doc->nodeName."<br />\n";
>        
>     }
>
>  $arrDocChilds = $doc->childNodes;
>  echo "Size of array: ".$arrDocChilds->length." <br />";
>  for ($i=0;$i<count($arrDocChilds->length);$i++)
>      {if ($arrDocChilds->item($i)->nodeType <> '3')
>          {echo "Entro aqui";
>           $rootElement = $arrDocChilds->item($i);
>           break(1);
>           $i=$arrDocChilds->length;
>          }     
>      }
>  $dataNode = $rootElement;
>  
> ?>
>
> This is the error in command line:
>
> [admin@server xml]$ php xml_match.php
> PHP Parse error:  parse error in
> /var/www/vhosts/default/htdocs/spytest/share/xml/xml_match.php on line 60
> Content-type: text/html
> X-Powered-By: PHP/4.3.2
>
>
> I try to include the file in another .php file (test.php), this way:
>
> <?php
>
>   include ("xml_match.php");
>  
>   ?>
>
> And I run this script this way:
>
> [admin@server xml]$ php test.php
> PHP Parse error:  parse error in
> /var/www/vhosts/default/htdocs/spytest/share/xml/xml_match.php on line 60
> Content-type: text/html
> X-Powered-By: PHP/4.3.2
>
> I hope you can help me, I don't know why it is happening.
>
> Best regards
>
> Mauricio M.

Please keep replies on list.

At a minimum you are missing the closing brace } for your function.  I
would suggest that you find an IDE or at least a text editor that has
PHP syntax checking.

-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux