Re: Structure_DataGrid
| From: | Justin Patrin | Date: | Mon, 12 Sep 2005 02:57:54 +0000 |
| Subject: | Re: Structure_DataGrid | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20913@lists.php.net to get a copy of this message | ||
On 9/11/05, Barry Steele <barry@hpfm.com.au> wrote:
> Hi,
> I have just started using Structure_DataGrid, mostly with DB_DataObjects
> to out put XML documents but have run into a few issues that I'm sure are
> relatively trivial to sort, though I have had some issues.
>
I believe I have responded to this question before. It would be
helpful if you could keep the discussion in one thread.
> The first issue is the treatment of null values in the record set. At
> present tio seems that if the result contains records in which some
> columns are null, the XML output will contain empty tags
> (<columnName></columnName>).
>
> This causes issues for applications that want to use the result as it
> creates badly formed XML - the tags should be ommitted rather than have an
> empty tag as above.
How is this badly formed? AFAIK <tag></tag> is valid XML and is simply
equivalent to <tag/> which is perfectly valid. An empty tag can confer
meaning. (think <br/>).
In the case of Structures_DataGrid it's outputting records of data. A
record has a certain number of fields. It makes perfect sense to
output a tag with no data if there is no data in the column.
>
> What is the best way to make this happen? Should I use
> Structure_DataGrid_Column and define an output format function?
>
If you must omit empty tags (although you shouldn't have to. If the
app using your data can't handle empty tags you should fix that
instead as *it* is the one in error) then you're going to have to make
changes to the XML Renderer. I suggest making a copy which extends the
current one and then override only what you need to.
A column formatter would not work here as they format only the data,
not the output of the marked up column.
--
Justin Patrin