Juz sobie poradzilem, i dziekuje wszystkim za wspaniala pomoc tongue.gif

Mam problem:
Uzywam pakietu PEAR::XML_Parser do pracowania z html-em, wedlug przykladu z dokumentacji :

http://pear.php.net/manual/en/package.xml....ser.example.php

wstawiam calol logike dzialania dla poszczegulnego tagu w startHandler(), np:
  1. <?php
  2. public function startHandler($xp, $name, $attribs)
  3. {
  4. $name = strtolower($name);
  5. foreach($this->supportedTags as $tag) {
  6. if(str_replace('cp:','',$name) == strtolower($tag)) {
  7. $toInc = ucwords(str_replace('cp:','',$name));
  8. $toInc_ = 'cpLib/class.{$toInc}TagHandler.php';
  9. require_once($toInc_);
  10. $xmlString = '<{$name} ';
  11. foreach($attribs as $key =>$value) {
  12.  $xmlString.= '$key='$value' ';
  13. }
  14. $xmlString .= ' />';
  15. $handlerClassName = ucwords(str_replace('cp:','',$name)).'TagHandler';
  16. $tHandler = new $handlerClassName();
  17. if(! is_subclass_of($tHandler,'TagHandler')) {
  18. throw new Exception('The $name tag handling class must be a child of TagHandler class.');
  19. } else {
  20. $tHandler->setInputString($xmlString);
  21. $tHandler->Parse();
  22. [echo / return / cokolwiek ] $tHandler->TagOutput();
  23.  
  24. }
  25. }
  26. }
  27. }
  28. ?>


i teraz mam problem z podmienieniem tagu ktory wlasnie zparsowalem z jego outputem,
to znaczy ze jak mam np
  1. <html>
  2. [...]
  3. <cp:block ID="1" />
  4. [...]
  5. </html>


to zeby sie po parsowaniu stalo :

  1. <html>
  2. [...]
  3. Jakies tam duperele co so w block numer 1
  4. [...]
  5. </html>

mysle ze wiekszosc z was zrozumie o co mi chodzi, jak cos to moge jasniej wytlumaczyc.

ps. Bardzo mo zalezy na uzyciut wlasnie tej biblioteki tak ze prosze nie proponujecie mi SimpleXML czy innych.

ps2. jakby ktos potszebowal to caly kod jest tutaj

Juz sobie poradzilem, i dziekuje wszystkim za wspaniala pomoc tongue.gif