Hi Ășt 14. 1. 2025 v 8:11 odesĂlatel Jim Jones <jim.jo...@uni-muenster.de> napsal:
> Hi, > > I'd like to propose the implementation of XMLDocument (SQL/XML X030).It > basically returns an XML document from a given XML expression, e.g. > > SELECT > xmldocument( > xmlelement(NAME foo, > xmlattributes(42 AS att), > xmlelement(NAME bar, > xmlconcat('va', 'lue')) > ) > ); > > xmldocument > -------------------------------------- > <foo att="42"><bar>value</bar></foo> > (1 row) > > XMLDocument doesn't do much. In fact, it might be reduced to a simple > xmlparse() call as XMLOPTION_DOCUMENT... > > xmlparse(data, XMLOPTION_DOCUMENT, true) > > ... to make sure that the given XML expression is a valid document - > still need some more research there. One could argue that XMLDocument() > is in most cases unnecessary, but I believe it would facilitate the > migration of scripts from other database products. > > Any thoughts? > I did some research and the design of this document is different 1. Oracle doesn't support this 2. DB2 has different implementations for z/OS (variadic) and for unix (nonvariadic) 3. looks so db2 allows some concatenation of xml content when xmlexpr is not the document already (not tested) 4. Your implementation just raise an exception I didn't find a free downloadable SQL/XML standard with description of XMLDOCUMENT so I read just the DB2 doc, but it isn't fully consistent and it is different from your implementation. So the argument of better compatibility for this patch doesn't look too strong. But I found that the usage of XMLDOCUMENT is required for storing XML, so it can be a frequently used function. Unfortunately, I do not have any knowledge about db2. It is hard to understand the usage of this function, because the sense is probably different than in DB2, and the documentation doesn't explain well an usage and motivation for this function. If it does a check, then it is not described in doc. Regards Pavel > Best, Jim > > > > > >