2012-03-27 6 views
2

このコードは動作していて、5.3.10にアップグレードしたときに動作を停止し、本当に奇妙なエラーを投げ始めました。PHP 5.3.10にアップグレードされ、simpleXMLelementが壊れています

オリジナルのXMLはw3c.orgでエラーなしで検証されますが、簡潔さとセキュリティに特化したサイトを編集しました。

XML(簡潔にするために編集されたが、エラーが1行上に生成される):のerror_logから

<AmberAlertDirective 
xmlns="http://www.hidden.com/AmberAlert" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.hidden.com/en_US/AmberAlert.xsd"> 
    <Directive>New</Directive> 
    <AmberAlertId>9969</AmberAlertId> 
    <MessageTimestamp>2012-03-27T00:35:11</MessageTimestamp> 
    <AmberAlert> 
    <Target> 
     <State Code="OH"> 
     </State> 
    </Target> 
    </AmberAlert> 
</AmberAlertDirective> 

PHPエラー:

PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : AttValue: &quot; or ' expected in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\&quot;http://www.missingkids.com/amber/NCMECAmberAlert\&quot; in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]:  ^in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : attributes construct error in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\&quot;http://www.missingkids.com/amber/NCMECAmberAlert\&quot; in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]:  ^in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : Couldn't find end of Start Tag AmberAlertDirective line 1 in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\&quot;http://www.missingkids.com/amber/NCMECAmberAlert\&quot; in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]:  ^in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 2: parser error : Extra content at the end of the document in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: xmlns=\&quot;http://www.missingkids.com/amber/NCMECAmberAlert\&quot; in /aa.php on line 125 
PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]:  ^in /aa.php on line 125 
PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /aa.php:125 
Stack trace: 
#0 /aa.php(125): SimpleXMLElement->__construct('<AmberAlertDire...') 
#1 /AAServlet.php(64): processAmber('<AmberAlertDire...') 
#2 {main} 
    thrown in /aa.php on line 125 
+1

そして、誰もが仕事である場合には、XML内のURLは、おそらくNSFWです。 – halfer

+0

http://www.php.net/manual/en/simplexml.examples-errors.phpの例1を試して、xml解析エラーがより詳しく記述されているかどうかを確認してください。 – cOle2

答えて

1

あなたのエラーから私はあなたの問題があなたの名前空間を登録していないと信じています。つまり、デフォルトのネームスペースです。それについてはいくつかの方法がありますが、データをどのように処理するかによって異なります。

XPATH:

$xml->registerXPathNamespace('default', 'http://www.hidden.com/AmberAlert'); 

子供():

$xml->children('http://www.hidden.com/AmberAlert'); 
関連する問題