本文整理汇总了PHP中XMLParser::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLParser::getArray方法的具体用法?PHP XMLParser::getArray怎么用?PHP XMLParser::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLParser
的用法示例。
在下文中一共展示了XMLParser::getArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseXml
public function parseXml() {
global $global;
require_once($global['approot']."inc/lib_uuid.inc");
// save xml for debugging?
if($global['debugAndSaveXmlToFile'] == true) {
$filename = date("Y_md_H-i-s.".getMicrotimeComponent())."___".mt_rand().".xml"; // 2012_0402_17-50-33.454312___437849328789.xml
$path = $global['debugAndSaveXmlToFilePath'].$filename;
file_put_contents($path, $this->theString);
}
// is this a supported XML type?
if(!in_array((string)trim($this->xmlFormat), $global['enumXmlFormats'])) {
return (int)400;
}
//$a = xml2array($this->theString);
$aa = new XMLParser();
$aa->rawXML = $this->theString;
$aa->parse();
if($aa->getError()) {
return (int)403; // error code for failed to parse xml
}
$a = $aa->getArray();
// parse REUNITE4 XML
if($this->xmlFormat == "REUNITE4") {
$this->createUUID();
$this->arrival_reunite = true;
$this->given_name = isset($a['person']['givenName']) ? $a['person']['givenName'] : null;
$this->family_name = isset($a['person']['familyName']) ? $a['person']['familyName'] : null;
$this->expiry_date = isset($a['person']['expiryDate']) ? $a['person']['expiryDate'] : null;
$this->opt_status = isset($a['person']['status']) ? $a['person']['status'] : null;
$this->last_updated = date('Y-m-d H:i:s');
$datetime = isset($a['person']['dateTimeSent']) ? $a['person']['dateTimeSent'] : null;
$timezoneUTC = new DateTimeZone("UTC");
$timezoneLocal = new DateTimeZone(date_default_timezone_get());
$datetime2 = new DateTime();
$datetime2->setTimezone($timezoneUTC);
$datetime2->setTimestamp(strtotime($datetime));
$datetime2->setTimezone($timezoneLocal);
$this->creation_time = $datetime2->format('Y-m-d H:i:s');
$this->opt_gender = isset($a['person']['gender']) ? $a['person']['gender'] : null;
$this->years_old = isset($a['person']['estimatedAge']) ? $a['person']['estimatedAge'] : null;
$this->minAge = isset($a['person']['minAge']) ? $a['person']['minAge'] : null;
$this->maxAge = isset($a['person']['maxAge']) ? $a['person']['maxAge'] : null;
$this->other_comments = isset($a['person']['note']) ? $a['person']['note'] : null;
// TEMP HACK KLUGE to stuff person location data into the person_status last_known_location field
$kluge = "";
$kluge .= isset($a['person']['location']['street1']) ? $a['person']['location']['street1']."\n" : "";
$kluge .= isset($a['person']['location']['street2']) ? $a['person']['location']['street2']."\n" : "";
$kluge .= isset($a['person']['location']['neighborhood']) ? $a['person']['location']['neighborhood']."\n" : "";
$kluge .= isset($a['person']['location']['city']) ? $a['person']['location']['city']."\n" : "";
$kluge .= isset($a['person']['location']['region']) ? $a['person']['location']['region']."\n" : "";
$kluge .= isset($a['person']['location']['postalCode']) ? $a['person']['location']['postalCode']."\n" : "";
$kluge .= isset($a['person']['location']['country']) ? $a['person']['location']['country']."\n" : "";
if(trim($kluge) != "") {
$this->last_seen = $kluge;
}
// only update the incident_id if not already set
if($this->incident_id === null) {
$q = "
SELECT *
FROM incident
WHERE shortname = '".mysql_real_escape_string((string)$a['person']['eventShortname'])."';
";
$result = $this->db->Execute($q);
if($result === false) { daoErrorLog(__FILE__, __LINE__, __METHOD__, __CLASS__, __FUNCTION__, $this->db->ErrorMsg(), "person get incident ((".$q."))"); }
$this->incident_id = $result->fields["incident_id"];
}
if(isset($a['person']['photos']['photo'])) {
foreach($a['person']['photos'] as $photo) {
if(trim($photo['data']) != "") {
$i = new personImage();
$i->init();
$i->p_uuid = $this->p_uuid;
$i->fileContentBase64 = $photo['data'];
if(isset($photo['tags'])) {
foreach($photo['tags'] as $tag) {
$t = new personImageTag();
$t->init();
$t->image_id = $i->image_id;
$t->tag_x = $tag['x'];
$t->tag_y = $tag['y'];
$t->tag_w = $tag['w'];
$t->tag_h = $tag['h'];
$t->tag_text = $tag['text'];
$i->tags[] = $t;
}
//.........这里部分代码省略.........