良い一日。crxml リポジトリを使用すると、xml ドキュメントが正しく生成されません。ドキュメントに新しい要素を追加すると、それが起こります。行動方針:まず、ドキュメントを作成します
$this->genXml->Item['Type'] = 'view';
$this->genXml->Item->{'http://'.$this->siteUrll.'|Name'} = 'Last View';
$this->genXml->Item->LastView->View->Time = $app['Time'];
$this->genXml->Item->LastView->View->Action = $app['Action'];
$this->genXml->Item->LastView->View->IP = $app['IP'];
return $this->genXml->xml();
この種のxmlファイルを取得します
<?xml version="1.0" encoding="UTF-8"?>
<Item Type="view">
<Name xmlns="http://sitename.com">Last View</Name>
<LastView>
<View>
<Time>11:45:12</Time>
<Action>Click</Action>
<IP>192.168.1.1</IP>
</View>
</LastView>
</Item>
完成した結果にさらに新しい価値を加える
$GetFile = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<Item Type="view">
<Name xmlns="http://sitename.com">Last View</Name>
<LastView>
<View>
<Time>11:45:12</Time>
<Action>Click</Action>
<IP>192.168.1.1</IP>
</View>
</LastView>
</Item>
EOB;
$this->genXml->loadXML($GetFile);
$this->genXml->Item->LastView->View[2]->Time = $app['Time'];
$this->genXml->Item->LastView->View[2]->Action = $app['Action'];
$this->genXml->Item->LastView->View[2]->IP = $app['IP'];
echo($this->genXml->xml());
欠陥のあるコードxmlを取得します
<?xml version="1.0" encoding="UTF-8"?>
<Item Type="view">
<Name xmlns="http://sitename.com">Last View</Name>
<LastView>
<View>
<Time>11:45:12</Time>
<Action>Click</Action>
<IP>192.168.1.1</IP>
</View>
<View/><View><Time>11:45:12</Time><Action>Click</Action> <IP>192.168.1.1</IP></View></LastView>
</Item>
つまり、タグの場所
<View/>
出力に関する問題の解決に役立ちます。多分私は何か間違ったことをしていますか?(私の英語で申し訳ありませんが、私は私が望むほど上手ではないことを知っています)リポジトリへのリンクと問題の説明を提供してください。