Hamburger Hamburger

php Library

XML_extractElement

Keine Erläuterungen gefunden.

<?php
function XML_extractElement($xml,$element){
  /* STRPOS gives first occurence of substring */
  $startElement="<".$element;
  $endElement="</".$element.">";
  $elementLen=strlen($endElement);
  $endPos=strpos($xml,$endElement);
  $i=-1;
  while ($endPos){
    $save++;if($save>1e3){echo "To many elements!";exit(1);}
    $startPos=strpos($xml,$startElement);
    if ($startPos>$endPos){
      echo "<".$element.">\nXML is corrupted!";break;
    }
    $i++;
    $preString=substr($xml,0,$startPos);
    $elementsFound[$i]=substr($xml,$startPos,$endPos-$startPos+$elementLen);
    $postString=substr($xml,$endPos+$elementLen);
    $xml=$preString.$postString;
    $endPos=strpos($xml,$endElement);
  }
  $NoElements=$i+1;

  return array($elementsFound,$NoElements);
}
?>

Index of Library

1globals.php
2readData.php
3XML_readFile.php
4fraktal.php
5fileGrep.php
6XML_extractTag.php
7writeNamedData.php
8readXmlFile.php
9readNamedData.php
10XML_findAllElements.php
11readFromStdIn.php
12plotResult.php
13dtaus.php
14pdf.php
15fitData.php
16XML_extractElement.php
17readFilenames.php
18writeData.php
19genDTAUS.php
20closeFigures.php
21XML_extractAttribute.php
22enumerateFiles.php
23db.php
24polynominalFit.php
25LaTeXbrief.php
26hex2dec.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.