Search Postgresql Archives

Re: Converting xml to table with optional elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrus Moor wrote
> How to convert xml to table if some elements are optional in xml ?
> 
> In XML
> 
> /E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName
> element is optional.
> 
> If this is present, code below works OK.
> If ContactFirstName is not present , empty table is returned.
> 
> How to extract product code rows if ContactFirstName element is missing ?
> In result ContactFirstName column should have null on other value.

You have to process this in two passes.

First pass you create a table of documents by unnesting the non-optional
Document elements.
Second pass you explode each individual row/document on that table into its
components.

David J.



--
View this message in context: http://postgresql.nabble.com/Converting-xml-to-table-with-optional-elements-tp5828506p5828515.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux