From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: XML schemas and PG column names |
Date: | 2009-12-12 16:51:17 |
Message-ID: | 4B23CA05.8020503@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I propose that we annotate the schema section RowType elements with the
>> original names, so we would have something like this in the schema section:
>>
>
> 1. Is that legal per the SQL/XML spec?
>
It is certainly legal per XML and XSD specs, and the SQL/XML spec has
annotations using appinfo elements. It would be rather surprising if the
SQL/XML spec forbade annotations such as I propose. The spec is
mind-bogglingly impenetrable, though. Perhaps Peter or Nicholas might know.
> 2. What happens when the column name contains characters that would have
> to be escaped, such as "<" --- haven't you just replaced one de-escaping
> problem with another?
>
>
>
No. say the name is "foo & bar < baz". Then the annotation would be:
<pg:column-name>foo & bar < baz</pg:column-name>
But the difference is that the XML processor will automatically unescape
this value (and re-escape it on output if necessary). The user won't
have to do anything (or shouldn't if their XML processor is worth
anything at all). So in a stylesheet, I'd be able to do something like:
<xsl:for-each select="//[complexType[(at)name="RowType"]//pg:column-name">
<th><xsl:value-of select="." /></th>
</xsl:for-each>
and it would just Do The Right Thing. (If we didn't want the output
re-escaped, say when the otuput format was not XML or HTML, we could
make it do that too).
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2009-12-12 16:58:47 | Winflex |
Previous Message | Tom Lane | 2009-12-12 15:53:40 | Re: XML schemas and PG column names |