[phplib] dataset as xml then send to xslt From: Bryan Brunton (bryanbrun <email protected>)
Date: 02/24/01

I found a perl library that puts perl dbi queries into xml. I am thinking about doing the same
thing with PHPLIB. I would sent the XML to XSLT stylesheets.

Has anyone done this before?

Would it be better to use use str_replace in this code?

To see how this works here is the not quite functional code (probably mangled because I am sending
this via Yahoo):

  function xml_encode($text) {
    $search = array ("'&(quot|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i");
    $replace = array ( "\"", "&", "<", ">");

    return preg_replace ($search, $replace, $text);
  }

  function get_xml() {

    echo '<?xml version="1.0"?>';
    echo '<resultset statement="' . $this->Query_String . '">';

    $this->Record =  <email protected>($this->Query_ID, $this->Row++, 1);

    while (list($key, $val) = each($this->Record)) {
      echo "<" . $key . ">" . $this->xml_encode($val) . "</" . $key . ">";
    }

    echo "</resultset>";

    reset($this->Record);
  }

Play Merchant Empires (www.merchantempires.net): the only way to conquer the universe using PHPLIB.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>