/framework/core/xml/XmlDom.php

http://zoop.googlecode.com/ · PHP · 24 lines · 18 code · 2 blank · 4 comment · 0 complexity · 71ab6fd11519750d0181e222fcd78d49 MD5 · raw file

  1. <?
  2. class XmlDom
  3. {
  4. var $xmlTree;
  5. // returns the root node
  6. function parseText($xml)
  7. {
  8. $this->xmlTree = new DOMDocument();
  9. $this->xmlTree->loadXML($xml);
  10. return new XmlNode($this->xmlTree->firstChild);
  11. }
  12. function parseFile($fileName)
  13. {
  14. $this->xmlTree = new DOMDocument();
  15. // print_r($this->xmlTree);
  16. $this->xmlTree->load($fileName);
  17. // print_r($this->xmlTree->documentElement->firstChild->nextSibling->nodeName);
  18. // die('here');
  19. return new XmlNode($this->xmlTree->documentElement);
  20. }
  21. }
  22. ?>