Date: 03/21/01
- Next message: Peter Niederlag: "Re: [phplib] set_block/documentation"
- Previous message: Stephan Ullmann: "Re: [phplib] How Do I..."
- Next in thread: Bryan Willett: "Re: [phplib] About db_xsl.inc"
- Reply: Bryan Willett: "Re: [phplib] About db_xsl.inc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I was just checking out db_xsl.inc. It's very cool, and i think i'll use it
in my next project. However, wouldn't it be better to change the
get_result_xml() method to:
function get_result_xml() {
$this->xml = "";
$this->xml = $this->xml . '<?xml version="1.0"?>';
$this->xml = $this->xml . '<result>';
for ($index = 0; $index < DB_Sql::numrows(); $index++)
{
$this->xml = $this->xml . '<row>';
DB_Sql::next_record();
while (list($key, $val) = each($this->Record)) {
$this->xml = $this->xml . '<' . $key . '>' . $this->xml_encode($val)
. '</' . $key . '>';
}
$this->xml = $this->xml . '</row>';
}
$this->xml = $this->xml . '</result>';
return $this->xml;
}
to get rid of the pgsql specificity? OR even better yet, use the DOM
functions like so:
function get_xml_dom(){
$this->xmldoc = new_xmldoc("1.0");
$this->xmlroot = $this->xmldoc->add_root("result");
for ($i=0;$i<DB_Sql::num_rows();$i++){
$this->xmlnode[$i] = $this->xmlroot->new_child("row","");
DB_Sql::next_record();
while(list($key,$dataitem) = each($this->Record)){
$this->xmlnode[$i]->new_child($key,$this->xml_encode($dataitem));
}
}
return $this->xmldoc->dumpmem();
}
Note: I haven't tested this yet, but it seems to me to be more correct.
Regards
Jason Belich
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Peter Niederlag: "Re: [phplib] set_block/documentation"
- Previous message: Stephan Ullmann: "Re: [phplib] How Do I..."
- Next in thread: Bryan Willett: "Re: [phplib] About db_xsl.inc"
- Reply: Bryan Willett: "Re: [phplib] About db_xsl.inc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

