1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2024-12-23 01:55:49 -05:00
xlxd/dashboard2/pgs/class.parsexml.php

30 lines
954 B
PHP
Raw Normal View History

<?php
class ParseXML {
2017-08-27 17:09:08 -04:00
public function __construct() {
2017-08-27 17:09:08 -04:00
return true;
}
2017-08-27 17:09:08 -04:00
public function GetElement($InputString, $ElementName) {
if (strpos($InputString, "<".$ElementName.">") === false) return false;
if (strpos($InputString, "</".$ElementName.">") === false) return false;
2017-08-27 17:09:08 -04:00
$Element = substr($InputString, strpos($InputString, "<".$ElementName.">")+strlen($ElementName)+2, strpos($InputString, "</".$ElementName.">")-strpos($InputString, "<".$ElementName.">")-strlen($ElementName)-2);
return $Element;
2017-08-27 17:09:08 -04:00
}
2017-08-27 17:09:08 -04:00
public function GetAllElements($InputString, $ElementName) {
$Elements = array();
while (strpos($InputString, $ElementName) !== false) {
$Elements[] = $this->GetElement($InputString, $ElementName);
2017-08-27 17:09:08 -04:00
$InputString = substr($InputString, strpos($InputString, "</".$ElementName.">")+strlen($ElementName)+3, strlen($InputString));
}
return $Elements;
}
2017-08-27 17:09:08 -04:00
}
2017-08-27 17:09:08 -04:00
?>