現在、大きな XML ファイルのインポートで問題が発生しており、その理由がわかりません。サイズが約 443MB の XML 出力をパートナーから取得します。私が得るエラーは次のとおりです。
PHP Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : internal error in /home/imports/catalog.php on line 54
Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : internal error in /home/imports/catalog.php on line 54
PHP Warning: SimpleXMLElement::__construct(): ch to marriage, parenting, entrepreneurship, etc will be significantly upgraded. in /home/imports/catalog.php on line 54
Warning: SimpleXMLElement::__construct(): ch to marriage, parenting, entrepreneurship, etc will be significantly upgraded. in /home/imports/catalog.php on line 54
PHP Warning: SimpleXMLElement::__construct():
^ in /home/imports/catalog.php on line 54
Warning: SimpleXMLElement::__construct():
^ in /home/imports/catalog.php on line 54
PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/imports/catalog.php:54
Stack trace:
#0 /home/imports/catalog.php(54): SimpleXMLElement->__construct('<?xml version="...')
#1 {main}
thrown in /home/imports/catalog.php on line 54
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/imports/catalog.php:54
Stack trace:
#0 /home/imports/catalog.php(54): SimpleXMLElement->__construct('<?xml version="...')
#1 {main}
thrown in /home/imports/catalog.php on line 54
コードの 54 行目は次のとおりです。
$xml = new SimpleXMLElement(file_get_contents($_CFG_XML_URL));
私が知る限り、エラーは を含む要素にあるようですch to marriage, parenting, entrepreneurship, etc will be significantly upgraded.
。残念ながら、これはファイルへの長い道のりであり、そのサイズのために内容を読み取るのが困難です. 私の大きなファイル リーダーは一度に 1 行ずつ読み取りますが、この XML はすべて 1 行にあるため、32 GB の RAM と 64 ビットのエディターを備えたワークステーションであっても、適切に処理するには多すぎます。
ファイルを数回再ダウンロードしようとしましたが、問題は常に同じです。スクリプトに使用できるメモリを 2 倍にしましたが、同じ場所で失敗します。
そこで、パートナーに連絡して、この特定のアイテムの XML を要求したところ、次のものが提供されました。
<EBook EAN="9792219192201">
<Title>Success-a-Phobia</Title>
<SubTitle>Discovering And Conquering Mankinds Most Persuasive, but Unknown, Phobia</SubTitle>
<Publisher>The Benjamin Consulting Group, LLC</Publisher>
<PublicationDate>29/09/2012</PublicationDate>
<Contributors>
<Contributor Code="A01" Text="By (author)">Benjamin, Marcus D.</Contributor>
</Contributors>
<Formats>
<Format Type="6"/>
</Formats>
<ShortDescription>People today still desire to be successful in matters of family, finance or business even though we are in the midst of major social, political and economic challenges. Have you every been at that moment where you wanted to do something significant, yet you were paralyzed from making the necessary choices to realize your dream? Have you experienced failure and are now sitting in the stands, paralyzed from getting back in the &quote;game of life?&quote; Are you at the verge of a major decision that could affect your life for many years? If you are in this category, this is your book of the year! With humor, real-life antidotes, real-life examples and solid narration, Marcus Benjamin will guide you toward discovering the most pervasive, yet unknown, phobia in the history of mankind. Once this phobia is discovered, the second half of the book shows you how to rid yourself of this phobia for good. Not only will this book impact your life, but your approach to marriage, parenting, entrepreneurship, etc will be significantly upgraded.</ShortDescription>
</EBook>
その XML について私に警鐘を鳴らすものは何もありませんが、明らかに PHP の途中で問題が発生しています。要素のコンテンツには 978 文字あるように見えますが、それは私にとって特別な警鐘を鳴らすものではありません。
PHP スクリプトは、Amazon EC2 インスタンスのコマンドラインから実行されています。OS は Amazon Linux (RHEL) です。
だから、基本的に、私は立ち往生しています。この問題を引き起こしている可能性のあるアイデアはありますか?