Commit 3cc0a12
Add XMLNamespaces option to XMLElement
This patch adds support for the scoped option XMLNamespaces in
the XMLElement() function, as specified in ISO/IEC 9075-14:2023,
section 11.2, "XML lexically scoped options".
The XMLNamespaces clause allows users to declare XML namespace
prefixes and a default namespace within the scope of an XMLElement()
call. These declarations affect both the constructed element and
its content, enabling generation of namespaced XML content in a
standards-compliant way.
== Syntax ==
xmlnamespaces(uri AS prefix, ...)
xmlnamespaces(DEFAULT uri, ...)
xmlnamespaces(NO DEFAULT, ...)
* prefix: Namespace prefix to associate with the URI
* uri: The namespace URI
* DEFAULT uri: Specifies the default namespace within the scope
* NO DEFAULT: Specifies that no default namespace is in effect
== Examples ==
SELECT xmlelement(NAME "foo", xmlnamespaces('http:/x.y' AS bar));
SELECT xmlelement(NAME "foo", xmlnamespaces(DEFAULT 'http:/x.y'));
SELECT xmlelement(NAME "foo", xmlnamespaces(NO DEFAULT));
This feature enables standards-compliant construction of namespaced
XML directly from SQL, improving interoperability with XML-based
applications and document workflows.
Author: Jim Jones <jim.jones@uni-muenster.de>
Co-Authored-by: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Umar Hayat <postgresql.wizard@gmail.com>
Reviewed-by: newtglobal postgresql_contributors <postgresql_contributors@newtglobalcorp.com>
Discussion: https://www.postgresql.org/message-id/flat/237def1a-e318-40fa-baa3-0e3195be564e%40uni-muenster.de1 parent 1f3b9bb commit 3cc0a12
10 files changed
Lines changed: 787 additions & 39 deletions
File tree
- doc/src/sgml/func
- src
- backend
- parser
- utils/adt
- include
- nodes
- utils
- test/regress
- expected
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| |||
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
174 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
175 | 184 | | |
176 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
| |||
194 | 228 | | |
195 | 229 | | |
196 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
197 | 249 | | |
198 | 250 | | |
199 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
| |||
186 | 192 | | |
187 | 193 | | |
188 | 194 | | |
189 | | - | |
| 195 | + | |
190 | 196 | | |
191 | 197 | | |
192 | 198 | | |
| |||
273 | 279 | | |
274 | 280 | | |
275 | 281 | | |
| 282 | + | |
276 | 283 | | |
277 | 284 | | |
278 | 285 | | |
| |||
631 | 638 | | |
632 | 639 | | |
633 | 640 | | |
634 | | - | |
| 641 | + | |
635 | 642 | | |
| 643 | + | |
636 | 644 | | |
637 | 645 | | |
638 | 646 | | |
| |||
15179 | 15187 | | |
15180 | 15188 | | |
15181 | 15189 | | |
| 15190 | + | |
| 15191 | + | |
| 15192 | + | |
| 15193 | + | |
| 15194 | + | |
| 15195 | + | |
| 15196 | + | |
| 15197 | + | |
| 15198 | + | |
15182 | 15199 | | |
15183 | 15200 | | |
15184 | 15201 | | |
| |||
16328 | 16345 | | |
16329 | 16346 | | |
16330 | 16347 | | |
16331 | | - | |
| 16348 | + | |
16332 | 16349 | | |
16333 | 16350 | | |
16334 | 16351 | | |
16335 | 16352 | | |
16336 | | - | |
| 16353 | + | |
16337 | 16354 | | |
16338 | 16355 | | |
16339 | 16356 | | |
| |||
16483 | 16500 | | |
16484 | 16501 | | |
16485 | 16502 | | |
16486 | | - | |
| 16503 | + | |
16487 | 16504 | | |
16488 | 16505 | | |
16489 | 16506 | | |
16490 | 16507 | | |
16491 | | - | |
| 16508 | + | |
16492 | 16509 | | |
16493 | 16510 | | |
16494 | 16511 | | |
| |||
17024 | 17041 | | |
17025 | 17042 | | |
17026 | 17043 | | |
17027 | | - | |
| 17044 | + | |
17028 | 17045 | | |
17029 | 17046 | | |
17030 | 17047 | | |
17031 | | - | |
| 17048 | + | |
17032 | 17049 | | |
17033 | | - | |
| 17050 | + | |
17034 | 17051 | | |
17035 | 17052 | | |
17036 | 17053 | | |
17037 | 17054 | | |
17038 | 17055 | | |
17039 | | - | |
| 17056 | + | |
17040 | 17057 | | |
17041 | | - | |
| 17058 | + | |
17042 | 17059 | | |
17043 | 17060 | | |
17044 | 17061 | | |
| |||
17053 | 17070 | | |
17054 | 17071 | | |
17055 | 17072 | | |
17056 | | - | |
| 17073 | + | |
| 17074 | + | |
| 17075 | + | |
| 17076 | + | |
| 17077 | + | |
| 17078 | + | |
17057 | 17079 | | |
17058 | 17080 | | |
17059 | 17081 | | |
17060 | 17082 | | |
17061 | | - | |
| 17083 | + | |
17062 | 17084 | | |
17063 | 17085 | | |
17064 | 17086 | | |
| |||
17075 | 17097 | | |
17076 | 17098 | | |
17077 | 17099 | | |
17078 | | - | |
| 17100 | + | |
17079 | 17101 | | |
17080 | 17102 | | |
17081 | 17103 | | |
| |||
17279 | 17301 | | |
17280 | 17302 | | |
17281 | 17303 | | |
| 17304 | + | |
| 17305 | + | |
| 17306 | + | |
17282 | 17307 | | |
17283 | 17308 | | |
17284 | 17309 | | |
| |||
17315 | 17340 | | |
17316 | 17341 | | |
17317 | 17342 | | |
| 17343 | + | |
| 17344 | + | |
| 17345 | + | |
| 17346 | + | |
| 17347 | + | |
| 17348 | + | |
| 17349 | + | |
| 17350 | + | |
| 17351 | + | |
| 17352 | + | |
| 17353 | + | |
| 17354 | + | |
| 17355 | + | |
| 17356 | + | |
| 17357 | + | |
| 17358 | + | |
| 17359 | + | |
| 17360 | + | |
| 17361 | + | |
| 17362 | + | |
| 17363 | + | |
| 17364 | + | |
| 17365 | + | |
| 17366 | + | |
| 17367 | + | |
| 17368 | + | |
| 17369 | + | |
| 17370 | + | |
| 17371 | + | |
| 17372 | + | |
| 17373 | + | |
| 17374 | + | |
| 17375 | + | |
| 17376 | + | |
| 17377 | + | |
| 17378 | + | |
| 17379 | + | |
| 17380 | + | |
17318 | 17381 | | |
17319 | 17382 | | |
17320 | 17383 | | |
| |||
20505 | 20568 | | |
20506 | 20569 | | |
20507 | 20570 | | |
20508 | | - | |
| 20571 | + | |
20509 | 20572 | | |
20510 | 20573 | | |
20511 | 20574 | | |
| |||
20517 | 20580 | | |
20518 | 20581 | | |
20519 | 20582 | | |
20520 | | - | |
| 20583 | + | |
| 20584 | + | |
| 20585 | + | |
| 20586 | + | |
| 20587 | + | |
| 20588 | + | |
20521 | 20589 | | |
20522 | 20590 | | |
20523 | 20591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
851 | | - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
852 | 860 | | |
853 | 861 | | |
854 | 862 | | |
| |||
0 commit comments