mirror of
https://github.com/ShaYmez/xlxd.git
synced 2024-11-07 16:26:06 -05:00
32 lines
992 B
PHP
32 lines
992 B
PHP
|
<?php
|
||
|
|
||
|
class ParseXML {
|
||
|
|
||
|
public function __construct() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function GetElement($InputString, $ElementName) {
|
||
|
if (strpos($InputString, "<".$ElementName.">") === false) return false;
|
||
|
if (strpos($InputString, "</".$ElementName.">") === false) return false;
|
||
|
|
||
|
$Element = substr($InputString, strpos($InputString, "<".$ElementName.">")+strlen($ElementName)+2, strpos($InputString, "</".$ElementName.">")-strpos($InputString, "<".$ElementName.">")-strlen($ElementName)-2);
|
||
|
return $Element;
|
||
|
|
||
|
}
|
||
|
|
||
|
public function GetAllElements($InputString, $ElementName) {
|
||
|
$Elements = array();
|
||
|
while (strpos($InputString, $ElementName) !== false) {
|
||
|
$Elements[] = $this->GetElement($InputString, $ElementName);
|
||
|
$InputString = substr($InputString, strpos($InputString, "</".$ElementName.">")+strlen($ElementName)+3, strlen($InputString));
|
||
|
}
|
||
|
return $Elements;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
?>
|